Getting the Textfield with Focus

Discussions and Tech Support related to the iMacros Google Chrome extension.

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.

Getting the Textfield with Focus

by arsarc on Wed Sep 20, 2017 1:25 pm

Browser: Google Chrome Version 60.0.3112.113 (Official Build) (64-bit)
iMacros for Chrome V 8.4.4
Windows 7 64 bit

I was trying to work through this thread: viewtopic.php?f=7&t=25836

Using this website as an example because the website I'm working on is internal only.
http://demo.imacros.net/Automate/AutoDataEntry

I want to be able to click a textbox then run a macros to fill in the current textbox I have selected and the 2 underneath.

So, I understand a little bit to fill in via relative values:
Code: Select all
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:address CONTENT=address
TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:* CONTENT=city
TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:* CONTENT=zip


But I'm unsure how to get the Focused text field?
I found the javascript

Code: Select all
javascript:document.activeElement.id


But I'm unsure how to store it by variable.

This doesn't work:

Code: Select all
SET Field_Focus javascript:document.activeElement.id


This doesn't work either:

Code: Select all
var Field_Focus = javascript:document.activeElement.id


But I think if I can figure out how to get the javascript to work, I can use this(?)

Code: Select all
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:{{Field_Focus}} CONTENT=address
arsarc
 
Posts: 2
Joined: Wed Sep 20, 2017 1:08 pm

Re: Getting the Textfield with Focus

by chivracq on Wed Sep 20, 2017 3:34 pm

arsarc wrote:
Code: Select all
Browser: Google Chrome Version 60.0.3112.113 (Official Build) (64-bit)
iMacros for Chrome V 8.4.4
Windows 7 64 bit


I was trying to work through this thread: viewtopic.php?f=7&t=25836

Using this website as an example because the website I'm working on is internal only.
http://demo.imacros.net/Automate/AutoDataEntry

I want to be able to click a textbox then run a macros to fill in the current textbox I have selected and the 2 underneath.

So, I understand a little bit to fill in via relative values:
Code: Select all
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:address CONTENT=address
TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:* CONTENT=city
TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:* CONTENT=zip


But I'm unsure how to get the Focused text field?
I found the javascript

Code: Select all
javascript:document.activeElement.id


But I'm unsure how to store it by variable.

This doesn't work:

Code: Select all
SET Field_Focus javascript:document.activeElement.id


This doesn't work either:

Code: Select all
var Field_Focus = javascript:document.activeElement.id


But I think if I can figure out how to get the javascript to work, I can use this(?)

Code: Select all
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:{{Field_Focus}} CONTENT=address

Oh yeah...!, I remember this Thread, hum from 1.5 years ago already, oops...! :oops:

But very good that you already found this Thread, I read it quickly as I had forgotten most about it...
Hum, interesting Testing I did then, pity the User dropped at some point and didn't follow up anymore...
And I see that you "complied" with my "Rant" about mentioning your FCI, good-good-good, ah-ah...! :D (At least I won't have to "traumatize" you to play "Ping-Pong" for 1 day or more until you mention it...)

There is as well another similar Thread I think, where I had done some Testing/Thinking, it was about a User who wanted to use a QR or Barcode Scanner in combination with iMacros, I think the Principle was a bit similar, he wanted to do/control everything from the Scanner and not have to touch the Computer Mouse or Keyboard..., but I'm not sure that User finished the Thread completely either, with a working Solution...

But OK, in your Case and applied to your Demo-Site, I would have the following simple Solution:
Code: Select all
VERSION BUILD=8820413 RECORDER=FX
SET !ERRORIGNORE YES
TAB T=1
URL GOTO=http://demo.imacros.net/Automate/AutoDataEntry

SET !CLIPBOARD dfgksjhkweryuweoiuifdkjkdf_(Junk_That_Will_Never_Be_Found_On_The_Page_ah-ah...!!!)
'PROMPT {{!CLIPBOARD}}

SET !TIMEOUT_STEP 300
'TAG POS=1 TYPE=LABEL FORM=ID:demo ATTR=TXT:Address
TAG POS=1 TYPE=LABEL FORM=ID:demo ATTR=TXT:*{{!CLIPBOARD}}*
WAIT SECONDS=0.5

'TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:address CONTENT=address_input
TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:* CONTENT=address_input
TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:* CONTENT=city_input
TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:* CONTENT=zip_input
(Tested on iMacros for FF v8.8.2, Pale Moon v26.3.3 (=FF47), Win10-x64.)

The '!ERRORIGNORE' and mini-'WAIT' Statements seem to be needed on FF or at least in my FCI..., they may be not required on CR...

The Script loads the Page, and waits for 5 minutes until you select (= Double-Click + Copy or 'Ctrl^c') one of the Labels on the Form and copy it to the OS Clipboard and the Script waits for 5 min and checks every Second if it can find it, to use it as the Anchor for Relative Positioning...
=> If you select 'Address', it will start filling in the Form from the 'Address' Input Field, if you select 'Last' or 'Last Name', it will start from the 'Last Name' Input Field, same thing with 'First' or 'First Name', but if you select "only" 'Name', it will start with the 'First Name' Input Field as it is the 1st Label found on the Form containing the Keyword "Name"...
I guess you understand the Principle...!? :wink:

But hum-hum, you are on CR, and I think that referencing the Content of the OS Clipboard with '{{!CLIPBOARD}}' is not supported in iMacros for CR..., not completely sure anymore..., some other Advanced User using CR as his main Browser had reported that it does work in v8.4.4, if you can check...?
And if it doesn't work, I can think directly of a Workaround for you, ah-ah...! Hum, 2 actually, and one leads to another complete(ly) different Approach..., but the one in this current Post would be the easiest one I would think...

The JavaScript Statements you mentioned in your OP need to be used with the 'URL GOTO=javascript:' Syntax on CR, I would expect them to work on CR... But I'm not sure Relative Positioning with 'TAG' will be able to use any of them...
- (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: 6474
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: Getting the Textfield with Focus

by arsarc on Thu Sep 21, 2017 2:41 pm

Ok I tried running the script, nothing happened when I just ran it on its own.

Then i tried running it with the following change:

Code: Select all
TAB T=1
URL GOTO=http://demo.imacros.net/Automate/AutoDataEntry

SET !CLIPBOARD dfgksjhkweryuweoiuifdkjkdf_(Junk_That_Will_Never_Be_Found_On_The_Page_ah-ah...!!!)
'PROMPT {{!CLIPBOARD}}

SET !TIMEOUT_STEP 300
'TAG POS=1 TYPE=LABEL FORM=ID:demo ATTR=TXT:Address
TAG POS=1 TYPE=LABEL FORM=ID:demo ATTR=TXT:*{{!CLIPBOARD}}*
WAIT SECONDS=6

'TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:address CONTENT=address_input
TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:* CONTENT=address_input
TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:* CONTENT=city_input
TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:* CONTENT=zip_input


(Just erased the !ERRORIGNORE YES part and changed WAIT SECONDS=6)

And tried to run it again. I highlighted and CTRL+C the label "Address" and nothing happened. I even pasted the word Address in the box to make sure it copied, and it did have the word "Address" in my clipboard.

I waited for the 300 sec and I got the following error:

RuntimeError: element LABEL specified by TXT:*{{!CLIPBOARD}}* was not found, line: 10


So maybe clipboard doesn't work (or I'm doing something wrong, very likely!)

The JavaScript Statements you mentioned in your OP need to be used with the 'URL GOTO=javascript:' Syntax on CR, I would expect them to work on CR... But I'm not sure Relative Positioning with 'TAG' will be able to use any of them...


Is there any way to just use javascript to send the ID of the focused textbox to iMacros? I was trying to use the documentation but I don't feel smart enough to understand it.

Or maybe I need to start off in Javascript?? (I was trying to google around more https://stackoverflow.com/questions/259 ... to-imacros )

Code: Select all
var macro;
macro = "WAIT SECONDS=6 \n";
macro += "TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:"+ document.activeElement.id +" CONTENT=address_input \n";
macro += "TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:* CONTENT=city_input \n";
macro += "TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:* CONTENT=zip_input \n";
iimPlay(macro)


I tried to save this as a .js file but iMacros still saves this as a .iim file.
arsarc
 
Posts: 2
Joined: Wed Sep 20, 2017 1:08 pm

Re: Getting the Textfield with Focus

by chivracq on Thu Sep 21, 2017 7:02 pm

arsarc wrote:Ok I tried running the script, nothing happened when I just ran it on its own.

Then i tried running it with the following change:

Code: Select all
TAB T=1
URL GOTO=http://demo.imacros.net/Automate/AutoDataEntry

SET !CLIPBOARD dfgksjhkweryuweoiuifdkjkdf_(Junk_That_Will_Never_Be_Found_On_The_Page_ah-ah...!!!)
'PROMPT {{!CLIPBOARD}}

SET !TIMEOUT_STEP 300
'TAG POS=1 TYPE=LABEL FORM=ID:demo ATTR=TXT:Address
TAG POS=1 TYPE=LABEL FORM=ID:demo ATTR=TXT:*{{!CLIPBOARD}}*
WAIT SECONDS=6

'TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:address CONTENT=address_input
TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:* CONTENT=address_input
TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:* CONTENT=city_input
TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:* CONTENT=zip_input


(Just erased the !ERRORIGNORE YES part and changed WAIT SECONDS=6)

And tried to run it again. I highlighted and CTRL+C the label "Address" and nothing happened. I even pasted the word Address in the box to make sure it copied, and it did have the word "Address" in my clipboard.

I waited for the 300 sec and I got the following error:

RuntimeError: element LABEL specified by TXT:*{{!CLIPBOARD}}* was not found, line: 10


So maybe clipboard doesn't work (or I'm doing something wrong, very likely!)

The JavaScript Statements you mentioned in your OP need to be used with the 'URL GOTO=javascript:' Syntax on CR, I would expect them to work on CR... But I'm not sure Relative Positioning with 'TAG' will be able to use any of them...


Is there any way to just use javascript to send the ID of the focused textbox to iMacros? I was trying to use the documentation but I don't feel smart enough to understand it.

Or maybe I need to start off in Javascript?? (I was trying to google around more https://stackoverflow.com/questions/259 ... to-imacros )

Code: Select all
var macro;
macro = "WAIT SECONDS=6 \n";
macro += "TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:"+ document.activeElement.id +" CONTENT=address_input \n";
macro += "TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:* CONTENT=city_input \n";
macro += "TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:* CONTENT=zip_input \n";
iimPlay(macro)


I tried to save this as a .js file but iMacros still saves this as a .iim file.

Yeah, my 'WAIT' =1 or =0.5 was already long enough, but simply reactivate the "PROMPT {{!CLIPBOARD}}" to check if '{{!CLIPBOARD}}' works on CR or not...!
If you get my silly "dfg...(Junk-...whatever...!!!)", then it works, if you get your previous 'Copy' then it doesn't work...

If you want to use a '.js' Script like the one you adapted from SOF (Advanced User on SOF @macroscripts is quite/very good btw), you can only run such '.js' Scripts on FF with the iMacros for FF Add-on... Only FF can run '.js' Scripts...
But if you can use FF instead of CR, then my "easy" Solution would work as well, without the need for some cumbersome '.js' Script...! :idea:

But I said I had 1 or 2 Workarounds (or different Approach(es)) that would still work on CR if '{{!CLIPBOARD}}' was not working...
Check "properly" first if '{{!CLIPBOARD}}' works or not in v8.4.4 for CR, then I can tell you about my other "Ideas", which are still more simple than your cumbersome Constructions with 'javascript:xxx' or a '.js' Script, I would think...
- (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: 6474
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: Getting the Textfield with Focus

by iimfun on Thu Sep 21, 2017 11:14 pm

arsarc wrote:I found the javascript

Code: Select all
 javascript:document.activeElement.id

But I'm unsure how to store it by variable.

arsarc wrote:Is there any way to just use javascript to send the ID of the focused textbox to iMacros? I was trying to use the documentation but I don't feel smart enough to understand it.


I just want to share my idea about that issue with the forum Chrome users

Code: Select all
URL GOTO=javascript:document.body.setAttribute("title",document.activeElement.id);

SET !EXTRACT_TEST_POPUP NO
TAG POS=1 TYPE=BODY ATTR=* EXTRACT=TITLE
URL GOTO=javascript:document.body.removeAttribute("title");

SET Field_Focus {{!EXTRACT}}
SET !EXTRACT NULL
PROMPT {{Field_Focus}}
iimfun
 
Posts: 238
Joined: Tue Jul 19, 2016 6:06 am

Re: Getting the Textfield with Focus

by chivracq on Fri Sep 22, 2017 8:34 am

iimfun wrote:
arsarc wrote:I found the javascript

Code: Select all
 javascript:document.activeElement.id

But I'm unsure how to store it by variable.

arsarc wrote:Is there any way to just use javascript to send the ID of the focused textbox to iMacros? I was trying to use the documentation but I don't feel smart enough to understand it.


I just want to share my idea about that issue with the forum Chrome users

Code: Select all
URL GOTO=javascript:document.body.setAttribute("title",document.activeElement.id);

SET !EXTRACT_TEST_POPUP NO
TAG POS=1 TYPE=BODY ATTR=* EXTRACT=TITLE
URL GOTO=javascript:document.body.removeAttribute("title");

SET Field_Focus {{!EXTRACT}}
SET !EXTRACT NULL
PROMPT {{Field_Focus}}

Oh...!, yep, very good...!, that works (on FF as well)...! :D
But hum, @iimfun, you should (always) mention in which FCI you've tested it, 'URL GOTO=javascript:' Functionality often gets broken from some specific Version for iMacros or from the Browser(s)...
=> Probable FCI: iMacros for CR v8.4.4, CR60. [All OS'es.]

=> Applied to the Demo-Site, that would give the following Macro:
Code: Select all
VERSION BUILD=8820413 RECORDER=FX
SET !EXTRACT_TEST_POPUP NO
'SET !ERRORIGNORE YES
TAB T=1
'URL GOTO=http://demo.imacros.net/Automate/AutoDataEntry

URL GOTO=javascript:document.body.setAttribute("title",document.activeElement.id);
TAG POS=1 TYPE=BODY ATTR=* EXTRACT=TITLE
URL GOTO=javascript:document.body.removeAttribute("title");

SET Field_Focus {{!EXTRACT}}
SET !EXTRACT NULL
'PROMPT {{Field_Focus}}
'PAUSE

SET !TIMEOUT_STEP 1
'TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:address CONTENT=address
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:{{Field_Focus}} CONTENT=address_input
TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:* CONTENT=city_input
TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:* CONTENT=zip_input
(Tested on iMacros for FF v8.8.2, PM v26.3.3 (=FF47), Win10_x64.)

I've shorten '!TIMEOUT_STEP' to "1" for the Macro to abort quicker than the Default 6 Sec, in case the User "forgot" to set the Focus to one (Input) Field before starting the Macro.

Hum, and that's an interesting way to pass a Var from an 'URL GOTO=javascript:' back to the '.iim' Script. :D
I was "missing" a bit this Functionality, I knew how to use a '{{!VAR1}}' inside an 'URL GOTO=javascript:' Statement, but I wasn't sure how to pass a Var back to the '.iim' Script, good-good-good...! (That opens some "Doors" I would think then, to use/misuse this Syntax in some Cases instead of 'EVAL()', ah-ah...! :twisted: )

:?: But hum, @iimfun, good that you jumped into this Thread, but could you confirm if '{{!CLIPBOARD}}' works or not on CR with v8.4.4 for CR...? :?:
I thought you had mentioned once that it works in v8.4.4 for CR (even if the Wiki mentions that it's not supported on CR), but @OP didn't get it to work), but I "trust" your Testing a bit more than from @OP, ah-ah...! :wink:
- (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: 6474
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: Getting the Textfield with Focus

by iimfun on Sun Sep 24, 2017 11:10 pm

chivracq wrote:But hum, @iimfun, you should (always) mention in which FCI you've tested it

Okay, here is my FCI:
iMacros for Chrome 8.4.4
Chrome Portable 58.0.3029.110
Windows 7 32 bit

chivracq wrote:... could you confirm if '{{!CLIPBOARD}}' works or not on CR with v8.4.4 for CR...?

Yes, the !CLIPBOARD variable is workable in iMacros for Chrome. But it's impossible to retrieve directly the value that was copied outside the browser. At the same time this built-in variable sets the OS clipboard.
iimfun
 
Posts: 238
Joined: Tue Jul 19, 2016 6:06 am

Re: Getting the Textfield with Focus

by chivracq on Mon Sep 25, 2017 12:01 am

iimfun wrote:
chivracq wrote:But hum, @iimfun, you should (always) mention in which FCI you've tested it

Okay, here is my FCI:
iMacros for Chrome 8.4.4
Chrome Portable 58.0.3029.110
Windows 7 32 bit

OK, Thanks for mentioning your FCI when you post some (Advanced/Solution) Script, and not only for me, but as you know many Commands get broken from some specific Version for iMacros or the corresponding Browser...
Hum, interesting to see that you are on CR Pt v58, I saw today on the Forum that CR 61 was already out

iimfun wrote:
chivracq wrote:... could you confirm if '{{!CLIPBOARD}}' works or not on CR with v8.4.4 for CR...?

Yes, the !CLIPBOARD variable is workable in iMacros for Chrome. But it's impossible to retrieve directly the value that was copied outside the browser. At the same time this built-in variable sets the OS clipboard.

Euh..., that one I don't understand exactly-exactly :oops: , the Qt was if referencing '{{!CLIPBOARD}}' (with the 'Copy' from iMacros or from outside => directly from the OS Clipboard)) works...? I want to know very-exactly what the "Results" are and what works or not, if I need to post again about it on the Forum...
But OK, I finally gave in ( :oops: ) and installed CR (v60), and iMacros for it (v8.4.4) + FIO of course, OK, I'll test for myself and I'll be a bit "independent" from now on, ah-ah...! :wink:

I guess I still haven't figured out exactly how Humans communicate with Qt's and Answers..., oops...!
(OK, still working on that, ah-ah...! :wink: )
- (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: 6474
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: Getting the Textfield with Focus

by chivracq on Mon Sep 25, 2017 8:50 am

chivracq wrote:
iimfun wrote:
chivracq wrote:... could you confirm if '{{!CLIPBOARD}}' works or not on CR with v8.4.4 for CR...?

Yes, the !CLIPBOARD variable is workable in iMacros for Chrome. But it's impossible to retrieve directly the value that was copied outside the browser. At the same time this built-in variable sets the OS clipboard.

Euh..., that one I don't understand exactly-exactly :oops: , the Qt was if referencing '{{!CLIPBOARD}}' (with the 'Copy' from iMacros or from outside => directly from the OS Clipboard)) works...? I want to know very-exactly what the "Results" are and what works or not, if I need to post again about it on the Forum...
But OK, I finally gave in ( :oops: ) and installed CR (v60), and iMacros for it (v8.4.4) + FIO of course, OK, I'll test for myself and I'll be a bit "independent" from now on, ah-ah...! :wink:

I guess I still haven't figured out exactly how Humans communicate with Qt's and Answers..., oops...!
(OK, still working on that, ah-ah...! :wink: )

Ah OK, I get it, I understand now..., from doing my own little Testing... (with iMacros for CR v8.4.4 + CR60, but hum..., nope...!, CR updated itself silently from CR60 to CR61, without asking me anything, grrr..., I don't like that...! :shock: )
=> FCI: iMacros for CR v8.4.4, CR61 (v61.0.3163.100_x64), Win10_x64.)

But hum..., strange Behaviour indeed, and the Info in the Wiki is more or less correct:
Code: Select all
SET !CLIPBOARD "Any Content..."
works fine indeed...
But using '{{!CLIPBARD}}' only works for retrieving the Content of some kind of "parallel" Clipboard from a previous 'SET !CLIPBOARD' Command (and only used by iMacros (for CR)) from the same Run or from some previous Run, even if iMacros was closed and reopened, within the same Chrome Session... (Its Content gets reset if CR is closed and restarted...)

Hum, funny way of presenting a 'PROMPT', with "demo.imacros.net says", ah-ah...!
And 'PROMPT' needs a Web-Page to be loaded in the Browser to work or yields some RuntimeError otherwise, eh-beh...!

But OK, so that means my first Workaround in my first Post with Double Click on "Address" + 'Ctrl^c' or 'Copy' doesn't work indeed on CR. :(

I tested as well with @iimfun's Method (using "my" Script applied to the Demo-Site), and it works indeed correctly, even if a bit confusing I find, compared to iMacros for FF on FF/PM as when switching from the CR Web-Page to the iMacros Dok-Panel (undocked) to select and launch a Macro, the Focus (inside the 'Address' Input Field) disappears and seems to be lost, but the Script still does its "Job" correctly...
Then that's the best Solution for @OP, I would think... 8)

Some Workaround(s) I had in mind from my first Post if "my" "Select + Copy the Label" wouldn't work, would be to have some mini-TEMP '.TXT' File open in parallel where that Label could be saved on the fly, and that '.TXT' File could be used as a DataSource by iMacros with stg like:
Code: Select all
SET !TIMEOUT_STEP 300
'TAG POS=1 TYPE=LABEL FORM=ID:demo ATTR=TXT:Address
TAG POS=1 TYPE=LABEL FORM=ID:demo ATTR=TXT:*{{!COL1}}*
WAIT SECONDS=6

'TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:address CONTENT=address_input
TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:* CONTENT=address_input
TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:* CONTENT=city_input
TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:* CONTENT=zip_input
... => with '{{!COL1}}' instead of '{{!CLIPBOARD}}', if, like I expect, iMacros would refetch every Second the Content of '!COL1' from the DataSource 300 times until a Match is found... If '!COL1' is only fetched once, then the Method with the Script already running and waiting for 300 sec wouldn't work and the mini-TEMP File would first need to be saved before launching the Macro... (I didn't test...)

Some other Method/Workaround that would be a bit less cumbersome, would be to simply have the Script expect the User to type some "unique" String like "zzz" for example in the Input Field they would want the Script to start from with the Focus and the Script would wait for 300 sec until this "zzz" is found somewhere, to then using Double Relative Positioning, first on the Label, and then back on the Input Field to fill in the 3 Input Fields. :idea:
But again, I find @iimfun's Solution more "straightforward"... 8)

(And I'll make sure to bookmark this Thread, ah-ah...! As I finally know exactly now how '!CLIPBOARD' works on CR, and this Syntax/Trick can be very useful for passing a Var back from an 'URL GOTO=javascript:' Statement to the '.iim' Script... 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: 6474
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: Getting the Textfield with Focus

by iimfun on Mon Sep 25, 2017 11:08 pm

chivracq wrote:CR updated itself silently from CR60 to CR61, without asking me anything, grrr..., I don't like that...! :shock: )

Just install some portable version of Chrome and don't care about that!
iimfun
 
Posts: 238
Joined: Tue Jul 19, 2016 6:06 am

Re: Getting the Textfield with Focus

by chivracq on Tue Sep 26, 2017 11:34 am

iimfun wrote:
chivracq wrote:CR updated itself silently from CR60 to CR61, without asking me anything, grrr..., I don't like that...! :shock: )

Just install some portable version of Chrome and don't care about that!

Well, yep you're right..., but hum..., I will only maintain a CR Environment for Forum Cases that will be only specific to CR and iMacros for CR, then I can better keep an Env. reflecting the same FCI with the same Versions like most Users on CR...
- (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: 6474
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)


Return to iMacros for Chrome

Who is online

Users browsing this forum: No registered users and 2 guests

-->