highend Posted January 17, 2012 Share Posted January 17, 2012 Hi, I'm trying to write a simple script that checks if a process is still running and depending on the result, it copies a string to the clipboard. The application that shall make use of this (compiled) script is XYplorer, a file manager with scripting capabilities. It has one major drawback: It isn't able to run script commands in the background that are able to wait until they are finished before it executes the next command. Executing a script normally (not backgrounded) blocks it's user interface so you have to wait until the script has finished. What would work: Using a while loop that checks if a special string (that are created by the compiled autoit script) is in the clipboard. If it detects the right one, it leaves the loop. So I'd like to let my XYplorer script execute the "run" command every second to let my autoit script do it's work, check for the given process name and write a new string to the clipboard. E.g.: $CheckProcess = "<xypath>\.Tools\CheckProcess\CheckProcess.exe"; $ProcessName = "notepad.exe"; $WaitForProcess = "-1"; while($WaitForProcess == -1){ run """$CheckProcess"" ""$ProcessName"""; $WaitForProcess = strpos("<clipboard>", "$ProcessName=false"); wait 1000; } This is the autoit script: #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_UseUpx=n #AutoIt3Wrapper_UseX64=n #AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker #AutoIt3Wrapper_Res_Icon_Add=D:\Tools\.AutoIt\App\Icons\au3.ico #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #comments-start Receive a process name as a parameter and write $ProcessName=true/false to the clipboard. Optional: Receive a process name as a parameter and write true/false to a temp file. #comments-end If $CmdLine[0] = 0 Then ;MsgBox(0, "Script error", "No process name was supplied, aborted!") $ProcessName = "" ; Set variable to empty Exit Else $ProcessName = $CmdLine[1] ; Get the name of the first (and only) parameter, the process name EndIf If ProcessExists($ProcessName) Then ClipPut($ProcessName & "=true") Else ClipPut($ProcessName & "=false") EndIf How do I have to modify my autoit script, that it doesn't pop up in the taskbar every second (which is very annoying)? Tia, Highend Link to comment Share on other sites More sharing options...
JohnOne Posted January 17, 2012 Share Posted January 17, 2012 #NoTrayIcon at top of script. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
highend Posted January 17, 2012 Author Share Posted January 17, 2012 Thank you John, works perfectly. 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