Diana (Cda) Posted August 15, 2007 Share Posted August 15, 2007 I have this complicated code put together thanks to great help from the group. However, despite having a much, much better time of it with message boxes thanks to the newly discovered CodeWizard in SciTE, I can't seem to fix this one. Even when one presses "NO", the macro proceeds to the next part and I'm not having luck placing the code in the right spot so that it executes only when the user presses "OK". Here it is:expandcollapse popup; ; AutoIt v3.0 ; AutoItSetOption("WinTitleMatchMode", 2) ; this allows partial window titles to be valid! #NoTrayIcon ; hides the AI systray icon; useful since this may snooze for some time. SoundPlay(@ScriptDir & "\WAV-PUAC- BREAK- glass breaking (m).wav") Sleep(2000) SoundPlay(@ScriptDir & "\WAV-PUAC- NEWYEAR21_SS01.WAV") Sleep(500) ;----- CODE BELOW ALLOWS USER TO DELAY SCRIPT (I.E., "SNOOZE"); REQUIRES USER INPUT --------------- (msgbox + inputbox) While 1 $value = MsgBox(4, "Reminder: ''Time Worked Calculator ...'' app.", "Would you like to delay launching this ''Time Worked Calculator'' app?" & @CR & @CR & "(Clicking ''No'' opens the file immediately.)") If $value = 6 Then $input = InputBox("''Time Worked Calculator'' reminder ...", "Snooze for how many minutes?", 15) $time = $input*1000*60 Sleep($time) Else ExitLoop EndIf WEnd ;-------------------------------------------------------------------------------------------------- ; "backup" CFG file $file = "E:\APPS\TIMER-WORK\Time Worked Calculator\APP- Time Worked Calculator\twc.cfg" $fileDir = Stringleft($file, StringInStr($file, "\", 0, -1) - 1) ; ALL up to (but not including) the last backslash $fileName = StringRight($file, StringLen($file) - StringInStr($file, "\", 0, -1)) ; what's left after last backslash $file2 = $fileDir & "\" & "zBKP- " & $fileName & " - " & @YEAR & "." & @MON & "." & @MDAY & ", " & @HOUR & "h" & @MIN & "m" & @SEC & "s" & ".cfg" FileCopy($file, $file2) ; "backup" SES file $file3 = "E:\APPS\TIMER-WORK\Time Worked Calculator\APP- Time Worked Calculator\twc.ses" $fileDir2 = Stringleft($file3, StringInStr($file3, "\", 0, -1) - 1) ; ALL up to (but not including) the last backslash $fileName2 = StringRight($file3, StringLen($file3) - StringInStr($file3, "\", 0, -1)) ; what's left after last backslash $file4 = $fileDir2 & "\" & "zBKP- " & $fileName2 & " - " & @YEAR & "." & @MON & "." & @MDAY & ", " & @HOUR & "h" & @MIN & "m" & @SEC & "s" & ".ses" FileCopy($file3, $file4) Sleep(1500) SoundPlay (@ScriptDir & "\WAV- Item(s) OPEN- SF025_OP01.WAV") Run('explorer.exe /n,"E:\APPS\TIMER-WORK\Time Worked Calculator\APP- Time Worked Calculator"') Sleep(100) WinWait("APP- Time") WinSetState ("APP- Time", "", @SW_MAXIMIZE) WinWait("APP- Time") WinSetState ("APP- Time", "", @SW_MAXIMIZE) Exit ; finishedAnyone know how to fix this one? Thanks much! Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted August 15, 2007 Share Posted August 15, 2007 Because your doing exitloop not just exit. Link to comment Share on other sites More sharing options...
Diana (Cda) Posted August 15, 2007 Author Share Posted August 15, 2007 Because your doing exitloop not just exit.Dang! Something so small. This was a kindly supplied piece of code so I wasn't yet familiar with it. Thanks! I learned that I need to look for this now if this type of behaviour ever happens again. <g> p.s., I tried adding a sound file reference but no sound is played. The path is correct, the WAV is in the same directory and name is correct, and the WAV plays fine by itself. I've tried putting it before and after the new "Exit" line. [snip] ;----- CODE BELOW ALLOWS USER TO DELAY SCRIPT (I.E., "SNOOZE"); REQUIRES USER INPUT --------------- (msgbox + inputbox) While 1 $value = MsgBox(4, "Reminder: ''Time Worked Calculator ...'' app.", "Would you like to delay launching this ''Time Worked Calculator'' app?" & @CR & @CR & "(Clicking ''No'' opens the file immediately.)") If $value = 6 Then $input = InputBox("''Time Worked Calculator'' reminder ...", "Snooze for how many minutes?", 15) $time = $input*1000*60 Sleep($time) Else SoundPlay (@ScriptDir & "\WAV- Buzzer 01a (shorter).wav") Exit EndIf WEnd ;-------------------------------------------------------------------------------------------------- [snip]What am I doing wrong, pls? Thanks! Link to comment Share on other sites More sharing options...
mikehunt114 Posted August 16, 2007 Share Posted August 16, 2007 SoundPlay (@ScriptDir & "\WAV- Buzzer 01a (shorter).wav", 1) Use the optional "wait" paramter...give your .wav a chance to play before you exit. IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font] Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now