Sign in to follow this  
Followers 0
niruse

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

7 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

A double equal (==) would be used to check two strings if they are case-sensitive equal. So niruse you are correct with $answer = 7.

Language Reference - Operators


- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
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]")

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

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

Share this post


Link to post
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
Sign in to follow this  
Followers 0