pierk Posted May 10, 2011 Share Posted May 10, 2011 Good afternoon, This will be my first post on this forum. Im currently busy to have some scripts moved to my new server. All scripts are launched via a scheduled task and are a mixture of AutoIT / Kix and VB. The program was originally created this way.... All scripts are located in one single folder. I've created a security group that has full control on the folder. My functional account is member of that security group. I've created a batchfile called accounting.bat which is scheduled via the task scheduler to run each 5 minutes. Within this batchfile I'm calling E:\AutoIt\CopyAuto accounting.au3 In accounting.au3 I do the following: WriteLog("Sending account information") RunWait("C:\Windows\System32\cmd.exe") The problem is that RunWait does not seem to work. The WriteLog("Sending account information") does work and puts his output in one of my logfiles. If I check the tasks scheduler, the jobs keeps running and is never ending. No issues are listed in the scheduled task log. To make sure my test is valid I've added another WriteLog() below the RunWait() and no output is generated from that last WriteLog(). Example: WriteLog("Sending account information") RunWait("C:\Windows\System32\cmd.exe") WriteLog("Test") So "Test" does not appear in my logfile. I have a hard time trying to have this debugged. I allready granted my account full control on C:\Windows\System32\cmd.exe. It does not seem to matter what command I run from the RunWait() function, it just does not seem to work. Originally it's calling a kix32.exe with a filename as parameter. Maybe the setup seems to be a bit lame however is does work on my old system. Any ideas are welcome, have been struggeling for days now. Regards, Pierk Link to comment Share on other sites More sharing options...
dufran3 Posted May 10, 2011 Share Posted May 10, 2011 (edited) The last WriteLog line will not run until the cmd window is closed. That is how RunWait works, it runs something, waiting until it is finished/closed, then continues the script. Also, from help file: To run DOS commands, try RunWait(@ComSpec & " /c " & "commandName") ; don't forget " " before "/c" Edited May 10, 2011 by dufran3 Link to comment Share on other sites More sharing options...
pierk Posted May 10, 2011 Author Share Posted May 10, 2011 Dufran3, You're indeed right that the last WriteLog line won't run until the cmd window is closed. I believe I've given a bad example here sorry for that, tried to simplify my code a bit.... Like I mentioned what it actually does is calling a kix32.exe with accounting.kix as parameter. Could have a syntax error below as I don't have access to my system from here so it's out of my head... WriteLog("Sending account information") RunWait("C:\Kix\kix32.exe" "C:\Files\accounting.kix") WriteLog("Test") The strange part is, when I'm logged in using my functional account, the script runs without any problems and I see "Test" in my logfile. When I log out and run the batch file, the script keeps running and never stops. I have setup to run my batch file using my functional account credentials. I'm not 100% sure if it's totally related to AutoIt, some parts like the writelog function works fine but when I try to call an executable in this case kix32.exe the issue occurs. Now kix32.exe could have been any application so please don't tell me to move to a kix forum :-D I would be gratefull for any advise. Regards, Pierk Link to comment Share on other sites More sharing options...
dufran3 Posted May 10, 2011 Share Posted May 10, 2011 Now kix32.exe could have been any application so please don't tell me to move to a kix forum :-Dlol, I won't.Did you try the RunWait example I gave you in my last post? Using Comspec? that may help. Link to comment Share on other sites More sharing options...
pierk Posted May 10, 2011 Author Share Posted May 10, 2011 Do you mean calling kix32.exe with its parameter using Comspec? That will be something like: //will check if the syntax is correct. RunWait(@ComSpec & " /c " & "c:\kix\kix32.exe accounting.kix") I'll check tommorow and let you know my finding. Thanks a lot so far. Cheers, Pierk Link to comment Share on other sites More sharing options...
dufran3 Posted May 10, 2011 Share Posted May 10, 2011 no problem. Let me know how it goes 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