afallenhope Posted August 4, 2016 Posted August 4, 2016 Hello all, First let me explain my setup just so there is a better understanding of what I'm achieving. Through the use of Autoit, Javascript, and VBScript I have set up a virtual machine hosted on a server to download another virtual and download and install an application that is updated almost nightly. Then once the program has been installed the virtual machine shuts down and closes VMware workstation. I then have windows task scheduler to launch some batch files to upload the virtual to a NAS on our network at 8:00 AM. The problem I am running into is that I occasionally go on to check and see how it is doing I will find an Autoit script still hanging in the background for whatever reason. I have been looking for a script that would at a certain time go and cancel out all running scripts. This is what I have thought of but I am unsure of exactly how to implement it. Any help would be greatly appreciated! #include <Date.au3> ;I was thinking of using FileGetTime and then doing an if statement (I am paraphrasing this code as I am unsure how to write it). If FileGetTime(time is past 10:00 AM) then checkfor("Test.au3") If ProcessExists("Test.au3") then WinClose("Test.au3") EndIf ;I am unsure of doing nesting if statements. Is that how I would do something like that? Thanks, Richard
Moderators JLogan3o13 Posted August 4, 2016 Moderators Posted August 4, 2016 @afallenhope It sounds, based on your mix of languages, that you have some coding ability. Would it not make more sense to you to work on determining why the script is hanging, rather than just killing it? "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
afallenhope Posted August 5, 2016 Author Posted August 5, 2016 @JLogan3o13 Ithought it would have been easier to just kill all files running but that wouldn't be right and neither would it be good coding practice. I found the error as to why it was still running. When you copy a Virtual Machine to a local machine and start it, VMware will pop up a dialog window asking if this was moved or copied over. The typical response is copy so I told the autoit file to wait till the window is detected then activate it and to then send a "!p". I guess after copying the same virtual so many times it stops asking and my script was waiting for that window. My fix was a Function If--Then--Else statement. Thanks for nudging me in the right direction Logan
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