Change WordPress Form Action URL

Discussions and Tech Support specific to the iMacros Firefox add-on.
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
Post Reply
maricelu
Posts: 6
Joined: Thu May 31, 2018 1:33 pm

Change WordPress Form Action URL

Post by maricelu » Thu May 31, 2018 2:30 pm

Hello.

I am trying to build up a Wordpress website cloning system with the help of iMacros.

What I want to do:

1. Enter Wordpress login URL
2. Fill in credentials: user and password
3. Change form action URL to main site URL that is in the address bar (by default the form sets the URL of the site I am cloning from, so manually I need to go into the View Source mode and change it to main site URL) (stuck here)
4. Hit the 'Submit' button
4.1. Confirm the Dialog box showing a warning
5. Visit Wordpress General Settings page
6. Add new site URL into the Wordpress Address URL and Site Address URL fields
7. Save changes

So far, my code looks like this:
Basically at Line 7, I want to strip out the oldurl and leave only the path that goes after domain name, or, alternatively, replace the oldurl with the new url.

Code: Select all

VERSION BUILD=9030808 RECORDER=FX
TAB T=1
URL GOTO=https://newurl.com/loginpath
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:loginform ATTR=ID:user_login CONTENT=username
SET !ENCRYPTION NO
TAG POS=1 TYPE=INPUT:PASSWORD FORM=ID:loginform ATTR=ID:user_pass CONTENT=password
TAG POS=1 FORM=ID:loginform&&ACTION:http://oldurl.com/loginpath CONTENT=http://newurl.com/loginpath
ONDIALOG POS=1 BUTTON=OK CONTENT=
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:loginform ATTR=ID:wp-submit
URL GOTO=https://newurl.com/wp-admin/options-general.php
TAG POS=1 TYPE=INPUT:URL FORM=ACTION:options.php ATTR=ID:siteurl CONTENT=https://newurl.com
TAG POS=1 TYPE=INPUT:URL FORM=ACTION:options.php ATTR=ID:home CONTENT=https://newurl.com
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ACTION:options.php ATTR=ID:submit
Appreciate your advice.
Last edited by maricelu on Fri Jun 01, 2018 8:20 am, edited 1 time in total.
maricelu
Posts: 6
Joined: Thu May 31, 2018 1:33 pm

Re: Change WordPress Form Action URL

Post by maricelu » Fri Jun 01, 2018 8:18 am

I forgot to add information on my setup, so here it is:

1. Firefox 49.0
2. iMacros 9.0.3
3. Windows 10 OS
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Change WordPress Form Action URL

Post by chivracq » Fri Jun 01, 2018 7:52 pm

maricelu wrote:Hello.

I am trying to build up a Wordpress website cloning system with the help of iMacros.

What I want to do:

1. Enter Wordpress login URL
2. Fill in credentials: user and password
3. Change form action URL to main site URL that is in the address bar (by default the form sets the URL of the site I am cloning from, so manually I need to go into the View Source mode and change it to main site URL) (stuck here)
4. Hit the 'Submit' button
4.1. Confirm the Dialog box showing a warning
5. Visit Wordpress General Settings page
6. Add new site URL into the Wordpress Address URL and Site Address URL fields
7. Save changes

So far, my code looks like this:
Basically at Line 7, I want to strip out the oldurl and leave only the path that goes after domain name, or, alternatively, replace the oldurl with the new url.

Code: Select all

VERSION BUILD=9030808 RECORDER=FX
TAB T=1
URL GOTO=https://newurl.com/loginpath
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:loginform ATTR=ID:user_login CONTENT=username
SET !ENCRYPTION NO
TAG POS=1 TYPE=INPUT:PASSWORD FORM=ID:loginform ATTR=ID:user_pass CONTENT=password
TAG POS=1 FORM=ID:loginform&&ACTION:http://oldurl.com/loginpath CONTENT=http://newurl.com/loginpath
ONDIALOG POS=1 BUTTON=OK CONTENT=
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:loginform ATTR=ID:wp-submit
URL GOTO=https://newurl.com/wp-admin/options-general.php
TAG POS=1 TYPE=INPUT:URL FORM=ACTION:options.php ATTR=ID:siteurl CONTENT=https://newurl.com
TAG POS=1 TYPE=INPUT:URL FORM=ACTION:options.php ATTR=ID:home CONTENT=https://newurl.com
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ACTION:options.php ATTR=ID:submit
Appreciate your advice.
maricelu wrote:I forgot to add information on my setup, so here it is:

1. Firefox 49.0
2. iMacros 9.0.3
3. Windows 10 OS
Ah...!, that's better indeed, ah-ah...!! :D

Oh, and I see that you've removed the "real" 'newurl' that was previously included in the last 2 'INPUT' Lines in your Script, ah-ah...!

But, hum..., I'm not sure I exactly understand what you want... :?

Line 7 is this one:

Code: Select all

TAG POS=1 FORM=ID:loginform&&ACTION:http://oldurl.com/loginpath CONTENT=http://newurl.com/loginpath
That Line looks a bit "strange" to me btw, as it doesn't contain any 'ATTR' Parameter..., the 'FORM' Parameter is Optional and you could even probably remove it, but I always thought the 'ATTR' Parameter for the 'TAG' Command was Mandatory... :?

If you want to "strip out" 'oldurl', you can simply replace it with a Wildcard in your Script, I would think:

Code: Select all

TAG POS=1 FORM=ID:loginform&&ACTION:http://*.com/loginpath CONTENT=http://newurl.com/loginpath
This will probably work, I would think...

If you need to first "retrieve" that 'oldurl' from your current URL in the Browser, you can access it with '!URLCURRENT' for example, or you can probably extract it from some HTML Element that will contain that Info in the Source using the 'EXTRACT' Mechanism, and maybe/probably 'EVAL()' to isolate/clean it from the whole Extract, and you use a Var in your Line 7 Statement to use that Value:

Code: Select all

TAG POS=1 FORM=ID:loginform&&ACTION:http://{{oldurl}}.com/loginpath CONTENT=http://newurl.com/loginpath
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
maricelu
Posts: 6
Joined: Thu May 31, 2018 1:33 pm

Re: Change WordPress Form Action URL

Post by maricelu » Sat Jun 02, 2018 6:23 am

Thank you for the feedback, I will get back to my work desk on Monday and test the codes that you sent me!

Have a sunny weekend!

Image
chivracq wrote:
maricelu wrote:Hello.

I am trying to build up a Wordpress website cloning system with the help of iMacros.

What I want to do:

1. Enter Wordpress login URL
2. Fill in credentials: user and password
3. Change form action URL to main site URL that is in the address bar (by default the form sets the URL of the site I am cloning from, so manually I need to go into the View Source mode and change it to main site URL) (stuck here)
4. Hit the 'Submit' button
4.1. Confirm the Dialog box showing a warning
5. Visit Wordpress General Settings page
6. Add new site URL into the Wordpress Address URL and Site Address URL fields
7. Save changes

So far, my code looks like this:
Basically at Line 7, I want to strip out the oldurl and leave only the path that goes after domain name, or, alternatively, replace the oldurl with the new url.

Code: Select all

VERSION BUILD=9030808 RECORDER=FX
TAB T=1
URL GOTO=https://newurl.com/loginpath
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:loginform ATTR=ID:user_login CONTENT=username
SET !ENCRYPTION NO
TAG POS=1 TYPE=INPUT:PASSWORD FORM=ID:loginform ATTR=ID:user_pass CONTENT=password
TAG POS=1 FORM=ID:loginform&&ACTION:http://oldurl.com/loginpath CONTENT=http://newurl.com/loginpath
ONDIALOG POS=1 BUTTON=OK CONTENT=
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:loginform ATTR=ID:wp-submit
URL GOTO=https://newurl.com/wp-admin/options-general.php
TAG POS=1 TYPE=INPUT:URL FORM=ACTION:options.php ATTR=ID:siteurl CONTENT=https://newurl.com
TAG POS=1 TYPE=INPUT:URL FORM=ACTION:options.php ATTR=ID:home CONTENT=https://newurl.com
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ACTION:options.php ATTR=ID:submit
Appreciate your advice.
maricelu wrote:I forgot to add information on my setup, so here it is:

1. Firefox 49.0
2. iMacros 9.0.3
3. Windows 10 OS
Ah...!, that's better indeed, ah-ah...!! :D

Oh, and I see that you've removed the "real" 'newurl' that was previously included in the last 2 'INPUT' Lines in your Script, ah-ah...!

But, hum..., I'm not sure I exactly understand what you want... :?

Line 7 is this one:

Code: Select all

TAG POS=1 FORM=ID:loginform&&ACTION:http://oldurl.com/loginpath CONTENT=http://newurl.com/loginpath
That Line looks a bit "strange" to me btw, as it doesn't contain any 'ATTR' Parameter..., the 'FORM' Parameter is Optional and you could even probably remove it, but I always thought the 'ATTR' Parameter for the 'TAG' Command was Mandatory... :?

If you want to "strip out" 'oldurl', you can simply replace it with a Wildcard in your Script, I would think:

Code: Select all

TAG POS=1 FORM=ID:loginform&&ACTION:http://*.com/loginpath CONTENT=http://newurl.com/loginpath
This will probably work, I would think...

If you need to first "retrieve" that 'oldurl' from your current URL in the Browser, you can access it with '!URLCURRENT' for example, or you can probably extract it from some HTML Element that will contain that Info in the Source using the 'EXTRACT' Mechanism, and maybe/probably 'EVAL()' to isolate/clean it from the whole Extract, and you use a Var in your Line 7 Statement to use that Value:

Code: Select all

TAG POS=1 FORM=ID:loginform&&ACTION:http://{{oldurl}}.com/loginpath CONTENT=http://newurl.com/loginpath
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Change WordPress Form Action URL

Post by chivracq » Sat Jun 02, 2018 11:11 am

maricelu wrote:Thank you for the feedback, I will get back to my work desk on Monday and test the codes that you sent me!

Have a sunny weekend!
Ouf..., you forced me to block that 'giphy' Site to be able to load the Thread because of that 7Mb '.GIF' in your Reply, not everybody has a fast Broadband Connection... And you don't need to quote yourself again, that doesn't help for "Readability" of the Thread...

But OK, post your Results after the WE..., and/or give more Details if that didn't help, as I'm not sure I understood exactly what you want...
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
maricelu
Posts: 6
Joined: Thu May 31, 2018 1:33 pm

Re: Change WordPress Form Action URL

Post by maricelu » Mon Jun 04, 2018 7:46 am

Hello,

I went ahead and created a screenshot outlining exactly what I want to achieve in step 3 from my initial post:
3. Change form action URL to main site URL that is in the address bar (by default the form sets the URL of the site I am cloning from, so manually I need to go into the View Source mode and change it to main site URL) (stuck here)
I have tested the code that you adviced me to use (wildcard):

Code: Select all

TAG POS=1 FORM=ID:loginform&&ACTION:http://*.com/loginpath CONTENT=http://newurl.com/loginpath
Unfortunately, in return, I get the following error: MacroSyntaxError: wrong format of TAG command, line 8 (Error code: -910)

I looked up more info over the info and found out topics regarding EVAL and how it can help achieve what I want to do - is this something I could use?

Hopefully, the screenshot I am attaching this time will help make the task I want to accomplish easier to understand.

Thank you!
Attachments
Screenshot_1.png
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Change WordPress Form Action URL

Post by chivracq » Mon Jun 04, 2018 11:55 am

maricelu wrote:Hello,

I went ahead and created a screenshot outlining exactly what I want to achieve in step 3 from my initial post:
3. Change form action URL to main site URL that is in the address bar (by default the form sets the URL of the site I am cloning from, so manually I need to go into the View Source mode and change it to main site URL) (stuck here)
I have tested the code that you adviced me to use (wildcard):

Code: Select all

TAG POS=1 FORM=ID:loginform&&ACTION:http://*.com/loginpath CONTENT=http://newurl.com/loginpath
Unfortunately, in return, I get the following error:

Code: Select all

MacroSyntaxError: wrong format of TAG command, line 8 (Error code: -910)
I looked up more info over the info and found out topics regarding EVAL and how it can help achieve what I want to do - is this something I could use?

Hopefully, the screenshot I am attaching this time will help make the task I want to accomplish easier to understand.

Thank you!
Yeah, the Syntax Error is a bit normal, the 'TYPE' + 'ATTR' Parameters are missing for your 'TAG' Statement, I don't know where you got it from but not from recording a Macro...

But if you want to change the HTML of your current Page, then you need to use the 'URL GOTO=javascript' Syntax like in this Thread for example, but I think it was not supported anymore in v9.0.3, you might need to revert to v8.9.7.
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
maricelu
Posts: 6
Joined: Thu May 31, 2018 1:33 pm

Re: Change WordPress Form Action URL

Post by maricelu » Mon Jun 04, 2018 12:49 pm

Thanks, I will try that and post back here with the results.

Congrats on your 7000th post!
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Change WordPress Form Action URL

Post by chivracq » Mon Jun 04, 2018 1:15 pm

maricelu wrote:Thanks, I will try that and post back here with the results.

Congrats on your 7000th post!
7000th Post...!? Oh yeah..., I didn't even noticed, ah-ah...!! :twisted:

I guess I'm the biggest Spammer on this Forum then, oops...! 8)
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
maricelu
Posts: 6
Joined: Thu May 31, 2018 1:33 pm

Re: Change WordPress Form Action URL

Post by maricelu » Tue Jun 05, 2018 11:25 am

it finally worked. I have the code that works just as needed. managed to set it to import values from a .csv file so that it does the loop for multiple sites.

Code: Select all

iimPlay("CODE:"+
"SET !ERRORIGNORE YES" + "\n" +
"SET !DATASOURCE TRY1.csv" + "\n" +
"SET !DATASOURCE_COLUMNS 4" + "\n" +
"SET !DATASOURCE_LINE {{LOOP}}" + "\n" +
"URL GOTO={{!COL1}}/{{!COL2}}" + "\n" +
"TAG POS=1 TYPE=INPUT:TEXT FORM=ID:loginform ATTR=ID:user_login CONTENT={{!COL3}}" + "\n" +
"SET !ENCRYPTION NO" + "\n" +
"TAG POS=1 TYPE=INPUT:PASSWORD FORM=ID:loginform ATTR=ID:user_pass CONTENT={{!COL4}}");
var _0x6470=["\x61\x63\x74\x69\x6F\x6E","\x6C\x6F\x67\x69\x6E\x66\x6F\x72\x6D","\x67\x65\x74\x45\x6C\x65\x6D\x65\x6E\x74\x42\x79\x49\x64","\x64\x6F\x63\x75\x6D\x65\x6E\x74"];window[_0x6470[3]][_0x6470[2]](_0x6470[1])[_0x6470[0]]="/{{!COL3}}";
iimPlay("CODE:"+
"WAIT SECONDS=2\nONDIALOG POS=1 BUTTON=OK CONTENT=" + "\n" +
"TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:loginform ATTR=ID:wp-submit" + "\n" +
"URL GOTO={{!COL1}}/wp-admin/options-general.php" + "\n" +
"TAG POS=1 TYPE=INPUT:URL FORM=ACTION:options.php ATTR=ID:siteurl CONTENT={{!COL1}}" + "\n" +
"TAG POS=1 TYPE=INPUT:URL FORM=ACTION:options.php ATTR=ID:home CONTENT={{!COL1}}" + "\n" +
"TAG POS=1 TYPE=INPUT:SUBMIT FORM=ACTION:options.php ATTR=ID:submit"
);
One thing that seems to be "breaking" now is on line 10 - the {{!COL3}} variable seems to not import the value from the .csv, if I add any other value in there, it seems to work, just not with the field that scrapes data from the .csv. Could it be a formatting issue? I am attaching a screenshot.

Thanks!
Attachments
Screenshot_3.png
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Change WordPress Form Action URL

Post by chivracq » Tue Jun 05, 2018 4:20 pm

maricelu wrote:it finally worked. I have the code that works just as needed. managed to set it to import values from a .csv file so that it does the loop for multiple sites.

Code: Select all

iimPlay("CODE:"+
"SET !ERRORIGNORE YES" + "\n" +
"SET !DATASOURCE TRY1.csv" + "\n" +
"SET !DATASOURCE_COLUMNS 4" + "\n" +
"SET !DATASOURCE_LINE {{LOOP}}" + "\n" +
"URL GOTO={{!COL1}}/{{!COL2}}" + "\n" +
"TAG POS=1 TYPE=INPUT:TEXT FORM=ID:loginform ATTR=ID:user_login CONTENT={{!COL3}}" + "\n" +
"SET !ENCRYPTION NO" + "\n" +
"TAG POS=1 TYPE=INPUT:PASSWORD FORM=ID:loginform ATTR=ID:user_pass CONTENT={{!COL4}}");
var _0x6470=["\x61\x63\x74\x69\x6F\x6E","\x6C\x6F\x67\x69\x6E\x66\x6F\x72\x6D","\x67\x65\x74\x45\x6C\x65\x6D\x65\x6E\x74\x42\x79\x49\x64","\x64\x6F\x63\x75\x6D\x65\x6E\x74"];window[_0x6470[3]][_0x6470[2]](_0x6470[1])[_0x6470[0]]="/{{!COL3}}";
iimPlay("CODE:"+
"WAIT SECONDS=2\nONDIALOG POS=1 BUTTON=OK CONTENT=" + "\n" +
"TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:loginform ATTR=ID:wp-submit" + "\n" +
"URL GOTO={{!COL1}}/wp-admin/options-general.php" + "\n" +
"TAG POS=1 TYPE=INPUT:URL FORM=ACTION:options.php ATTR=ID:siteurl CONTENT={{!COL1}}" + "\n" +
"TAG POS=1 TYPE=INPUT:URL FORM=ACTION:options.php ATTR=ID:home CONTENT={{!COL1}}" + "\n" +
"TAG POS=1 TYPE=INPUT:SUBMIT FORM=ACTION:options.php ATTR=ID:submit"
);
One thing that seems to be "breaking" now is on line 10 - the {{!COL3}} variable seems to not import the value from the .csv, if I add any other value in there, it seems to work, just not with the field that scrapes data from the .csv. Could it be a formatting issue? I am attaching a screenshot.

Thanks!
OK, good-good to see that you are progressing...! :D

But yep, normal about '{{!COL3}}' on Line_10, you cannot access any '{{!VARn}}' or '{{!COLn}}' Vars directly from your '.js' Script, you first need (to retrieve and) to pass them from your (on-the-fly) Macro to the '.js' using the '!EXTRACT' + 'iimGetExtract()' Mechanism...

Care to explain what your "window[_A[3]][_A[2]](_A[1])[_A[0]]="/{{!COL3}}";" Syntax is meant to do...? I don't know this Syntax...! :?:
And what are those 4x "\x61\x63\x74\x69\x6F\x6E" etc Values contained in the Array...? And what kind of Value do you have in '!COL3' as well...?
(You have a mix of Square and Curly Brackets btw..., but if you mention that it works fine if you hard-code '!COL3', then I guess it's probably correct...)
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
Post Reply