Get Current URL and change it?
Forum rules
iMacros EOL - Attention!
The renewal maintenance has officially ended for Progress iMacros effective November 20, 2023 and all versions of iMacros are now considered EOL (End-of-Life). The iMacros products will no longer be supported by Progress (aside from customer license issues), and these forums will also no longer be moderated from the Progress side.
Thank you again for your business and support.
Sincerely,
The Progress Team
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
iMacros EOL - Attention!
The renewal maintenance has officially ended for Progress iMacros effective November 20, 2023 and all versions of iMacros are now considered EOL (End-of-Life). The iMacros products will no longer be supported by Progress (aside from customer license issues), and these forums will also no longer be moderated from the Progress side.
Thank you again for your business and support.
Sincerely,
The Progress Team
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
Get Current URL and change it?
Hi,
I am new to the iMacros and was wondering if anyone can help me with how to do a certain task.
I would like to get the current url, which I believe I would use SET !EXTRACTADD {{!URLCURRENT}} and then I would like to take the current url, remove the http:// and replace it with https://
For example -
current url = http://www.someurl.com
So http://www.someurl.com would become https://www.someurl.com
Thanks so much for your help
--Lisa
I am new to the iMacros and was wondering if anyone can help me with how to do a certain task.
I would like to get the current url, which I believe I would use SET !EXTRACTADD {{!URLCURRENT}} and then I would like to take the current url, remove the http:// and replace it with https://
For example -
current url = http://www.someurl.com
So http://www.someurl.com would become https://www.someurl.com
Thanks so much for your help
--Lisa
-
- Posts: 214
- Joined: Fri Jul 04, 2008 1:28 pm
- Location: Ahmedabad
- Contact:
Re: Get Current URL and change it?
Hi Lisa,
It is possible using java script
You can use following code to change from http to https.....
var str="http://www.someurl.com";
newurl = str.replace(/http/,"https");
First line will store extracted url in "str" variable
Second line will replace http with https and it resulting string will be assigned to "newurl" variable which can be used for further reference.
Hope it will solve your purpose
Dharmesh Uteshiya
www.dharmesh-uteshiya.co.nr
It is possible using java script
You can use following code to change from http to https.....
var str="http://www.someurl.com";
newurl = str.replace(/http/,"https");
First line will store extracted url in "str" variable
Second line will replace http with https and it resulting string will be assigned to "newurl" variable which can be used for further reference.
Hope it will solve your purpose
Dharmesh Uteshiya
www.dharmesh-uteshiya.co.nr
Dharmendra Uteshiya
http://www.dharmesh-uteshiya.co.nr
http://www.dharmesh-uteshiya.co.nr
Re: Get Current URL and change it?
Thanks so much Dharmesh! Will I be able to incorporate the !URLCURRENT into that? Basically, I want the macro to grab the current url I am on and then change it from http to https. The url will always be different which is why I was thinking I needed to use the !URLCURRENT.
thanks again for your help on this
--Lisa
thanks again for your help on this
--Lisa
- Tech Support
- Posts: 4948
- Joined: Tue Sep 20, 2005 7:25 pm
- Contact:
Re: Get Current URL and change it?
The complete solution is to combine your macro with dharmendra2000 code:
Macro1 extracts the URL with
Then you can read the content of !EXTRACT from the script with oldurl=iimGetLastExtract (1), use dharmendra2000 code snippet to change http to https and then send the code to the new macro with iimSet ("url2", newurl)
Macro1 extracts the URL with
Code: Select all
ADD !EXTRACT {{!URLCURREN}}
Code: Select all
URL GOTO={{url2}}
Re: Get Current URL and change it?
Thanks for the help - maybe it being Friday is why I am not understanding this. how do i use javascript in the macro?
I have one .iim file called check-change-https.
My code that i have in that file is:
VERSION BUILD=6221002
TAB T=1
ADD !EXTRACT {{!URLCURRENT}}
oldurl = iimGetLastExtract (1)
newurl = str.replace(/http/,"https")
iimSet ("url2", newurl)
TAB T=2
URL GOTO={{url2}}
I am not sure why I can't get this to work and really appreciate your help on this.
I have one .iim file called check-change-https.
My code that i have in that file is:
VERSION BUILD=6221002
TAB T=1
ADD !EXTRACT {{!URLCURRENT}}
oldurl = iimGetLastExtract (1)
newurl = str.replace(/http/,"https")
iimSet ("url2", newurl)
TAB T=2
URL GOTO={{url2}}
I am not sure why I can't get this to work and really appreciate your help on this.
- Tech Support
- Posts: 4948
- Joined: Tue Sep 20, 2005 7:25 pm
- Contact:
Re: Get Current URL and change it?
You need to use the Javascript or VBS script or any other language externally and then use iimPlay to start the macro.
Please see the examples at
http://wiki.imacros.net/Sample_Code (iMacros Scripting Edition)
http://wiki.imacros.net/iMacros_for_Fir ... _Interface (iMacros for Firefox)
Please see the examples at
http://wiki.imacros.net/Sample_Code (iMacros Scripting Edition)
http://wiki.imacros.net/iMacros_for_Fir ... _Interface (iMacros for Firefox)
-
- Posts: 214
- Joined: Fri Jul 04, 2008 1:28 pm
- Location: Ahmedabad
- Contact:
Re: Get Current URL and change it?
You require 3 files to complete your task. Once all 3 files are ready, execute myscript.js file.
myscript.js
mymacro1.iim
mymacro2.iim
Hope this will solve your purpose
Cheers,
Dharmesh Uteshiya
http://www.dharmesh-uteshiya.co.nr
myscript.js
Code: Select all
iimPlay("mac1.iim")
oldurl = iimGetLastExtract (1)
newurl = oldurl.replace(/http/,"https")
iimSet ("url2", newurl)
alert(newurl);
iimPlay("mac2.iim")
Code: Select all
VERSION BUILD=6070918 RECORDER=FX
TAB T=1
URL GOTO=http://www.google.com/
ADD !EXTRACT {{!URLCURRENT}}
Code: Select all
VERSION BUILD=6070918 RECORDER=FX
TAB T=1
PROMPT {{url2}}
URL GOTO={{url2}}
ADD !EXTRACT {{!URLCURRENT}}
Cheers,
Dharmesh Uteshiya
http://www.dharmesh-uteshiya.co.nr
Dharmendra Uteshiya
http://www.dharmesh-uteshiya.co.nr
http://www.dharmesh-uteshiya.co.nr
Re: Get Current URL and change it?
iMacros GOTO supports javascript so you can generate new URL like this:
Code: Select all
VERSION BUILD=1001 RECORDER=CR
URL GOTO=https://url.com/file.php?id=61460
URL GOTO=javascript:var<SP>url=new<SP>URL(window.location.href);var<SP>id=url.searchParams.get("id");window.location.href='https://url.com/post_new.php?issue_id='+id;
- thecoder2012
- Posts: 446
- Joined: Sat Aug 15, 2015 5:14 pm
- Location: Internet
- Contact:
Re: Get Current URL and change it?
Why with searchParams (id) ?go3don wrote:iMacros GOTO supports javascript so you can generate new URL like this:Code: Select all
VERSION BUILD=1001 RECORDER=CR URL GOTO=https://url.com/file.php?id=61460 URL GOTO=javascript:var<SP>url=new<SP>URL(window.location.href);var<SP>id=url.searchParams.get("id");window.location.href='https://url.com/post_new.php?issue_id='+id;
My example:
Code: Select all
URL GOTO=http://www.someurl.com/
ADD !EXTRACT {{!URLCURRENT}}
URL GOTO=javascript:window.location.href="{{!EXTRACT}}".replace(/^http/i,"https");
Join 9kw.eu Captcha Service now and let your iMacros continue downloads and scripts while you sleep. - Custom iMacros? Contact me!