Jump to content

hi guys i got stuck in some command i want to do


Recommended Posts

sorry for didnt write any information at title i forgot

hi guys i still learning autoit script and i have a small question if anyone knows.

my script make a question of yes and no and i wanna make an option for my client .

when he press no i wanna let him choose the time to run script, and after the time gone it ask again if run the script or wait again(i wanna backup outlook files and i cant close the program when my manager write some important mails so i let him choose the time).

thanks anyways

; Prompt the user to run the script - use a Yes/No prompt (4 - see help file)

$answer = MsgBox(4, "AutoIt Example (English Only)", "run backup now?")

; Check the user's answer to the prompt (see the help file for MsgBox return values)

; If "No" was clicked (7) then exit the script

If $answer = 7 Then

MsgBox(0, "choose time to run backup")

EndIf

; Run MSDos

Run("notepad.exe")

WinWaitActive("[CLASS:Notepad]")

Edited by niruse
Link to comment
Share on other sites

Hello,

If $answer = 7

This will put the value "7" inside the variable "$answer".

For testing if the variable "$answer" is equal to the value "7", you need to use the double equal sign like this:

If $answer == 7
Edited by Neutro
Link to comment
Share on other sites

niruse, maybe this helps you.

; Prompt the user to run the script - use a Yes/No prompt (4 - see help file)
$answer = MsgBox(4, "AutoIt Example (English Only)", "run backup now?")

; Check the user's answer to the prompt (see the help file for MsgBox return values)
; If "No" was clicked (7) then exit the script
If $answer = 7 Then
Local $minutes = InputBox("Postpone backup", "How many minutes to postpone the backup?", 10) ; question box, default to 10 minutes
Sleep($minutes*60000) ; Sleep is in msecs, so multiply input in minutes by 60*1000 to have it in msecs
EndIf

; Run MSDos
Run("notepad.exe")
WinWaitActive("[CLASS:Notepad]")
Link to comment
Share on other sites

ty for help now i gonna try hope ill back with asnwers :)

niruse, maybe this helps you.

; Prompt the user to run the script - use a Yes/No prompt (4 - see help file)
$answer = MsgBox(4, "AutoIt Example (English Only)", "run backup now?")

; Check the user's answer to the prompt (see the help file for MsgBox return values)
; If "No" was clicked (7) then exit the script
If $answer = 7 Then
Local $minutes = InputBox("Postpone backup", "How many minutes to postpone the backup?", 10) ; question box, default to 10 minutes
Sleep($minutes*60000) ; Sleep is in msecs, so multiply input in minutes by 60*1000 to have it in msecs
EndIf

; Run MSDos
Run("notepad.exe")
WinWaitActive("[CLASS:Notepad]")

ty now ill learn and read it

works well :)

Edited by niruse
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...