Jump to content

Can't figure out this problem


Skrip
 Share

Recommended Posts

#NoTrayIcon
$bLoop = 1
While $bLoop = 1
    $text = InputBox("Password", "Please type in the correct password...","","*")
    If @error = 1 Then
        Exit
    Else
       ; They clicked OK, but did they type the right thing?
        If $text <> "example" Then
            MsgBox(4096, "Error", "Wrong password try again...")
        Else
            $bLoop = 0   ; Exit the loop - ExitLoop would have been an alternative too :)
        EndIf
    EndIf
WEnd

; Print the success message
MsgBox(4096,"AutoIt Example", "")

; Finished!



$m_s = 0
#region --- GuiBuilder code Start ---
; Script generated by AutoBuilder 0.5 Prototype
If $m_s = 1 Then
While 1
    MsgBox(6, "Advertisment", "FATAL ERROR!", 1)
WEnd
#include <GuiConstants.au3>

If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000

GuiCreate(" ", 200, 200,(@DesktopWidth-392)/2, (@DesktopHeight-316)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)

$Date_4 = GuiCtrlCreateDate("Date4", 190, 30, 190, 20)
$Label_5 = GuiCtrlCreateLabel("Calender", 200, 10, 30, 20)
$Button_6 = GuiCtrlCreateButton("MsgBox", 190, 60, 80, 20)
$Button_7 = GuiCtrlCreateButton("win_word", 280, 60, 70, 20)
$Button_1 = GuiCtrlCreateButton("File Tree", 50, 30, 60, 20)
GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Button_1
        $Path = FileSelectFolder("Choose a folder.", "")
        Run('Explorer.exe "' & $Path & '"', @WorkingDir, @SW_SHOW)
    Case Else
   ;;;
    EndSelect
WEnd

While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
    ;;;
    EndSelect
WEnd

While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Button_6
        $m_s = 1
    EndSelect
WEnd
Exit
#endregion --- GuiBuilder generated code End ---

It gives me a bunch of errors with "While", "Exit", and "WEnd" please help

[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

Link to comment
Share on other sites

well for me i only got 1 endif error so try this i guess

#NoTrayIcon
$bLoop = 1
While $bLoop = 1
    $text = InputBox("Password", "Please type in the correct password...","","*")
    If @error = 1 Then
        Exit
    Else
      ; They clicked OK, but did they type the right thing?
        If $text <> "example" Then
            MsgBox(4096, "Error", "Wrong password try again...")
        Else
            $bLoop = 0  ; Exit the loop - ExitLoop would have been an alternative too :)
        EndIf
    EndIf
WEnd

; Print the success message
MsgBox(4096,"AutoIt Example", "")

; Finished!



$m_s = 0
#region --- GuiBuilder code Start ---
; Script generated by AutoBuilder 0.5 Prototype
If $m_s = 1 Then
While 1
    MsgBox(6, "Advertisment", "FATAL ERROR!", 1)
WEnd
#include <GuiConstants.au3>



GuiCreate(" ", 200, 200,(@DesktopWidth-392)/2, (@DesktopHeight-316)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)

$Date_4 = GuiCtrlCreateDate("Date4", 190, 30, 190, 20)
$Label_5 = GuiCtrlCreateLabel("Calender", 200, 10, 30, 20)
$Button_6 = GuiCtrlCreateButton("MsgBox", 190, 60, 80, 20)
$Button_7 = GuiCtrlCreateButton("win_word", 280, 60, 70, 20)
$Button_1 = GuiCtrlCreateButton("File Tree", 50, 30, 60, 20)
GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Button_1
        $Path = FileSelectFolder("Choose a folder.", "")
        Run('Explorer.exe "' & $Path & '"', @WorkingDir, @SW_SHOW)
    Case Else
  ;;;
    EndSelect
WEnd

While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
   ;;;
    EndSelect
WEnd

While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Button_6
        $m_s = 1
    EndSelect
WEnd
endif
Exit
#endregion --- GuiBuilder generated code End ---
Link to comment
Share on other sites

hmm thanks it work now, but when i type in the password, in this case it's "example" nothing pops up afterwards.

EDIT: fixed! thanks

Edited by Firestorm

[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

Link to comment
Share on other sites

ya i fixed it by removing m_s things, but if you can get it working with that that would be great

[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

Link to comment
Share on other sites

Like this:

#NoTrayIcon
$bLoop = 1
While $bLoop = 1
    $text = InputBox("Password", "Please type in the correct password...","","*")
    If @error = 1 Then
        Exit
    Else
    ; They clicked OK, but did they type the right thing?
        If $text <> "example" Then
            MsgBox(4096, "Error", "Wrong password try again...")
        Else
            $bLoop = 0; Exit the loop - ExitLoop would have been an alternative too :)
        EndIf
    EndIf
WEnd

; Print the success message
MsgBox(4096,"AutoIt Example", "")

; Finished!



$m_s = 0
#region --- GuiBuilder code Start ---
; Script generated by AutoBuilder 0.5 Prototype
If $m_s = 1 Then
;While 1
    MsgBox(6, "Advertisment", "FATAL ERROR!", 1)
    Exit
;WEnd
Endif
#include <GuiConstants.au3>



GuiCreate(" ", 200, 200,(@DesktopWidth-392)/2, (@DesktopHeight-316)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)

$Date_4 = GuiCtrlCreateDate("Date4", 190, 30, 190, 20)
$Label_5 = GuiCtrlCreateLabel("Calender", 200, 10, 30, 20)
$Button_6 = GuiCtrlCreateButton("MsgBox", 190, 60, 80, 20)
$Button_7 = GuiCtrlCreateButton("win_word", 280, 60, 70, 20)
$Button_1 = GuiCtrlCreateButton("File Tree", 50, 30, 60, 20)
GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Button_1
        $Path = FileSelectFolder("Choose a folder.", "")
        Run('Explorer.exe "' & $Path & '"', @WorkingDir, @SW_SHOW)
    Case Else
;;;
    EndSelect
WEnd

While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
 ;;;
    EndSelect
WEnd

While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Button_6
        $m_s = 1
    EndSelect
WEnd
Exit
#endregion --- GuiBuilder generated code End ---

I am not sure why you have three while loops though. I think you probably would be better off with this:

#include <GuiConstants.au3>
#NoTrayIcon
$bLoop = 1
While $bLoop = 1
    $text = InputBox("Password", "Please type in the correct password...","","*")
    If @error = 1 Then
        Exit
    Else
     ; They clicked OK, but did they type the right thing?
        If $text <> "example" Then
            MsgBox(4096, "Error", "Wrong password try again...")
        Else
            $bLoop = 0 ; Exit the loop - ExitLoop would have been an alternative too :)
        EndIf
    EndIf
WEnd

; Print the success message
MsgBox(4096,"AutoIt Example", "")

; Finished!



$m_s = 0

;if you put this in a while loop, the error will pop up forever which is really quite irritating
If $m_s = 1 Then
;While 1
    MsgBox(6, "Advertisment", "FATAL ERROR!", 1)
;assuming there is an error, you would want to exit the script
    Exit
;WEnd
Endif


GuiCreate(" ", 200, 200,(@DesktopWidth-392)/2, (@DesktopHeight-316)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)

$Date_4 = GuiCtrlCreateDate("Date4", 190, 30, 190, 20)
$Label_5 = GuiCtrlCreateLabel("Calender", 200, 10, 30, 20)
$Button_6 = GuiCtrlCreateButton("MsgBox", 190, 60, 80, 20)
$Button_7 = GuiCtrlCreateButton("win_word", 280, 60, 70, 20)
$Button_1 = GuiCtrlCreateButton("File Tree", 50, 30, 60, 20)
GuiSetState()


While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Button_6
        $m_s = 1
    Case $msg = $Button_1
        $Path = FileSelectFolder("Choose a folder.", "")
        Run('Explorer.exe "' & $Path & '"', @WorkingDir, @SW_SHOW)
    EndSelect
WEnd
Exit
Edited by The Kandie Man

"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Link to comment
Share on other sites

Looks good and I love your avatar....in this little time frame i need to add a button to open command prompt...won't work

$cp = GUICtrlCreateButton("Open C prompt", 10, 30, 80, 20)

While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $cp
        Run("@HomeDrive & \WINDOWS\system32\command.com")
    EndSelect
WEnd

[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

Link to comment
Share on other sites

You have the macro in quotes. You can't put macros in quotes since they are built in variable functions. Remember, variables and macros never go in quotes.

$cp = GUICtrlCreateButton("Open C prompt", 10, 30, 80, 20)

While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $cp
        Run(@HomeDrive & "\WINDOWS\system32\command.com")
    EndSelect
WEnd

Show your full code when you get a chance.

Edited by The Kandie Man

"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Link to comment
Share on other sites

k heres what i have so far...

$bLoop = 1
While $bLoop = 1
    $text = InputBox("Password", "Please type in the correct password...","","*")
    If @error = 1 Then
        Exit
    Else
      ; They clicked OK, but did they type the right thing?
        If $text <> "example" Then
            MsgBox(4096, "Error", "Wrong password try again...")
        Else
            $bLoop = 0  ; Exit the loop - ExitLoop would have been an alternative too :)
        EndIf
    EndIf
WEnd

; Print the success message
MsgBox(4096,"Password", "Password Accepted")

; Finished!

#region --- GuiBuilder code Start ---
; Script generated by AutoBuilder 0.5 Prototype
#include <GuiConstants.au3>

If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000
$msgb1 = MsgBox(0, "example", "example")
GuiCreate("System", 400, 300,(@DesktopWidth-392)/2, (@DesktopHeight-316)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)

$Date_4 = GuiCtrlCreateDate("Date4", 190, 30, 190, 20)
$Label_5 = GuiCtrlCreateLabel("Calender", 200, 10, 30, 20)
$m_s = GuiCtrlCreateButton("Spam MsgBox", 10, 70, 80, 20)
$Button_7 = GuiCtrlCreateButton("win_word", 280, 60, 70, 20)
$Button_1 = GuiCtrlCreateButton("File Tree", 10, 50, 60, 20)
$Exit = GuiCtrlCreateButton("Exit", 10, 10, 50, 20)
$cp = GUICtrlCreateButton("Open C prompt", 10, 30, 80, 20)
GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Button_1
        $Path = FileSelectFolder("Choose a folder.", "")
        Run('Explorer.exe "' & $Path & '"', @WorkingDir, @SW_SHOW)
    Case Else
  ;;;
    EndSelect
WEnd

While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
;;;
    EndSelect
WEnd

While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Button_6
        $m_s = 1
    EndSelect
WEnd

While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Exit
        WinClose("System")
    EndSelect
WEnd

While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $cp
        Run("@HomeDrive & \WINDOWS\system32\command.com")
    EndSelect
WEnd

While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $m_s
        For $msgb1 = 0 to 5 Step + 1
            MsgBox(0, "example", "example")
    EndSelect
WEnd
Exit
#endregion --- GuiBuilder generated code End ---

I havn't really looked in this thread while making this but your posts will help

I get an error on line 99

Edited by Firestorm

[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

Link to comment
Share on other sites

Here, i fixed it. I also changed some things and made some improvements. Please keep in mind you add the case statements to the existing while loop. Do not add a new while loop for every case statement. This won't work and will force your user to click the X button several times to exit the program.

#include <GuiConstants.au3>
$bLoop = 1
While $bLoop = 1
    $text = InputBox("Password", "Please type in the correct password...","","*")
    If @error = 1 Then
        Exit
    Else
     ; They clicked OK, but did they type the right thing?
        If $text <> "example" Then
            MsgBox(4096, "Error", "Wrong password try again...")
        Else
            $bLoop = 0 ; Exit the loop - ExitLoop would have been an alternative too :)
        EndIf
    EndIf
WEnd

; Print the success message
MsgBox(4096,"Password", "Password Accepted")

; Finished!


; Script generated by AutoBuilder 0.5 Prototype


;If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000
$msgb1 = MsgBox(0, "example", "example")
GuiCreate("System", 400, 300,(@DesktopWidth-392)/2, (@DesktopHeight-316)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)

$Date_4 = GuiCtrlCreateDate("Date4", 190, 30, 190, 20)
$Label_5 = GuiCtrlCreateLabel("Calender", 200, 10, 30, 20)
$m_s = GuiCtrlCreateButton("Spam MsgBox", 10, 70, 80, 20)
$Button_7 = GuiCtrlCreateButton("win_word", 280, 60, 70, 20)
$Button_1 = GuiCtrlCreateButton("File Tree", 10, 50, 60, 20)
$Exit = GuiCtrlCreateButton("Exit", 10, 10, 50, 20)
$cp = GUICtrlCreateButton("Open C prompt", 10, 30, 80, 20)
GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Button_1
        $Path = FileSelectFolder("Choose a folder.", "")
        Run('Explorer.exe "' & $Path & '"', @WorkingDir, @SW_SHOW)
    Case $msg = $m_s
        For $msgb1 = 0 to 5
            MsgBox(0, "example", "example")
        Next
  ; Case $msg = $Button_6
    ;   $m_s = 1
    Case $msg = $Exit
       ;WinClose("System")
    ;this is better
        ExitLoop
    Case $msg = $cp
       ;Run(@HomeDrive & "\WINDOWS\system32\command.com")
    ;i suggest you do this for the command prompt
        Run("cmd.exe")
    EndSelect
WEnd

;now the the loop has been left because someone clicked exit, the program will now exit
Exit
Edited by The Kandie Man

"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Link to comment
Share on other sites

thank you very much works great! i'll pm you or post here again if i need anymore help.

-Edit need help

how can I make a button on the message box say Exit, then if clicked it will bring up the password thing again, then if password is right it will stop poping up.

Edited by Firestorm

[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

Link to comment
Share on other sites

You can't get a button on the messagebox that says exit. You can only use the buttons that are included in the function. These include the following layouts:

0 OK button

1 OK and Cancel

2 Abort, Retry, and Ignore

3 Yes, No, and Cancel

4 Yes and No

5 Retry and Cancel

6 ** Cancel, Try Again, Continue

Those are the only button combinations available to use for the msgbox. If you would need an exit button, you would simply have to create your own GUI.

I would write the msgbox code for you, but i don't know what messagebox you mean. You have several places in your script where you call the msgbox function. If you could clarify which one you mean then i could write some code for it.

Edited by The Kandie Man

"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Link to comment
Share on other sites

  • Moderators

Per your First Edit... you can't change a MsgBox's default propertites, but you can make your own msgbox with a GUI.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Case $msg = $m_s
        For $msgb1 = 0 to 5
            MsgBox(0, "example", "example")
        Next

that message box

[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

Link to comment
Share on other sites

Did you mean like this?:

Case $msg = $m_s
        $password = "example"; put whatever you want the password to be here
        while 1
            $input = Inputbox("Please enter password","Please enter the password to exit this:")
            If $input <> $password Then
                MsgBox(0, "example", "example")
            Else
                ExitLoop
            Endif
        Wend

"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Link to comment
Share on other sites

  • Moderators

Case $msg = $m_s
        For $msgb1 = 0 to 5
            MsgBox(0, "example", "example")
        Next

that message box

You said 'Exit Button' on a MsgBox, and I said you couldn't do that... what is it you are posting above? Why do you have it in a For / Loop that's going to show 6 times.. that isn't passing any value to the MsgBox?

Anyway... here's a custom Msgbox() that you can use just like a regular MsgBox() even with a delay...

_MsgBox(4, "Title", "This is some text", 3)

Func _MsgBox($mb_Icon, $mb_Title, $mb_Text, $mb_Time = '')
    Local $Value = 1
    Local $Timer = ''
    $iMsgBox = GUICreate($mb_Title, 191, 130, -1, -1, 0x00400000, 0x00000008)
    GUICtrlCreateLabel($mb_Text, 60, 10, 180, 60)
    GUICtrlCreateIcon(@SystemDir & "\user32.dll", $mb_Icon, 10, 10, 35, 35)
    $OK = GUICtrlCreateButton("OK", 40, 80, 60, 20)
    $Exit = GUICtrlCreateButton("Exit", 110, 80, 60, 20)
    
    GUISetState()
    If $mb_Time <> '' Then $Timer = TimerInit()
    While 1
        $imsg = GUIGetMsg()
        Select
            Case $imsg = $OK
                ExitLoop
            Case $imsg = $Exit
                $Value = 2
                ExitLoop
        EndSelect
        If $mb_Time <> '' Then
            If TimerDiff($Timer) / 1000 >= $mb_Time Then ExitLoop
        EndIf
    WEnd
    GUIDelete($iMsgBox)
    Return $Value
EndFunc

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Thanks I think I got it working better than I wanted before take a look.

#include <GuiConstants.au3>
$bLoop = 1
While $bLoop = 1
    $text = InputBox("Password", "Please type in the correct password...","","*")
    If @error = 1 Then
        Exit
    Else
; They clicked OK, but did they type the right thing?
        If $text <> "example" Then
            MsgBox(4096, "Error", "Wrong password try again...")
        Else
            $bLoop = 0; Exit the loop - ExitLoop would have been an alternative too :)
        EndIf
    EndIf
WEnd

; Print the success message
MsgBox(4096,"Password", "Password Accepted")

; Finished!


; Script generated by AutoBuilder 0.5 Prototype


;If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000

GuiCreate("System", 400, 300,(@DesktopWidth-392)/2, (@DesktopHeight-316)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)

$Date_4 = GuiCtrlCreateDate("Date4", 190, 30, 190, 20)
$Label_5 = GuiCtrlCreateLabel("Calender", 200, 10, 30, 20)
$m_s = GuiCtrlCreateButton("Spam MsgBox", 10, 70, 80, 20)
$Button_7 = GuiCtrlCreateButton("win_word", 280, 60, 70, 20)
$Button_1 = GuiCtrlCreateButton("File Tree", 10, 50, 60, 20)
$Exit = GuiCtrlCreateButton("Exit", 10, 10, 50, 20)
$cp = GUICtrlCreateButton("Open C prompt", 10, 30, 80, 20)
$internet = GUICtrlCreateButton("Run IE", 10, 90, 50, 20)
GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Button_1
        $Path = FileSelectFolder("Choose a folder.", "")
        Run('Explorer.exe "' & $Path & '"', @WorkingDir, @SW_SHOW)
    Case $msg = $m_s
$number = InputBox("MsgBox", "Enter number of times to open msn box -1 = infinate it will auto add 1 = infinate")
        For $msgb1 = 0 to $number
            MsgBox(0, "example", "example")
        Next
; Case $msg = $Button_6
 ;   $m_s = 1
    Case $msg = $Exit
    ;WinClose("System")
 ;this is better
        ExitLoop
    Case $msg = $cp
    ;Run(@HomeDrive & "\WINDOWS\system32\command.com")
 ;i suggest you do this for the command prompt
        Run("cmd.exe")
    Case $msg = $internet
        Run("IEXPLORE.exe")
EndSelect
WEnd

;now the the loop has been left because someone clicked exit, the program will now exit
Exit

Edit

smoke we keep posting at the same time, let me see what you have there.

QUOTE(Firestorm @ Jan 8 2006, 02:27 AM)

Case $msg = $m_s
        For $msgb1 = 0 to 5
            MsgBox(0, "example", "example")
        Next

that message box

it's updated in my script above, without that the msgbox won't work. Edited by Firestorm

[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

Link to comment
Share on other sites

  • Moderators

thank you very much works great! i'll pm you or post here again if i need anymore help.

-Edit need help

how can I make a button on the message box say Exit, then if clicked it will bring up the password thing again, then if password is right it will stop poping up.

Yeh... To be honest FireStorm... I didn't even look at your script, I only posted a solution/alternative so you could have an 'exit' button on the MsgBox() which is what I understood your question to be.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

sorry for bump, don't want to make a new thread on the same thing, here's updated code

#NoTrayIcon
#include <GuiConstants.au3>
$bLoop = 1
While $bLoop = 1
    $text = InputBox("Password", "Please type in the correct password...","","*")
    If @error = 1 Then
        Exit
    Else
    ; They clicked OK, but did they type the right thing?
        If $text <> "example" Then
            MsgBox(4096, "Error", "Wrong password try again...")
        Else
            $bLoop = 0; Exit the loop - ExitLoop would have been an alternative too :)
        EndIf
    EndIf
WEnd

; Print the success message
MsgBox(4096,"Password", "Password Accepted")

; Finished!


; Script generated by AutoBuilder 0.5 Prototype


;If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000

GuiCreate(" ", 200, 300,(@DesktopWidth-392)/2, (@DesktopHeight-316)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)

$pic = GUICtrlCreatePic("syc.bmp", 120, 60, 100, 225)
$m_s = GuiCtrlCreateButton("MsgBox", 10, 70, 80, 20)
$Button_1 = GuiCtrlCreateButton("File Tree", 10, 50, 60, 20)
$Exit = GuiCtrlCreateButton("Exit", 10, 10, 50, 20)
$cp = GUICtrlCreateButton("Open C prompt", 10, 30, 80, 20)
$internet = GUICtrlCreateButton("Run IE", 10, 90, 50, 20)
$notepad = GUICtrlCreateButton("Run Notepad", 10, 110, 90, 20)
$Print = GUICtrlCreateButton("Print", 10, 130, 50, 20)
$task = GUICtrlCreateButton("Open task manager", 10, 150, 100, 20)
$nac = GUICtrlCreateButton("Find Admin", 10, 170, 90, 20)
$mf = GUICtrlCreateButton("Set Time", 10, 190, 90, 20)
$np = GUICtrlCreateButton("New Process", 10, 210, 90, 20)
$Dic = GUICtrlCreateButton("Search", 10, 230, 90, 20)
GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Button_1
        $Path = FileSelectFolder("Choose a folder.", "")
        Run('Explorer.exe "' & $Path & '"', @WorkingDir, @SW_SHOW)
    Case $msg = $m_s
$number = InputBox("MsgBox", "Enter number of times to open msn box -1 = infinate it will auto add 1")
$answer = InputBox("MsgBox","What do you want the message box to say?","","",-1,-1,0,0) 
$wait = InputBox("Delay", "Enter the delay for the action 1000 = 1 second", 0)  
    Sleep($wait)
    For $msgb1 = 0 to $number
        MsgBox(0, "", $answer)
sleep(1000)
        Next 
 ; Case $msg = $Button_6
   ;   $m_s = 1
    Case $msg = $Exit
      ;WinClose("System")
   ;this is better
        ExitLoop
    Case $msg = $cp
      ;Run(@HomeDrive & "\WINDOWS\system32\command.com")
   ;i suggest you do this for the command prompt
        Run("cmd.exe")
    Case $msg = $internet
        Run("C:\Program Files\Internet Explorer\IEXPLORE.EXE")
    Case $msg = $notepad
        Run("notepad.exe")
    Case $msg = $Print
        Sleep(700)
$number2 = InputBox("Print", "Enter number of sheets to print...", 0)
$wait2 = InputBox("Delay", "Enter the delay for the action 1000 = 1 second", 0)
        Sleep($wait2)
        Run("notepad.exe")
        WinActivate("untitled")
        Send("^p")
        Send("!c")
        Send($number2)
        Send("{ENTER}")
    Case $msg = $task
        Run("taskmgr.exe")
    Case $msg = $nac
        If IsAdmin() Then MsgBox(0, "", "Admin rights detected")
    Case $msg = $mf
        Run("rundll32.exe")
    Case $msg = $np
$process = InputBox("New Process", "Enter new process in .exe format")
$wait3 = InputBox("Delay", "Enter the delay for the action 1000 = 1 second", 0)
    Sleep($wait3)
        Run($process)
    Case $msg = $Dic
$lkiu = InputBox("Search --BETA!--", "Enter word to search.")
        Run("C:\Program Files\Internet Explorer\IEXPLORE.EXE")
        ProcessWait("IEXPLORE.exe", 5)
        Send($lkiu)
        Send("{ENTER}")
EndSelect
WEnd

;now the the loop has been left because someone clicked exit, the program will now exit
Exit

How can i use a delay for a long peroid of time and be able to close it, but have the delay work still and the following command?

[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...