Imacros hangs during some operations

Discussions and Tech Support related to automating the iMacros Browser or Internet Explorer from any scripting and programming language, such as VBS (WSH), VBA, VB, Perl, Delphi, C# or C++.
Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information: CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
psenatori
Posts: 4
Joined: Fri Oct 29, 2010 6:35 pm

Imacros hangs during some operations

Post by psenatori » Fri Oct 29, 2010 6:53 pm

More of an answer then a question, but I've encountered some situations where imacros scripting edition just simply hangs (process is Not Responding). I've tried escaping these through imacro error codes (i call all macros from vbscript) and other "ping imacros" type of operatons, but none consistently worked. After some research in these forums and elsewhere, here's what I came up with. Hope it helps others who encounter a hung imacros process and need a remedy. As is typically the case with a Not Responding process situation, it's very difficult for someone else to
duplicate since it can involve other processes, memory usages and I/O issues occurring on my servers. Anyway, for others, here's the function....

'================================================================================================
Function ImacrosNotResponding
'---------------------------------------------------------------------------------------------------------------------------------------
'Surprisingly, it took far long to figure this problem out given how short the code turned out to be. Pretty short and sweet,
'but all it does is check the process status of imacros and returns TRUE if the process is Not Responding
'or FALSE if the process is RUNNING (used this approach given my app needs. The function is called from locations
'where imacros has a tendency to hang
'or in convenient code locations where a process check (and possible soft-reset to a recovery url does not pose
'any application harm). I tried a number of other approaches, but couldn't really find the hung process state and still
'returned values indicated the process was live when it was actually Not Responding. By the way, I use a recovery_url
'approach quite often so I can always return the app to where it was prior to the imacros hanging.

Dim oExec
Set oExec = WScript.CreateObject("WScript.Shell").Exec("taskkill.exe /im imacros.exe /fi ""status eq not responding""")
if InStr(oExec.stdout.readall,"terminated") <> 0 then
' Not Responding
ImacrosNotResponding = True
Else
' Process Still Running
ImacrosNotResponding = False
End If
End Function
'---------------------------------------------------------------------------------------------------------------------------------------
Tom, Tech Support
Posts: 3711
Joined: Mon May 31, 2010 4:59 pm

Re: Imacros hangs during some operations

Post by Tom, Tech Support » Thu Nov 04, 2010 6:54 pm

Very clever, thanks for sharing!
Regards,

Tom, iMacros Support
Kelicula
Posts: 7
Joined: Tue Oct 07, 2014 6:17 pm

Re: Imacros hangs during some operations

Post by Kelicula » Wed Dec 24, 2014 7:05 pm

Indeed, very good, thank you!! I was having the same problem.
I did find it helpful to add the /f switch in my application however, since it wasn't responding, it didn't respond to the kill signal, however with that slight addition it works perfectly!
Eg:

Code: Select all

Set oExec = WScript.CreateObject("WScript.Shell").Exec("taskkill.exe /f /im imacros.exe /fi ""status eq not responding""")
dboone21
Posts: 1
Joined: Fri Feb 26, 2016 5:16 pm

Re: Imacros hangs during some operations

Post by dboone21 » Fri Feb 26, 2016 5:32 pm

Thanks for posting this. I have tried both versions (with and without the F switch) and can't get the object to set. (424 - Object required error.)
I'm using this in Excel VBA with iMacros 10.3.27.5830.
I have the function in a module, and the code in a different module. I'm calling the function with a simple If statement.

Code: Select all

If ImacrosNotResponding = False Then MsgBox "It's still good!"
Has anyone else tried this and had success, or are there any other ways to troubleshoot a hanging iMacros? I have code to search for a certain tag in my application that I'm hitting, and if it doesn't find the tag to close and start again, but that still passes sometimes if it's hanging as the tag is still "there".

Any help would be appreciated!
Post Reply