Guest Posted August 14, 2011 Share Posted August 14, 2011 (edited) Hello. I tried to create this: Local $var, $start $p1 = IniRead(@WorkingDir & "\settings.ini", "proseseswait", "p1", "x.exe") $p2 = IniRead(@WorkingDir & "\settings.ini", "proseseswait", "p2", "x.exe") $p3 = IniRead(@WorkingDir & "\settings.ini", "proseseswait", "p3", "x.exe") $p4 = IniRead(@WorkingDir & "\settings.ini", "proseseswait", "p4", "x.exe") $p5 = IniRead(@WorkingDir & "\settings.ini", "proseseswait", "p5", "x.exe") $p6 = IniRead(@WorkingDir & "\settings.ini", "proseseswait", "p6", "x.exe") $p7 = IniRead(@WorkingDir & "\settings.ini", "proseseswait", "p7", "x.exe") $p8 = IniRead(@WorkingDir & "\settings.ini", "proseseswait", "p8", "x.exe") $p9 = IniRead(@WorkingDir & "\settings.ini", "proseseswait", "p9", "x.exe") $p10 = IniRead(@WorkingDir & "\settings.ini", "proseseswait", "p10", "x.exe") HotKeySet("{F7}", "test1") HotKeySet("{F8}", "test2") HotKeySet("{F9}", "test3") $SP1 = ProcessWait($p1) $SP2 = ProcessWait($p2) $SP3 = ProcessWait($p3) $begin = TimerInit() If ProcessWait($p1) Then MsgBox(4096,"", "Value is positive.") ElseIf ProcessWait($p2) Then MsgBox(4096,"", "Value is negative.") EndIf But the problem is that the script responds only to the "if" and not to "ElseIf". I need all the "if"/"ElseIf" will work .. Thanks. Edited August 14, 2011 by Guest Link to comment Share on other sites More sharing options...
JohnOne Posted August 14, 2011 Share Posted August 14, 2011 your elseif will never be true 1) you have this $SP1 = ProcessWait($p1) ; It waits for it to exist then you have this If ProcessWait($p1) Then ; This exists or your script would not get this far MsgBox(4096,"", "Value is positive.") ElseIf ProcessWait($p2) Then ;So this will never be true. MsgBox(4096,"", "Value is negative.") EndIf I think you best explain what it is you are trying to accomplish 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...
Moderators Melba23 Posted August 14, 2011 Moderators Share Posted August 14, 2011 (edited) gil900,Your code makes no sense. ProcessWait will pause the script until the specified process is running, so you will never get to your If structure until all 3 processes exist. And so there is no chance of the If failing as the process had to exist in order to get that far! Can you explain what you are trying to do? Perhaps then we can offer some advice on how to structure your code. M23Edit: Evening JohnOne - I am off to dinner, it is all yours! Edited August 14, 2011 by Melba23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
JohnOne Posted August 14, 2011 Share Posted August 14, 2011 Gee, thanks M23 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...
bogQ Posted August 14, 2011 Share Posted August 14, 2011 i think hes trying this but im not shure Do Sleep(10) Until ProcessExists($p1) Or ProcessExists($p2) Or ProcessExists($p3) Or ... and if he need aditional data he can do it like this Do Sleep(10) $1 = ProcessExists($p1) $2 = ProcessExists($p2) $3 = ProcessExists($p3) Until $1 Or $2 Or $3 Or ... Select Case $1 MsgBox(4096,"1", "Value is positive.") Case $2 MsgBox(4096,"2", "Value is positive.") Case $3 MsgBox(4096,"3", "Value is positive.") Case ... EndSelect TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost. Link to comment Share on other sites More sharing options...
Guest Posted August 14, 2011 Share Posted August 14, 2011 (edited) Part of the code: There is a INI file which has a number of processes. * I need that script will count how many seconds it takes to process (found in the INI) fully loaded. The same applied to other processes in the INI file. Ultimately need the code will write another part of the INI file the number of seconds(ms) related to any process. For example: [example] flashget.exe=5000 vlc.exe=1000 firefox.exe=10000 Edited August 14, 2011 by Guest Link to comment Share on other sites More sharing options...
JohnOne Posted August 14, 2011 Share Posted August 14, 2011 Not tested this, but in my head it would look similar to this. $aSection = IniReadSection("my.ini","example") If @error Then Exit For $i = 1 To $aSection[0][0];process name $Timer = TimerInit();set timer $Pid = Run($aSection[$i][0]);run process ProcessWait($Pid);wait for process $Timerdiff = TimerDiff($Timer);Get time IniWrite("my.ini","example",$aSection[$i][1],$Timerdiff);write time to ini ProcessClose($Pid);close process Next 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...
Guest Posted August 14, 2011 Share Posted August 14, 2011 (edited) Thank you. I changed to this: $aSection = IniReadSection("settings.ini","proseseswait") If @error Then Exit For $i = 1 To $aSection[0][0];process name $Timer = TimerInit();set timer $Pid = IniRead("settings.ini", "proseseswait", $aSection[$i][0], "x.exe") ProcessWait($Pid);wait for process $Timerdiff = TimerDiff($Timer);Get time IniWrite("my.ini","example",$aSection[$i][1],$Timerdiff);write time to ini Next It's going to be part of something Edited August 14, 2011 by Guest 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