orbs Posted July 5, 2013 Share Posted July 5, 2013 I have everything else setup correctly(or at least Im happy with) It is finding the capture point that I want instead of using the unhandled_exceptions.exe all the time maybe it's my English, but i just can't get your intention. what do you mean by "finding the capture point" ? Signature - my forum contributions: Spoiler UDF: LFN - support for long file names (over 260 characters) InputImpose - impose valid characters in an input control TimeConvert - convert UTC to/from local time and/or reformat the string representation AMF - accept multiple files from Windows Explorer context menu DateDuration - literal description of the difference between given dates Apps: Touch - set the "modified" timestamp of a file to current time Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes SPDiff - Single-Pane Text Diff Link to comment Share on other sites More sharing options...
olo Posted July 5, 2013 Author Share Posted July 5, 2013 maybe it's my English, but i just can't get your intention. what do you mean by "finding the capture point" ? I run a program. during the programs running I get an error The error is "abnormal termination occurred" I dont see this error Where do I go to find this error Link to comment Share on other sites More sharing options...
orbs Posted July 5, 2013 Share Posted July 5, 2013 (edited) I run a program. do you mean that your script is running the program (as in the example script your provided), or do you mean any program being run by the user or by other processes? Edited July 5, 2013 by orbs Signature - my forum contributions: Spoiler UDF: LFN - support for long file names (over 260 characters) InputImpose - impose valid characters in an input control TimeConvert - convert UTC to/from local time and/or reformat the string representation AMF - accept multiple files from Windows Explorer context menu DateDuration - literal description of the difference between given dates Apps: Touch - set the "modified" timestamp of a file to current time Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes SPDiff - Single-Pane Text Diff Link to comment Share on other sites More sharing options...
olo Posted July 5, 2013 Author Share Posted July 5, 2013 do you mean that your script is running the program (as in the example script your provided), or do you mean any program being run by the user or by other processes? A different script will run the program. The purpose of this script is that it will be called in the other one(program one) to check for errors at certain points. Link to comment Share on other sites More sharing options...
trancexx Posted July 5, 2013 Share Posted July 5, 2013 Use RunWait() then. If you find it inadequate for whatever reason use wraithdu's code from >here (that's link, click it). In that case it could be: $aProc = _Parallel_CreateProcess("unhandled_exception.exe", "", @SW_SHOW, 0) If @error Then ConsoleWrite("+>Check your input. You've got something wrong!" & @CRLF) Else While 1 $iCheck = _ProcessExistsByHandle($aProc[1]) If $iCheck = 0 Then ExitLoop Sleep(100) WEnd ConsoleWrite("!Proccess exit code = " & @extended & @CRLF) EndIf ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
orbs Posted July 5, 2013 Share Posted July 5, 2013 do you mean your process is something like this: 1) script1 is calling program 2) script1 is calling script2 3) script2 is checking the exit code of program script1 you already have program is anything you may need to check script2 you are trying to build is this the case? olo 1 Signature - my forum contributions: Spoiler UDF: LFN - support for long file names (over 260 characters) InputImpose - impose valid characters in an input control TimeConvert - convert UTC to/from local time and/or reformat the string representation AMF - accept multiple files from Windows Explorer context menu DateDuration - literal description of the difference between given dates Apps: Touch - set the "modified" timestamp of a file to current time Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes SPDiff - Single-Pane Text Diff Link to comment Share on other sites More sharing options...
olo Posted July 5, 2013 Author Share Posted July 5, 2013 do you mean your process is something like this: 1) script1 is calling program 2) script1 is calling script2 3) script2 is checking the exit code of program script1 you already have program is anything you may need to check script2 you are trying to build is this the case? Yea man Link to comment Share on other sites More sharing options...
orbs Posted July 5, 2013 Share Posted July 5, 2013 i'm beginning to understand how a chief inquisitor would feel... could you not have said so in the beginning...? anyway, how about expanding the process: 1) script1, who is calling program, knows the program PID. 2) script1 calls script2, passing to it the PID as a command line parameter 3) script2 immediately queries the PID to get the process handle (hopefully, program has not immediately terminated upon launch). 4) on regular intervals (maybe very small), script2 checks the process handle. if program terminated, that would return the exit code. 5) if program indeed terminated, script2 reports the exit code to you. for steps 3 & 4 , script2 use this function: Func _ProcessExitCode($i_Pid, $h_Process_input = 0) ; 0 = Return Process Handle of PID else use Handle to Return Exitcode of a PID Local $v_Placeholder If $h_Process_input=0 Then ; Return the process handle of a PID - this is for the initial check $h_Process = DllCall('kernel32.dll', 'ptr', 'OpenProcess', 'int', 0x400, 'int', 0, 'int', $i_Pid) If Not @error Then Return $h_Process[0] Else ; Return Process Exitcode of PID - this is for ending check $h_Process = DllCall('kernel32.dll', 'ptr', 'GetExitCodeProcess', 'ptr', $h_Process_input, 'int*', $v_Placeholder) If Not @error Then Return $h_Process[2] EndIf Return 0 EndFunc ;==>_ProcessExitCode call it only with the PID to get the handle (step 3, one time only), then call it with the PID and the handle on regular intervals (step 4). Signature - my forum contributions: Spoiler UDF: LFN - support for long file names (over 260 characters) InputImpose - impose valid characters in an input control TimeConvert - convert UTC to/from local time and/or reformat the string representation AMF - accept multiple files from Windows Explorer context menu DateDuration - literal description of the difference between given dates Apps: Touch - set the "modified" timestamp of a file to current time Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes SPDiff - Single-Pane Text Diff Link to comment Share on other sites More sharing options...
olo Posted July 5, 2013 Author Share Posted July 5, 2013 i'm beginning to understand how a chief inquisitor would feel... could you not have said so in the beginning...? anyway, how about expanding the process: 1) script1, who is calling program, knows the program PID. 2) script1 calls script2, passing to it the PID as a command line parameter 3) script2 immediately queries the PID to get the process handle (hopefully, program has not immediately terminated upon launch). 4) on regular intervals (maybe very small), script2 checks the process handle. if program terminated, that would return the exit code. 5) if program indeed terminated, script2 reports the exit code to you. for steps 3 & 4 , script2 use this function: Func _ProcessExitCode($i_Pid, $h_Process_input = 0) ; 0 = Return Process Handle of PID else use Handle to Return Exitcode of a PID Local $v_Placeholder If $h_Process_input=0 Then ; Return the process handle of a PID - this is for the initial check $h_Process = DllCall('kernel32.dll', 'ptr', 'OpenProcess', 'int', 0x400, 'int', 0, 'int', $i_Pid) If Not @error Then Return $h_Process[0] Else ; Return Process Exitcode of PID - this is for ending check $h_Process = DllCall('kernel32.dll', 'ptr', 'GetExitCodeProcess', 'ptr', $h_Process_input, 'int*', $v_Placeholder) If Not @error Then Return $h_Process[2] EndIf Return 0 EndFunc ;==>_ProcessExitCode call it only with the PID to get the handle (step 3, one time only), then call it with the PID and the handle on regular intervals (step 4). maybe its my english 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