LMTA Posted December 9, 2009 Share Posted December 9, 2009 (edited) Hello AutoIT guru's,Here is a little puzzle that I cannot solve for the moment, maybe someone is willing to puzzle with me? We have an executable which we use to import files. This application is not visible, so to know if it is finished people have to start the taskmanager to see when it stops running. I thought I could make an easy AuotIT script, which will launch the application, wait until it is finished and provide feedback to the user. What I came up with so far, is the following:$Import = Run("C:\Appdir\Application.exe", "C:\Appdir") SplashTextOn ( "Importing", "Files are being imported, this will take some time." & @CRLF & "One moment please...", 285, 95, -1, -1, 20, "", 8, -1) $Proces = ProcessWaitClose ($Import) If @error = 1 Then SplashOff () MsgBox(262160, "Importing", "Error:" & @CRLF & "The process did not start properly!" & @CRLF & "Please try to re-run this script.") Else SplashOff () MsgBox(262208, "Importing", "The file import finished.") EndIf ExitHowever, the external program is not started. If I replace the executable with e.g. 'Calc.exe' and rename this to 'Application.exe', the script runs fine: Calc is started, the Splash is shown with the message that files are being imported and when I manually close Calc the MsgBox is show that the file import finished. When I remove the 'Application.exe' I see the MsgBox that the process did not start properly. When I switch back to the apllication.exe which it should be, the process does not start at all, it does not show up in the tasklist. When I fire the application.exe manually, it works as it should. I tried to replace the Run command with ShellExecute, but that does not help. Does someone has an idea what to try next? Thanks in forward for your suggestions and with regards,Steve. Edited December 9, 2009 by LMTA Link to comment Share on other sites More sharing options...
omikron48 Posted December 9, 2009 Share Posted December 9, 2009 (edited) You know you can always just make a batch script: C:\Appdir\Application.exe @echo Process finished! pause Then just wait for "Press any key to continue... to appear". Edited December 9, 2009 by omikron48 Link to comment Share on other sites More sharing options...
LMTA Posted December 9, 2009 Author Share Posted December 9, 2009 That is an option I thought about, thanks for the suggestion!If I do not succeed with AutoIt I think that will become the workaround...I do prefer to use AutoIt if possible, however. Link to comment Share on other sites More sharing options...
99ojo Posted December 9, 2009 Share Posted December 9, 2009 (edited) Hi, try this: SplashTextOn ( "Importing", "Files are being imported, this will take some time." & @CRLF & "One moment please...", 285, 95, -1, -1, 20, "", 8, -1) RunWait (@ComSpec & " /c C:\Appdir\Application.exe", "C:\Appdir", @SW_HIDE) ;$Import = Run(@ComSpec & " /c C:\Appdir\Application.exe", "C:\Appdir") ;$Proces = ProcessWaitClose ($Import) If @error = 1 Then SplashOff () MsgBox(262160, "Importing", "Error:" & @CRLF & "The process did not start properly!" & @CRLF & "Please try to re-run this script.") Else SplashOff () MsgBox(262208, "Importing", "The file import finished.") EndIf Exit ;-)) Stefan P.S: Try also Function _RunDos, see helpfile... Edited December 9, 2009 by 99ojo Link to comment Share on other sites More sharing options...
LMTA Posted December 9, 2009 Author Share Posted December 9, 2009 (edited) Thanks again for your suggestion.I have been trying it out, but the result is the same so far. I will read about the _RunDOS function to see if this could help and report the progress here. Edited December 9, 2009 by LMTA Link to comment Share on other sites More sharing options...
99ojo Posted December 9, 2009 Share Posted December 9, 2009 Hi, just a guess. If you have Vista or above running try #RequireAdmin in your script. ;-)) Stefan Link to comment Share on other sites More sharing options...
LMTA Posted December 9, 2009 Author Share Posted December 9, 2009 (edited) Hi there,Status update: solved.Thanks Stefan for your input about this; After all, the problem was not realted to the script itself: The date/time format for the user profile was not set the way is should have been, which caused the application.exe not being able to start properly.The software is running on a Windows 2003 server, so the RequireAdmin statement was not needed in this case. Thanks for the insight and thanks for all help! Edited December 9, 2009 by LMTA 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