If !URLCURRENT=x" go BACK

Discussions and Tech Support related to the iMacros Google Chrome extension.
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
dholmes
Posts: 1
Joined: Sat Jun 04, 2016 2:20 pm

If !URLCURRENT=x" go BACK

Post by dholmes » Sat Jun 04, 2016 2:38 pm

I am new to imacro, but have had some small successes. I am stuck though and thought I would try the forums.

I have a website that sends me to Google if I am on it "too long" which appears to be some random amount of time. I have made a script that goes back after an amount of time, but sometimes it goes back too quickly and results in it leaving the webpage still.

Can someone help me do something similar to If !URLCURRENT=="https://www.google.com" go BACK

I realize this is a super simplified line that has no chance of working, but I thought it gets the idea across.

I have tried using an EVAL with IF, but it didn't work so I scrapped it. Then tried using ERRORIGNORE but I couldn't find any way to get an "error" just by the URL current being google.com.

Thank you for any help you can provide.
chivracq
Posts: 8716
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: If !URLCURRENT=x" go BACK

Post by chivracq » Sun Jun 05, 2016 10:32 pm

dholmes wrote:I am new to imacro, but have had some small successes. I am stuck though and thought I would try the forums.

I have a website that sends me to Google if I am on it "too long" which appears to be some random amount of time. I have made a script that goes back after an amount of time, but sometimes it goes back too quickly and results in it leaving the webpage still.

Can someone help me do something similar to If !URLCURRENT=="https://www.google.com" go BACK

I realize this is a super simplified line that has no chance of working, but I thought it gets the idea across.

I have tried using an EVAL with IF, but it didn't work so I scrapped it. Then tried using ERRORIGNORE but I couldn't find any way to get an "error" just by the URL current being google.com.

Thank you for any help you can provide.
CIM/FCIM...! :mrgreen: (Always mention your FCI when you open a Thread, read my Sig, many commands are not implemented for all Browsers/Versions, you are posting on the 'iMacros for CR' Sub-Forum so you maybe are on CR but many People post on the incorrect Sub-Forums so that's not even a reliable Info...)

'EVAL()' will be the way indeed, either with 'MacroError()' if you want to stop your Macro, or by computing a String that you will reuse as the URL (or an empty String) for 'URL GOTO'. IT's not possible to compute a "BACK" String to reuse as a "Super Var/Command", I've already filled an EnhReq several years ago for that...

The only way to use 'BACK' would be using a '.js' Script if you were on FF.
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
iimfun
Posts: 239
Joined: Tue Jul 19, 2016 1:06 pm

Re: If !URLCURRENT=x" go BACK

Post by iimfun » Tue Jul 19, 2016 2:42 pm

It seems this may be a solution

Code: Select all

SET action EVAL("('{{!URLCURRENT}}'.match(/www\\.google\\.com/)) ? 'window.history.back();' : 'void(0);';")
URL GOTO=javascript:{{action}}
Post Reply