I have a loop in a script that I'm working on, where I want to wait until a file is done being saved (basically til the save progress bar is completely full and this box dissapears) before moving on to the next step, which is showing a Msgbox. But for some reason, the Msgbox keeps showing up instantly and blocking the save progress bar.
I tried using this code
Loop
{
FileMove, X:\CEDR\Sound\HydraReels\Flash\%OutputVar%, X:\CEDR\Sound\HydraReels\Flash\%OutputVar%, 1 ; renames the file to the same file name
If ErrorLevel ; if ErrorLevel = 0 the file write is complete
break
}
Msgbox, 1, Done?,press "Enter" or`rclick "OK" to continue.
KeyWait, Enter, D
I read somewhere on the forums that this code is supposed to try to rename the file(which shouldn't be possible if it's still saving), and continue the loop trying until it can.
Why is the next step in my script (the Msgbox), happening before it has finished? Am I missing something?
;This is a script to help speed up the Flash conversion process ;All wav files should be loaded into the Adobe Flash library before running it ;Save Flash Document and enter Game Name ^!q:: InputBox, OutputVar, Sound Assets, `r Enter Game Name:`r`r (ie. JackpotParty)`r`r"SoundAssets" will automatically be added to title ;KeyWait, Enter, D FileCreateDir, X:\CEDR\Sound\HydraReels\Flash\%OutputVar% Sleep, 300 Run, "X:\CEDR\Sound\HydraReels\Flash\%OutputVar%" Sleep, 1000 SendInput {Alt down} Sleep, 100 SendInput {TAB} Sleep, 100 SendInput {Alt up} Sleep, 300 SendInput ^+s Sleep, 500 SendInput %OutputVar%SoundAssets Sleep, 300 SendInput !d Sleep, 100 SendInput X:\CEDR\Sound\HydraReels\Flash\%OutputVar% {Enter} Sleep, 500 SendInput !s Loop { FileMove, X:\CEDR\Sound\HydraReels\Flash\%OutputVar%, X:\CEDR\Sound\HydraReels\Flash\%OutputVar%, 1 ; renames the file to the same file name If ErrorLevel ; if ErrorLevel = 0 the file write is complete break } Msgbox, 1, Done?,press "Enter" or`rclick "OK" to continue. KeyWait, Enter, D ;Rename Library SendInput ^m Sleep, 300 SendInput NEWrenameLibrary.jsfl !d SendInput C:\Users\cpieper\Desktop\My Files\Misc {Enter} Sleep, 300 ;KeyWait, Enter, D SendInput !o SendInput {Enter} Sleep, 300 ;Create Sound Objects from Library SendInput ^m Sleep, 300 SendInput createSoundObjects.jsfl {Enter} ;KeyWait, Enter, D Sleep, 300 ;Copy Code from Flash's output tab MouseMove,1424,889,0 MouseClick SendInput ^c ;Create a new Class, Name, and paste code into Flash Script and save MouseMove,1521,51 MouseClick MouseMove,1864,271 MouseClick SendInput %OutputVar%SoundAssets Sleep, 300 ;KeyWait, Enter, D SendInput {Enter} SendInput {Down}{Down}{Down}{Tab}import flash.media.Sound;{Down}{Down}{Down}{Down}^v ^+s Sleep, 500 ;KeyWait, Enter, D SendInput {Enter} ;Publish the SWF SendInput !w 1 Sleep, 100 SendInput ^+{F12} Sleep, 300 SendInput !f %OutputVar%SoundAssets Sleep, 300 SendInput !p Msgbox, 1, Publish SWF,Was SWF successfully created?`rThen click "OK" or press "Enter" ;KeyWait, Esc, D SendInput {Esc} ;Generate Flash sound code and save to Notepad doc SendInput ^m Sleep, 300 SendInput FlashSoundCode.jsfl Sleep, 300 SendInput !d Sleep, 100 SendInput C:\Users\cpieper\Desktop\My Files\Misc {Enter} SendInput !o SendInput {Enter} Sleep, 300 MouseMove,1424,889,0 MouseClick SendInput ^c Run, Notepad.exe Sleep, 500 SendInput ^v Sleep, 300 SendInput ^s Sleep, 300 SendInput %OutputVar%SoundAssets Sleep, 300 SendInput !d Sleep, 300 SendInput X:\CEDR\Sound\HydraReels\Flash\%OutputVar% {Enter} Sleep, 300 SendInput !s Sleep, 300 SendInput !{F4} Sleep, 300 ;Generate Unity sound code and save to Notepad doc SendInput ^m Sleep, 300 SendInput UnitySoundCode.jsfl Sleep, 300 SendInput !d Sleep, 100 SendInput C:\Users\cpieper\Desktop\My Files\Misc {Enter} SendInput !o SendInput {Enter} Sleep, 300 MouseMove,1424,889,0 MouseClick SendInput ^c Run, Notepad.exe Sleep, 500 SendInput ^v Sleep, 300 SendInput ^s Sleep, 300 SendInput %OutputVar%UnitySoundAssets Sleep, 300 SendInput !d Sleep, 300 SendInput X:\CEDR\Sound\HydraReels\Flash\%OutputVar% {Enter} Sleep, 300 SendInput !s Sleep, 300 SendInput !{F4} Sleep, 300 ;Save Flash document SendInput ^s ;Close Flash and Delete unused Action Script file Msgbox, 1, YOU'RE FINISHED!!!!!, After the Flash Doc is done saving`rClick "OK" or press "Enter" SendInput !{F4} FileDelete, X:\CEDR\Sound\HydraReels\Flash\%OutputVar%\%OutputVar%SoundAssets.as return