IE Plugin Loop

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++.

Moderators: Community Moderators, iMacros Moderators

Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the Google search box (at the top of each forum page) to see if a similar problem or question has already been addressed. This will search the entire contents of the forums as well as the iMacros Wiki.
3. We can respond much faster to your posts if you include the following information:

CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST

Answering your own posts (e.g. attempting to "bump" your topic) drops your topic from the list of unanswered threads, so it may actually receive less views.

IE Plugin Loop

by Dave Preston on Sat Nov 21, 2015 8:53 am

Hi,

I have the free version i.e. plugin for IE. I have written myself a batch file that starts iMacros.Sidebar.exe and runs a macro that logs in to a site and selects a few options. The batch file then calls the same macro and logs in as a different user, so I have 2 IE sessions running the same site logged in as different users.
This all works perfectly BUT the site occasionally gets logged out, I don't know how and this is nothing to do with iMacros. I have worked out that I can search for a tag on the login page with :FAIL_IF_FOUND to exit the macro, which passes control back to the batch file - all great.

What I really want is a loop to check the tag every 5 minutes so that when it exits I can restart the process. I know this isn't supported in the macros and understand why, so I thought I could run a second macro from a loop in the batch file but if I run iMacros.Sidebar.exe it starts a new IE session.

Any ideas?

At the moment I have copied and pasted the WAIT and search lines hundreds of times and it works but it's not very elegant.

I know I can do it with the full versions with various scripting languages but this is for a charity so we don't really want to buy it if we don't need to.

Many thanks in anticipation

Dave
Windows 10 Home 64 bit English, Internet Explorer 11.0.10240.16590, iMacros 11 Free Version plug in 11.0.246.4051.
Dave Preston
 
Posts: 11
Joined: Sat Nov 21, 2015 8:36 am

Re: IE Plugin Loop

by chivracq on Sat Nov 21, 2015 10:37 am

Dave Preston wrote:Hi,

I have the free version i.e. plugin for IE. I have written myself a batch file that starts iMacros.Sidebar.exe and runs a macro that logs in to a site and selects a few options. The batch file then calls the same macro and logs in as a different user, so I have 2 IE sessions running the same site logged in as different users.
This all works perfectly BUT the site occasionally gets logged out, I don't know how and this is nothing to do with iMacros. I have worked out that I can search for a tag on the login page with :FAIL_IF_FOUND to exit the macro, which passes control back to the batch file - all great.

What I really want is a loop to check the tag every 5 minutes so that when it exits I can restart the process. I know this isn't supported in the macros and understand why, so I thought I could run a second macro from a loop in the batch file but if I run iMacros.Sidebar.exe it starts a new IE session.

Any ideas?

At the moment I have copied and pasted the WAIT and search lines hundreds of times and it works but it's not very elegant.

I know I can do it with the full versions with various scripting languages but this is for a charity so we don't really want to buy it if we don't need to.

Many thanks in anticipation

Dave

FCIM...! :mrgreen: Always mention your FCI when you open a Thread...

Interesting Question/Scenario... I can think of several Options...:

1- Using iMacros for FF, you could easily achieve what you want using a main .js Script that would control the Loop on the Check and conditionally re-logs you in and launch your .iim Macro.

2- In pure .iim, simply put the WAIT Section in some separate Macro (that I call 'Check_Connection.iim') which will call itself indefinitely using:
Code: Select all
URL GOTO=imacros://run/?m=Check_Connection.iim

And you use the same Statement to call that Macro at the end of your main .iim Macro.

Alternatively, you can use a Negative Value for '!LOOP' in 'Check_Connection.iim' (and it doesn't need to call itself) to loop it a definite number of times:
Code: Select all
SET !LOOP -998
will run your Macro 1000 times.

And using 'EVAL()', you can compute the "Check_Connection.iim" String or some "Connect_again.iim" String to conditionally launch the desired Macro (based on the HTML Element you extract) with stg like:
Code: Select all
SET Check_Connection Check_Connection.iim
SET Connect_again Connect_again.iim
SET Check_or_Relog EVAL("var s='{{!EXTRACT}}'; var cc='{{Check_Connection}}'; var ca='{{Connect_again}}'; var x; if(s!='#EANF#'){x=cc;} else {x=ca;}; x;")
URL GOTO=imacros://run/?m={{Check_or_Relog}}
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
chivracq
 
Posts: 6490
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: IE Plugin Loop

by Dave Preston on Sat Nov 21, 2015 2:31 pm

Hi chivracq,

Windows 10 Home 64 bit, Internet Explorer 11.0.10240.16590, iMacros 11 plug in.

I believe all of your suggestions require a paid version to use a script language and the executable iMacros.Sidebar.exe can only run 1 macro in a browser session as far as I can deduce?

Dave
Windows 10 Home 64 bit English, Internet Explorer 11.0.10240.16590, iMacros 11 Free Version plug in 11.0.246.4051.
Dave Preston
 
Posts: 11
Joined: Sat Nov 21, 2015 8:36 am

Re: IE Plugin Loop

by chivracq on Sat Nov 21, 2015 6:00 pm

Dave Preston wrote:
Code: Select all
Windows 10 Home 64 bit, Internet Explorer 11.0.10240.16590, iMacros 11 plug in.
[/quote
OK for FCI... :D

Dave Preston wrote:I believe all of your suggestions require a paid version to use a script language and the executable iMacros.Sidebar.exe can only run 1 macro in a browser session as far as I can deduce?

Euh..., no, not at all...!, the Free iMacros Add-on for FF can run .js Scripts using the FF JS Runtime Engine.

And all mini-Scripts I posted in my previous Post are pure .iim Solutions that you can use with the Free Add-ons for IE/FF/CR.

"... and the executable iMacros.Sidebar.exe can only run 1 macro in a browser session as far as I can deduce?"
=> Yep, correct, same for FF which is the Browser or at least the iMacros Version I prefer, I use an optimized Browser forked on FF with iMacros for FF.
("Browser Session" always sounds a big vague to me, in FF Behaviour/Terminology, because with FF, you can run several FF Browsers Instances within the same Profile, or run several Profiles at the same time (with 1 or more Browser Instances (= Windows)), and I'm not sure you have the Profile Concept with IE...)
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
chivracq
 
Posts: 6490
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: IE Plugin Loop

by Dave Preston on Sun Nov 22, 2015 3:49 am

Ah, OK thanks. I think the documentation is misleading as it suggests scripting is only available in the paid versions.
I am using IE because I understood from the documentation that only IE supported some of the features and because I have some other add-ons that only run on IE. I will take another look
The word session makes sense to me but you have a greater understanding than I so accept it may not be the best term.

Many thanks for your time
Windows 10 Home 64 bit English, Internet Explorer 11.0.10240.16590, iMacros 11 Free Version plug in 11.0.246.4051.
Dave Preston
 
Posts: 11
Joined: Sat Nov 21, 2015 8:36 am

Re: IE Plugin Loop

by Dave Preston on Sun Nov 22, 2015 7:35 am

I tried your URL GOTO=imacros://run/?m=*****
option but I get the download app to run error dialog, so I guess this isn't available in the Free IE plug in?
Windows 10 Home 64 bit English, Internet Explorer 11.0.10240.16590, iMacros 11 Free Version plug in 11.0.246.4051.
Dave Preston
 
Posts: 11
Joined: Sat Nov 21, 2015 8:36 am

Re: IE Plugin Loop

by Dave Preston on Mon Nov 23, 2015 9:11 am

Any ideas anyone?

I have tried starting from a VBS:-
Dim iim1
set iim1= CreateObject ("imacros")

When I run it I get the WHS error ActiveX component can't create object: 'imacros'

So am I correct in my assumption that the free IE plugin doesn't include this, or am I doing something wrong?
Windows 10 Home 64 bit English, Internet Explorer 11.0.10240.16590, iMacros 11 Free Version plug in 11.0.246.4051.
Dave Preston
 
Posts: 11
Joined: Sat Nov 21, 2015 8:36 am

Re: IE Plugin Loop

by Dave Preston on Wed Nov 25, 2015 6:58 am

Any help anyone? I believe I have entered all my config info in my signature correctly
Windows 10 Home 64 bit English, Internet Explorer 11.0.10240.16590, iMacros 11 Free Version plug in 11.0.246.4051.
Dave Preston
 
Posts: 11
Joined: Sat Nov 21, 2015 8:36 am

Re: IE Plugin Loop

by Dave Preston on Sun Nov 29, 2015 2:21 pm

I guess I'm on my own then
Windows 10 Home 64 bit English, Internet Explorer 11.0.10240.16590, iMacros 11 Free Version plug in 11.0.246.4051.
Dave Preston
 
Posts: 11
Joined: Sat Nov 21, 2015 8:36 am

Re: IE Plugin Loop

by chivracq on Mon Nov 30, 2015 9:03 am

Dave Preston wrote:Ah, OK thanks. I think the documentation is misleading as it suggests scripting is only available in the paid versions.
I am using IE because I understood from the documentation that only IE supported some of the features and because I have some other add-ons that only run on IE. I will take another look
The word session makes sense to me but you have a greater understanding than I so accept it may not be the best term.

Many thanks for your time

Documentation:
Yep, they try a bit to sell the Paid Version, but with 3 Full-Working Add-ons for 3 Major Browsers, I don't find them that pushy-pushy, most Software Companies are way more aggressive, I find...

Features:
You don't mention which Features you need, only the DS Mode can do "things" that other Modes cannot do, with Flash Objects for example, but the EVENT Mode on FF is very powerful as well for tricky Objects/Pages and I've always managed to find a Solution for everything on FF.

Other Add-ons on IE:
That's not an Argument, or on the contrary more an Argument for not using IE with iMacros, because when your Macros are running, you cannot use those other Add-ons, hum, OK, maybe you need them after the Macro has finished running..., but if IE is your preferred Browser, then you can have iMacros running on FF and in the meantime, you can still keep doing other things manually on IE...
You don't mention which Add-ons run only on IE, the Add-ons Gallery for FF is much richer, I would think, there is probably some equivalent on FF...

Dave Preston wrote:I tried your URL GOTO=imacros://run/?m=*****
option but I get the download app to run error dialog, so I guess this isn't available in the Free IE plug in?

I don't know what you mean by "... but I get the download app to run error dialog...", but I gave it a try on IE (iMacros for IE v10, IE11) and hum, indeed, this Syntax doesn't seem to work on IE, when trying to start the 2nd Macro, I get a Browser Error Page:
Code: Select all
The webpage cannot be displayed
     
Most likely cause:
•Some content or files on this webpage require a program that you don't have installed.
     
What you can try:
   Search online for a program you can use to view this web content.   
   Retype the address. 
   Go back to the previous page. 

But, pfff...!, I had not run any Tests on IE for a long time but I find it completely Buggy and Unreliable compared to FF:
- Macro Names starting with an Underscore are not visible/supported in the List of Macros!! Gr...!! I had to rename several Macros and adapt the Workflow Chain of my Macros accordingly.
- Many Commands I use in FF are not supported: 'EVENT' (OK, I knew that for v10), even 'FILTER' (even if the RuntimeError is wrong), so I had to comment them all...
- 'Pause' and 'Stop' react when they want, sometimes 3 Lines of Active Code after a Click.
- The Script doesn't wait for some Pages to fully load.
- Some INPUT Fields are "seen" (no RuntimeError with '!ERRORIGNORE' disabled) but sometimes not filled in.
- The Positioning of the iMacros Window Panel is a bit random and the main IE Window goes in some fake Full Screen Mode with the last vertical 2cm on the right side outside of my Screen.
- The iMacros Side Panel sometimes disappears and doesn't come back when reactivating/maximizing the IE Window, you need to minimize all Open Windows on the PC to revive it from its Minimized State on the lower left on the Desktop (not on the Taskbar).
- The Side Panel has constantly the Focus and you constantly need to click and click again in the main IE Window to be able to do any Scrolling.

The only good Feature I liked which is not available in FF is to be able to see the Full Current Line of Code from the Macro being currently executed in the IE Statusbar.
Pfff, all that Feedback and not very positive Experience while trying to get a simple Macro to run a Test...! I find iMacros for FF 20 times better...!

Dave Preston wrote:Any ideas anyone?

I have tried starting from a VBS:-
Dim iim1
set iim1= CreateObject ("imacros")

When I run it I get the WHS error ActiveX component can't create object: 'imacros'

So am I correct in my assumption that the free IE plugin doesn't include this, or am I doing something wrong?

Dunno about that as I don't use any Scripting and I only use the Free Add-on for FF mostly and I only have the Add-on for IE and CR installed for when Users have Pb's specific to these Browsers...
I think .VBS Scripts are indeed only supported from the Scripting Interface. I think I remember a few years ago (maybe 5 years ago), some .VBS Demo-Macros were installed with iMacros for FF (until v6.x or v7.5, I think) and I think I remember running a few, but I tried recently again (on v8.8.2) but .VBS Macros were not even visible from the Side Panel and could obviously not be run...

I know there are several Threads on the Forum about the Error Msg you mention...

Dave Preston wrote:Any help anyone? I believe I have entered all my config info in my signature correctly

Tja, mentioning your FCI in your OP is a Condition for me to read the Question in a new Thread, it doesn't mean I will have an Answer and a/the Solution... And I already gave several Options.... And I don't know anything about .VBS Scripts...

Dave Preston wrote:I guess I'm on my own then

Tja, I already gave you several Options, you can solve your Pb easily using iMacros for FF instead of IE...

If TechSupport see your Thread and give you some Feedback, they will tell you to use the Scripting Interface..., so that won't be very helpful I guess...

You didn't post your Script and you didn't mention anything/much about your Requirements except about lost Connection, but the Workflow of your Macros and Requirements are a bit unclear to me and your Solution with a Batch File sounds a bit cumbersome but I don't have enough Info to find a better Solution...

I'll be curious btw which way you go from here... if you care to share after a while... 8)
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
chivracq
 
Posts: 6490
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: IE Plugin Loop

by Dave Preston on Mon Nov 30, 2015 9:48 am

Hi chivracq,

Firstly, many thanks for your detailed response.

I did explain what I was doing in my first post, which is basically logging into a website and selecting a 'tab', which displays a rota, I can't allow you to view the site as it's confidential. I have a number of IEs running, each logged in as a different user displaying a different rota. This is a totally automated system running 24/7 with no user input, it just allows them to see their up coming shifts. The only problem was it was logging out occasionally, and I still have no idea why, so I thought I would get it to check the current URL every 5 minutes, which I can do as it has "auth" in the URL if it has logged out. If it has logged out I create a text file, which is being checked for by a batch file and it restarts the whole process - clunky, but it's working.

URL GOTO=https://www.xxxxxxxxxxxxxxxxxxxxxxxx
TAG POS=1 TYPE=INPUT:TEXT ATTR=NAME:account_session[username] CONTENT={{VAR1}}
SET !ENCRYPTION NO
TAG POS=1 TYPE=INPUT:PASSWORD ATTR=NAME:account_session[password] CONTENT={{VAR2}}
TAG POS=1 TYPE=INPUT:SUBMIT ATTR=NAME:commit
TAG POS=1 TYPE=SPAN ATTR=TXT:Rota
WAIT SECONDS=20
SET !EXTRACT_TEST_POPUP NO
SET !EXTRACT EVAL("if (\"{{!URLCURRENT}}\".toUpperCase().indexOf('AUTH') > -1) 'Logged out'; else 'NULL'")
SAVEAS TYPE=EXTRACT Folder="C:\\utilities" File=extract.txt
WAIT SECONDS=300
SET !EXTRACT EVAL("if (\"{{!URLCURRENT}}\".toUpperCase().indexOf('AUTH') > -1) 'Logged out'; else 'NULL'")
SAVEAS TYPE=EXTRACT Folder="C:\\utilities" File=extract.txt
WAIT SECONDS=300
SET !EXTRACT EVAL("if (\"{{!URLCURRENT}}\".toUpperCase().indexOf('AUTH') > -1) 'Logged out'; else 'NULL'")
SAVEAS TYPE=EXTRACT Folder="C:\\utilities" File=extract.txt
WAIT SECONDS=300
....
repeat 100s of times
....
WAIT SECONDS=300
SET !EXTRACT Complete
SAVEAS TYPE=EXTRACT Folder="C:\\utilities" File=extract.txt

I tried VBS as I am familiar with VB, and it should work BUT the error suggests that iMacros is not registered as an application.
I tried URL GOTO=imacros://run/?m=myMacroName.iim. but get a message telling me I will need to install an app to run iMacros.
I tried the javascript option and got a similar error.
Because of the above I am convinced the components aren't installed for IE with the free plugin.
I accept that they may well work with Firefox and I may go down that route.

The logging out seems to have resolved itself so I will restrict the script to the initial logging in etc.

Once again, many thanks for your input

Dave
Windows 10 Home 64 bit English, Internet Explorer 11.0.10240.16590, iMacros 11 Free Version plug in 11.0.246.4051.
Dave Preston
 
Posts: 11
Joined: Sat Nov 21, 2015 8:36 am


Return to Scripting and Command Line Interface

Who is online

Users browsing this forum: No registered users and 4 guests

-->