Ok, so I'm working on a script to automate a task for my organization, something I've done many times. While writing the script I press "f5" to run and test. All is working well unless I "build/compile" the script into an executable. When I run the executable version the script stops after the copying process. Any help or suggestions?
[ autoit ]
#include #include #include #include #include #include #include #include $drive = "" $cursor = mousegetcursor() while $drive = "" $drive = FileSelectFolder("select drive","") $drive2 = stringleft($drive,2) if $drive = "" Then msgbox(0,"Error", "no drive selected") EndIf WEnd $pid = run(@comspec & " /c" & 'format ' & $drive2 & ' /v:BaseDrive /Q /X /FS:NTFS',"",@sw_maximize) sleep(500) send("{enter}") while processexists($pid) WEnd ;~ msgbox(0,"test",@scriptdir) ;~ runwait("xcopy '" &@scriptdir & "\root files\*.*' /z /y /e /d " & $drive) ;~ filecopy(@scriptdir & "\root files\*.*",$drive) _filecopy(@scriptdir & "\root files\*.*",$drive) ;~ 4 Do not display a progress dialog box. ;~ 8 Give the file being operated on a new name in a move, copy, or rename operation if a file with the target name already exists. ;~ 16 Respond with "Yes to All" for any dialog box that is displayed. ;~ 64 Preserve undo information, if possible. ;~ 128 Perform the operation on files only if a wildcard file name (*.*) is specified. ;~ 256 Display a progress dialog box but do not show the file names. ;~ 512 Do not confirm the creation of a new directory if the operation requires one to be created. ;~ 1024 Do not display a user interface if an error occurs. ;~ 2048 Version 4.71. Do not copy the security attributes of the file. ;~ 4096 Only operate in the local directory. Don't operate recursively into subdirectories. ;~ 9182 Version 5.0. Do not copy connected files as a group. Only copy the specified files. Func _fileCopy($fromFile,$tofile) Local $FOF_RESPOND_YES = 16 Local $FOF_SIMPLEPROGRESS = 256 $winShell = ObjCreate("shell.application") $winShell.namespace($tofile).CopyHere($fromFile,$FOF_RESPOND_YES) EndFunc dircreate($drive & "TrueCrypt") sleep(1000) _filecopy2(@scriptdir & "\truecrypt\*.*",$drive & "TrueCrypt\") Func _FileCopy2($fromFile2,$tofile2) Local $FOF_RESPOND_YES = 16 Local $FOF_SIMPLEPROGRESS = 256 $winShell = ObjCreate("shell.application") $winShell.namespace($tofile2).CopyHere($fromFile2,$FOF_RESPOND_YES) EndFunc Sleep(1000) Run($drive2 & "\TrueCrypt\TrueCrypt Format.exe", "",@SW_SHOW) winactivate("TrueCrypt","Select &File...") winwaitactive("TrueCrypt","Select &File...") SEND("!c") winactivate("TrueCrypt Volume Creation Wizard") WinWaitActive("TrueCrypt Volume Creation Wizard") send("!n") send("!n") WinWaitActive("TrueCrypt Volume Creation Wizard","Volume Location") $cursor = mousegetcursor() opt("mousecoordmode",0) $posarray = wingetpos("TrueCrypt Volume Creation Wizard","Volume Location") $xcenter = ($posarray[2]/2) $ycenter = ($posarray[3]/2) mousemove($xcenter,$ycenter) while $cursor <> 5 $cursor = mousegetcursor() ;~ sleep(1000) mousemove($xcenter,$ycenter,1) $ycenter -= 10 WEnd mouseclick("left") ;~ send("{esc}") send($drive & "Truecrypt\truecryptvolume") send("!n") send("!n") winwaitactive("TrueCrypt Volume Creation Wizard","Encryption Options") send("!n") send("!m") send("+{tab}") $space = Round(DriveSpaceFree($drive) -16) send($space) send("!n") send("password") send("{tab}") send("password") send("!n") winwaitactive("TrueCrypt Volume Creation Wizard","WARNING:",1) send("!y") $var = 0 while $var < 10 opt("mousecoordmode",0) $posarray = wingetpos("TrueCrypt Volume Creation Wizard","Volume Format") $xcenter = ($posarray[2]/2) $ycenter = ($posarray[3]/2) mousemove($xcenter,$ycenter) if $var < 10 Then mousemove($xcenter,$ycenter-100) $var += 1 EndIf WEnd ;~ sleep(5000) winactivate("TrueCrypt Volume Creation Wizard","Volume Format") send("!f") winwaitactive("TrueCrypt Volume Creation Wizard","The TrueCrypt volume has been successfully created.") send("{enter}") winactivate("TrueCrypt Volume Creation Wizard","Volume Created") send("!{f4}") sleep(1000) winactivate("TrueCrypt","Select &File...") winwaitactive("TrueCrypt","Select &File...") send("!x") filedelete($drive & "\auto encrypt.exe") filedelete($drive & "\encrypt_drive.bat") FileSetAttrib($drive & "\autorun.inf","+sh") filesetattrib($drive & "\truecrypt","+sh")