|
You last visited: Today at 10:26
Advertisement
Autoit Problem
Discussion on Autoit Problem within the AutoIt forum part of the Coders Den category.
12/04/2012, 15:48
|
#1
|
elite*gold: 0
Join Date: Jun 2012
Posts: 11
Received Thanks: 0
|
Autoit Problem
hallo leute habe erst vor kurzem mit autoit angefangen hatte nun versucht ein programm zu schreiben (das nicht geht). mein problem ist es dass ich nicht weiß ob die sache mit dem if so richtig ist bzw. geht aufjedenfall habe ich immer einen error in den letzten zeilen. ich weiß einfach nicht was ich falsch gemacht habe. bitte um hilfe.
vielen dank im voraus
Code:
#include <Sound.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1_1 = GUICreate("Fragen", 524, 507, 211, 128)
$Label1 = GUICtrlCreateLabel("Wo hat das BVG den Sitz?", 8, 16, 500, 30)
GUICtrlSetFont(-1, 14, 400, 0, "Comic Sans MS")
$Label2 = GUICtrlCreateLabel("Aus wie vielen Senaten besteht das BVG?", 8, 104, 500, 30)
GUICtrlSetFont(-1, 14, 400, 0, "Comic Sans MS")
$Label3 = GUICtrlCreateLabel("Wie viele Bundesrichter befinden sich in einem Senat?", 8, 192, 500, 30)
GUICtrlSetFont(-1, 14, 400, 0, "Comic Sans MS")
$Label4 = GUICtrlCreateLabel("Das BVG kontrolliert die _____ der Gerichte.", 8, 280, 500, 30)
GUICtrlSetFont(-1, 14, 400, 0, "Comic Sans MS")
$Label5 = GUICtrlCreateLabel("Wie wird das BVG noch genannt?", 8, 368, 500, 30)
GUICtrlSetFont(-1, 14, 400, 0, "Comic Sans MS")
$i1 = GUICtrlCreateInput("", 8, 144, 500, 34)
GUICtrlSetFont(-1, 14, 400, 0, "Comic Sans MS")
$i2 = GUICtrlCreateInput("", 8, 320, 500, 34)
GUICtrlSetFont(-1, 14, 400, 0, "Comic Sans MS")
$i3 = GUICtrlCreateInput("", 8, 56, 500, 34)
GUICtrlSetFont(-1, 14, 400, 0, "Comic Sans MS")
$i4 = GUICtrlCreateInput("", 8, 232, 500, 34)
GUICtrlSetFont(-1, 14, 400, 0, "Comic Sans MS")
$i5 = GUICtrlCreateInput("", 8, 408, 500, 34)
GUICtrlSetFont(-1, 14, 400, 0, "Comic Sans MS")
$Button1 = GUICtrlCreateButton("Button1", 8, 464, 235, 25)
GUICtrlSetFont(-1, 14, 400, 0, "Comic Sans MS")
$Button2 = GUICtrlCreateButton("Schließen", 272, 464, 235, 25)
GUICtrlSetFont(-1, 14, 400, 0, "Comic Sans MS")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button2
$neg = _SoundOpen ("neg.mp3")
_SoundPlay ($neg)
Sleep (2000)
_SoundClose ($neg)
Exit
Case $Button1
$f1 = GUICtrlRead ($i1)
$f2 = GUICtrlRead ($i2)
$f3 = GUICtrlRead ($i3)
$f4 = GUICtrlRead ($i4)
$f5 = GUICtrlRead ($i5)
If $f1 = "Karlsruhe" Then
If $f2 = "2" Then
If $f3 = "8" Then
If $f4 = "Unabhängigkeit" Then
If $f5 = "Hüter der Verfassung" Then
$pos = _SoundOpen ("pos.mp3")
_SoundPlay ($pos)
Sleep (5000)
_SoundClose ($pos)
Exit
Else
$neg = _SoundOpen ("neg.mp3")
_SoundPlay ($neg)
Sleep (2000)
_SoundClose ($neg)
Exit
EndSwitch
WEnd
|
|
|
12/04/2012, 16:33
|
#2
|
elite*gold: 64
Join Date: May 2011
Posts: 1,229
Received Thanks: 854
|
Code:
#include <Sound.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1_1 = GUICreate("Fragen", 524, 507, 211, 128)
$Label1 = GUICtrlCreateLabel("Wo hat das BVG den Sitz?", 8, 16, 500, 30)
GUICtrlSetFont(-1, 14, 400, 0, "Comic Sans MS")
$Label2 = GUICtrlCreateLabel("Aus wie vielen Senaten besteht das BVG?", 8, 104, 500, 30)
GUICtrlSetFont(-1, 14, 400, 0, "Comic Sans MS")
$Label3 = GUICtrlCreateLabel("Wie viele Bundesrichter befinden sich in einem Senat?", 8, 192, 500, 30)
GUICtrlSetFont(-1, 14, 400, 0, "Comic Sans MS")
$Label4 = GUICtrlCreateLabel("Das BVG kontrolliert die _____ der Gerichte.", 8, 280, 500, 30)
GUICtrlSetFont(-1, 14, 400, 0, "Comic Sans MS")
$Label5 = GUICtrlCreateLabel("Wie wird das BVG noch genannt?", 8, 368, 500, 30)
GUICtrlSetFont(-1, 14, 400, 0, "Comic Sans MS")
$i1 = GUICtrlCreateInput("", 8, 144, 500, 34)
GUICtrlSetFont(-1, 14, 400, 0, "Comic Sans MS")
$i2 = GUICtrlCreateInput("", 8, 320, 500, 34)
GUICtrlSetFont(-1, 14, 400, 0, "Comic Sans MS")
$i3 = GUICtrlCreateInput("", 8, 56, 500, 34)
GUICtrlSetFont(-1, 14, 400, 0, "Comic Sans MS")
$i4 = GUICtrlCreateInput("", 8, 232, 500, 34)
GUICtrlSetFont(-1, 14, 400, 0, "Comic Sans MS")
$i5 = GUICtrlCreateInput("", 8, 408, 500, 34)
GUICtrlSetFont(-1, 14, 400, 0, "Comic Sans MS")
$Button1 = GUICtrlCreateButton("Button1", 8, 464, 235, 25)
GUICtrlSetFont(-1, 14, 400, 0, "Comic Sans MS")
$Button2 = GUICtrlCreateButton("Schließen", 272, 464, 235, 25)
GUICtrlSetFont(-1, 14, 400, 0, "Comic Sans MS")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button2
$neg = _SoundOpen ("neg.mp3")
_SoundPlay ($neg)
Sleep (2000)
_SoundClose ($neg)
Exit
Case $Button1
$f1 = GUICtrlRead ($i1)
$f2 = GUICtrlRead ($i2)
$f3 = GUICtrlRead ($i3)
$f4 = GUICtrlRead ($i4)
$f5 = GUICtrlRead ($i5)
If $f1 = "Karlsruhe" Then
If $f2 = "2" Then
If $f3 = "8" Then
If $f4 = "Unabhängigkeit" Then
If $f5 = "Hüter der Verfassung" Then
$pos = _SoundOpen ("pos.mp3")
_SoundPlay ($pos)
Sleep (5000)
_SoundClose ($pos)
Exit
Else
$neg = _SoundOpen ("neg.mp3")
_SoundPlay ($neg)
Sleep (2000)
_SoundClose ($neg)
Exit
EndIf
EndIf
EndIf
EndIf
EndIf
EndSwitch
WEnd
Weitere Fragen kannst mir auch über Skype stellen:
MrBladeTiger12
|
|
|
12/04/2012, 16:33
|
#3
|
elite*gold: 528
Join Date: Jan 2012
Posts: 2,127
Received Thanks: 2,403
|
Damit du auch was lernst:
STRG+T
in SciTE drücken
MfG
€dit: @BladeTiger12 [code][/code] <--
|
|
|
12/04/2012, 16:38
|
#4
|
ベトナム警察
elite*gold: 0
Join Date: Jan 2012
Posts: 16,498
Received Thanks: 3,525
|
Bei einer If - Abfrage benötigst du die EndIf Befehl, damit die If - Abfrage auch endet.
|
|
|
12/04/2012, 16:46
|
#5
|
elite*gold: 528
Join Date: Jan 2012
Posts: 2,127
Received Thanks: 2,403
|
Code:
;### Tidy Error -> "endswitch" is closing previous "if" on line 57
EndSwitch
;### Tidy Error -> "wend" is closing previous "if" on line 56
WEnd
;### Tidy Error -> if is never closed in your script.
;### Tidy Error -> if is never closed in your script.
;### Tidy Error -> if is never closed in your script.
;### Tidy Error -> if is never closed in your script.
;### Tidy Error -> if is never closed in your script.
Tidy FTW
Code:
#include <Sound.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#region ### START Koda GUI section ### Form=
$Form1_1 = GUICreate("Fragen", 524, 507, 211, 128)
$Label1 = GUICtrlCreateLabel("Wo hat das BVG den Sitz?", 8, 16, 500, 30)
GUICtrlSetFont(-1, 14, 400, 0, "Comic Sans MS")
$Label2 = GUICtrlCreateLabel("Aus wie vielen Senaten besteht das BVG?", 8, 104, 500, 30)
GUICtrlSetFont(-1, 14, 400, 0, "Comic Sans MS")
$Label3 = GUICtrlCreateLabel("Wie viele Bundesrichter befinden sich in einem Senat?", 8, 192, 500, 30)
GUICtrlSetFont(-1, 14, 400, 0, "Comic Sans MS")
$Label4 = GUICtrlCreateLabel("Das BVG kontrolliert die _____ der Gerichte.", 8, 280, 500, 30)
GUICtrlSetFont(-1, 14, 400, 0, "Comic Sans MS")
$Label5 = GUICtrlCreateLabel("Wie wird das BVG noch genannt?", 8, 368, 500, 30)
GUICtrlSetFont(-1, 14, 400, 0, "Comic Sans MS")
$i1 = GUICtrlCreateInput("", 8, 144, 500, 34)
GUICtrlSetFont(-1, 14, 400, 0, "Comic Sans MS")
$i2 = GUICtrlCreateInput("", 8, 320, 500, 34)
GUICtrlSetFont(-1, 14, 400, 0, "Comic Sans MS")
$i3 = GUICtrlCreateInput("", 8, 56, 500, 34)
GUICtrlSetFont(-1, 14, 400, 0, "Comic Sans MS")
$i4 = GUICtrlCreateInput("", 8, 232, 500, 34)
GUICtrlSetFont(-1, 14, 400, 0, "Comic Sans MS")
$i5 = GUICtrlCreateInput("", 8, 408, 500, 34)
GUICtrlSetFont(-1, 14, 400, 0, "Comic Sans MS")
$Button1 = GUICtrlCreateButton("Button1", 8, 464, 235, 25)
GUICtrlSetFont(-1, 14, 400, 0, "Comic Sans MS")
$Button2 = GUICtrlCreateButton("Schließen", 272, 464, 235, 25)
GUICtrlSetFont(-1, 14, 400, 0, "Comic Sans MS")
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button2
$neg = _SoundOpen("neg.mp3")
_SoundPlay($neg)
Sleep(2000)
_SoundClose($neg)
Exit
Case $Button1
If GUICtrlRead($i1) = "Karlsruhe" And GUICtrlRead($i2) = "2" And GUICtrlRead($i3) = "8" And GUICtrlRead($i4) = "Unabhängigkeit" And $GUICtrlRead($i5) = "Hüter der Verfassung" Then
$pos = _SoundOpen("pos.mp3")
_SoundPlay($pos)
Sleep(5000)
_SoundClose($pos)
Exit
Else
$neg = _SoundOpen("neg.mp3")
_SoundPlay($neg)
Sleep(2000)
_SoundClose($neg)
Exit
EndIf
EndSwitch
WEnd
MfG
|
|
|
12/04/2012, 16:55
|
#6
|
elite*gold: 64
Join Date: May 2011
Posts: 1,229
Received Thanks: 854
|
Ich schreibe die IF-Abfragen ungerne so lange.
Das stört mich irgendwie beim Programme schreiben.
Und so sieht es eh viel übersichtlicher aus.
|
|
|
12/04/2012, 17:07
|
#7
|
elite*gold: 0
Join Date: Jun 2012
Posts: 11
Received Thanks: 0
|
danke an alle das hat mir geholfen das mit dem endif hatte ich gewusst aber ich hatte nicht gewusst dass ich das für jedes if schreiben muss
|
|
|
All times are GMT +1. The time now is 10:28.
|
|