Read Data and Automatically Clipboard it.

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
xzerocool
Posts: 4
Joined: Sun Feb 03, 2019 9:01 am

Read Data and Automatically Clipboard it.

Post by xzerocool » Sun Feb 03, 2019 9:21 am

Hello,
I'm a newbie user here on iMacros for Chrome and quite honestly I'm impressed.
So I was trying to create a macro for gamex.ph/epins/game/gamedetail.do?goods ... isp_seq=30
to buy me many ePins as possible, I'm trying to read a data from my phone connected to this website mightytext.net and copy paste the "LATEST PIN" I received.
How can I do it automatically?
Image

My First .iim for GameX is

Code: Select all

URL GOTO=https://www.gamex.ph/epins/game/gamedetail.do?goods_seq=G00000000209&goods_disp_seq=30
TAG POS=1 TYPE=SELECT ATTR=ID:choice_pin_denomination CONTENT=%100000004319
TAG POS=1 TYPE=A ATTR=TXT:BUY
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:msisdn CONTENT=(MyCellphoneNumber)
TAG POS=1 TYPE=INPUT:SUBMIT ATTR=ID:btnProceed
Then After Receiving The Confirmation Pin (Like an OTP) I would put it to the text field
then next is the retrieval of ePins.

Code: Select all

 VERSION BUILD=1005 RECORDER=CR
SET !EXTRACT_TEST_POPUP NO
SET !EXTRACT NULL
TAG POS=1 TYPE=INPUT:SUBMIT ATTR=ID:btnConfirmPin
TAG POS=1 TYPE=A ATTR=ID:btnShowPIN
TAG POS=1 TYPE=UL ATTR=ID:chargingDescUL Extract=Txt
 SET !CLIPBOARD {{!EXTRACT}}
chivracq
Posts: 8792
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Read Data and Automatically Clipboard it.

Post by chivracq » Sun Feb 03, 2019 5:48 pm

xzerocool wrote:
Sun Feb 03, 2019 9:21 am
Hello,
I'm a newbie user here on iMacros for Chrome and quite honestly I'm impressed.
So I was trying to create a macro for gamex.ph/epins/game/gamedetail.do?goods ... isp_seq=30
to buy me many ePins as possible, I'm trying to read a data from my phone connected to this website mightytext.net and copy paste the "LATEST PIN" I received.
How can I do it automatically?
Image

My First .iim for GameX is

Code: Select all

URL GOTO=https://www.gamex.ph/epins/game/gamedetail.do?goods_seq=G00000000209&goods_disp_seq=30
TAG POS=1 TYPE=SELECT ATTR=ID:choice_pin_denomination CONTENT=%100000004319
TAG POS=1 TYPE=A ATTR=TXT:BUY
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:msisdn CONTENT=(MyCellphoneNumber)
TAG POS=1 TYPE=INPUT:SUBMIT ATTR=ID:btnProceed
Then After Receiving The Confirmation Pin (Like an OTP) I would put it to the text field
then next is the retrieval of ePins.

Code: Select all

 VERSION BUILD=1005 RECORDER=CR
SET !EXTRACT_TEST_POPUP NO
SET !EXTRACT NULL
TAG POS=1 TYPE=INPUT:SUBMIT ATTR=ID:btnConfirmPin
TAG POS=1 TYPE=A ATTR=ID:btnShowPIN
TAG POS=1 TYPE=UL ATTR=ID:chargingDescUL Extract=Txt
 SET !CLIPBOARD {{!EXTRACT}}
FCIM...! :mrgreen: (Read my Sig...)
=> iMacros for CR v10.0.5, 'Free'/PE'...?, CR71/72...?, OS...?

"Correct" Sub-Forum for opening this Thread should have been the 'General' Sub-Forum..., even if your "Case" might have stg specific to CR, but you don't know that yet...

And when uploading Screenshots to your Thread, you can better upload the Pictures directly to the Forum rather than using some external Pix Hosting Server as all those Sites one day go commercial or stop to exist or clean up their Data from time to time and the Threads on the Forum become a bit "useless" with only empty Image Containers...

But OK, then what is the Pb exactly...?

You extract your PIN from this Line if I understand correctly:

Code: Select all

TAG POS=1 TYPE=UL ATTR=ID:chargingDescUL Extract=Txt
SET !CLIPBOARD {{!EXTRACT}}
... and then put into your OS Clipboard... to later paste it somewhere else... OK...

But hum, I "suspect" the Extract will then contain more Data than just the PIN that you want to keep...
=> You then need to use 'EVAL()' + 'split()' (x2) to keep only that PIN...

Then the "SET !CLIPBOARD..." is a way, but "normally" meant if you want to paste that Clipboard Content to some "other" Application or Site, outside of iMacros.
From iMacros, you can still paste that Content using the '{{!CLIPBOARD}}' Var, except that this Functionality (for the Paste) is not supported on CR. (Documented in the Wiki...)
But you can then use any of the '!VAR[1-3]' if you are using the 'Free' Version, instead of '!CLIPBOARD', or any User Defined Var if you are using the 'PE' Version after the "Cleaning" with 'EVAL()' to paste that PIN where you want in your Input Field with some "CONTENT={{!VAR1}}".

>>>

Hum, interesting Site/App this 'mightytext' Site and App for Desktop + Web, for syncing + receiving/sending SMS's, I'm giving it a try... :D
I already use 'Telegram' and 'Whatsapp' for Desktop, but 'WA' is not very well designed and not very usable for me as it always requires the Smartphone to be connected (through Wifi), 'Telegram' works better for me...
- (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...
chivracq
Posts: 8792
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Read Data and Automatically Clipboard it.

Post by chivracq » Sun Feb 03, 2019 6:42 pm

Hum..., and maybe "easier" for you in this "Case", instead of using 'split()' x2 in the 'EVAL()' like I mentioned in my first Reply, you could also use 'slice()', 'substr()' or 'substring()', as I reckon, both the "Your PIN is " String and the PIN itself will always have the same Length, ie 12 Chars for the first part, and 5 Chars/Numbers for the PIN... :idea:
- (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...
xzerocool
Posts: 4
Joined: Sun Feb 03, 2019 9:01 am

Re: Read Data and Automatically Clipboard it.

Post by xzerocool » Mon Feb 04, 2019 12:08 am

I'm using Free Version of iMacros 10.0.5 for Chrome 71.0.3578.98
Windows 10 Pro
VERSION BUILD=1005 RECORDER=CR

I'm very sorry if I put this topic onto an wrong sub forum.

My problem is how can I get the latest PIN from mightytext and automatically clipboard it.

This code is used to get the "ePins" not the Text Pin

Code: Select all

TAG POS=1 TYPE=UL ATTR=ID:chargingDescUL Extract=Txt
SET !CLIPBOARD {{!EXTRACT}}
I need the code to automatically get the PIN and clipboard it, thanks also for the reply.
Btw Here's a Screenshot of span class of the mighttytext, sorry for yet again uploading onto Pix Website the attachment file says its invalid.
Image
chivracq
Posts: 8792
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Read Data and Automatically Clipboard it.

Post by chivracq » Mon Feb 04, 2019 12:33 am

xzerocool wrote:
Mon Feb 04, 2019 12:08 am
I'm using

Code: Select all

Free Version of iMacros 10.0.5 for Chrome 71.0.3578.98
Windows 10 Pro
VERSION BUILD=1005 RECORDER=CR
I'm very sorry if I put this topic onto an wrong sub forum.

My problem is how can I get the latest PIN from mightytext and automatically clipboard it.

This code is used to get the "ePins" not the Text Pin

Code: Select all

TAG POS=1 TYPE=UL ATTR=ID:chargingDescUL Extract=Txt
SET !CLIPBOARD {{!EXTRACT}}
I need the code to automatically get the PIN and clipboard it, thanks also for the reply.
Btw Here's a Screenshot of span class of the mighttytext, sorry for yet again uploading onto Pix Website the attachment file says its invalid.
Image
OK, perfect for your FCI... :D
And don't worry about the "correct" Sub-Forum, your Thread is actually a little bit specific to CR, because of the Limitation with '{{!CLIPBOARD}}' which is not supported on CR... :oops:

Hum, your Screenshot is again hosted on 'imgur', it's "better" if you can upload your Screenshots directly to the Forum instead of using some external Hosting Site as those Screenshots will one day disappear...
Hum, and Source Content as a Screenshot is never really "practical" as I need to retype everything if I want to give you an Example, which I don't do, you can better post that Source Content as plain Text in your Thread...

But then, yep, simply extract that 'SPAN' Element with stg like:

Code: Select all

TAG POS=1 TYPE=SPAN ATTR=CLASS:"The_Class_Name_from_your_Source_that_I_refuse_to_type_again_even_if_that_Sentence_is_much_longer_ah_ah...!" EXTRACT=TXT
You might need to adjust the 'POS=1' to the correct Number if you have several SMS's on the same Page, then you could use 'Relative Positioning' with "POS=R-1" using some HTML Element at the Bottom of the Page as 'Anchor' (like one of the 'Photo'/'Smiley'/'GIF'/'Clock' 4 Icons I see on your Screenshot), and I guess once you've managed to tag (and extract) the "correct" Element, that the following 'EVAL()' will do the job...:

Code: Select all

SET !VAR1 EVAL("var s='{{!EXTRACT}}'; var x,y,z; z=s.substr(12,5); z;")
PROMPT EXTRACT:<BR>_{{!EXTRACT}}_<BR><BR>VAR1_PIN:<SP>_{{!VAR1}}_
And '!VAR1' should contain your PIN that you can later paste where you want with 'CONTENT={{!VAR1}}'. 8)
- (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...
xzerocool
Posts: 4
Joined: Sun Feb 03, 2019 9:01 am

Re: Read Data and Automatically Clipboard it.

Post by xzerocool » Mon Feb 04, 2019 2:56 am

chivracq wrote:
Mon Feb 04, 2019 12:33 am
xzerocool wrote:
Mon Feb 04, 2019 12:08 am
I'm using

Code: Select all

Free Version of iMacros 10.0.5 for Chrome 71.0.3578.98
Windows 10 Pro
VERSION BUILD=1005 RECORDER=CR
I'm very sorry if I put this topic onto an wrong sub forum.

My problem is how can I get the latest PIN from mightytext and automatically clipboard it.

This code is used to get the "ePins" not the Text Pin

Code: Select all

TAG POS=1 TYPE=UL ATTR=ID:chargingDescUL Extract=Txt
SET !CLIPBOARD {{!EXTRACT}}
I need the code to automatically get the PIN and clipboard it, thanks also for the reply.
Btw Here's a Screenshot of span class of the mighttytext, sorry for yet again uploading onto Pix Website the attachment file says its invalid.
Image
OK, perfect for your FCI... :D
And don't worry about the "correct" Sub-Forum, your Thread is actually a little bit specific to CR, because of the Limitation with '{{!CLIPBOARD}}' which is not supported on CR... :oops:

Hum, your Screenshot is again hosted on 'imgur', it's "better" if you can upload your Screenshots directly to the Forum instead of using some external Hosting Site as those Screenshots will one day disappear...
Hum, and Source Content as a Screenshot is never really "practical" as I need to retype everything if I want to give you an Example, which I don't do, you can better post that Source Content as plain Text in your Thread...

But then, yep, simply extract that 'SPAN' Element with stg like:

Code: Select all

TAG POS=1 TYPE=SPAN ATTR=CLASS:"The_Class_Name_from_your_Source_that_I_refuse_to_type_again_even_if_that_Sentence_is_much_longer_ah_ah...!" EXTRACT=TXT
You might need to adjust the 'POS=1' to the correct Number if you have several SMS's on the same Page, then you could use 'Relative Positioning' with "POS=R-1" using some HTML Element at the Bottom of the Page as 'Anchor' (like one of the 'Photo'/'Smiley'/'GIF'/'Clock' 4 Icons I see on your Screenshot), and I guess once you've managed to tag (and extract) the "correct" Element, that the following 'EVAL()' will do the job...:

Code: Select all

SET !VAR1 EVAL("var s='{{!EXTRACT}}'; var x,y,z; z=s.substr(12,5); z;")
PROMPT EXTRACT:<BR>_{{!EXTRACT}}_<BR><BR>VAR1_PIN:<SP>_{{!VAR1}}_
And '!VAR1' should contain your PIN that you can later paste where you want with 'CONTENT={{!VAR1}}'. 8)
Wow thank you for your replies, I think I'm getting close. I'm really sorry about the screenshots stuff.
Now I can extract the message, Thank you so much this made my work really light.
I used the code

Code: Select all

 TAG POS=15 TYPE=SPAN ATTR=CLASS:"message-body" EXTRACT=TXT 
Nevermind the TAG = R-1 as the Page limit itself on 15 SMS's making POS Absolute.
The last question is how can I put <br> on the {{!EXTRACT}} clipboard?
Just to make the Copied Text more neat.
The Extracted Data is Like this
20 : Garena ShellsPassword : (Password)Card Number : (Card Number)
I want it to automatically become like this that automatically break the line.
20 : Garena Shells
Password : (Password)
Card Number : (Card Number)
chivracq
Posts: 8792
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Read Data and Automatically Clipboard it.

Post by chivracq » Mon Feb 04, 2019 1:02 pm

xzerocool wrote:
Mon Feb 04, 2019 2:56 am
Wow thank you for your replies, I think I'm getting close. I'm really sorry about the screenshots stuff.
Now I can extract the message, Thank you so much this made my work really light.
I used the code

Code: Select all

 TAG POS=15 TYPE=SPAN ATTR=CLASS:"message-body" EXTRACT=TXT 
Nevermind the TAG = R-1 as the Page limit itself on 15 SMS's making POS Absolute.

The last question is how can I put <br> on the {{!EXTRACT}} clipboard?
Just to make the Copied Text more neat.

The Extracted Data is Like this

Code: Select all

20 : Garena ShellsPassword : (Password)Card Number : (Card Number)
I want it to automatically become like this that automatically break the line.

Code: Select all

20 : Garena Shells
Password : (Password)
Card Number : (Card Number)
Ouf...!, you don't need to re-quote yourself, especially with large Screenshots, that doesn't really help for "Readability" of the Thread..., and you don't even "really" need to quote me, unless you were responding to a specific part of my Reply, or if several (Advanced) Users were participating in the Thread...
(I do quote systematically because some Users tend to completely delete/mutilate their Posts once they've got their Answer and their Script working, or keep editing their Post(s) as they "progress", which renders such Threads impossible/difficult to follow for other Users...)

Yeah well, for your next Qt, simply use 'replace()' in 'EVAL()' to add the '<BR>' part, stg like:

Code: Select all

SET !EXTRACT "20 : Garena ShellsPassword : (Password)Card Number : (Card Number)"
SET !VAR2 EVAL("var s='{{!EXTRACT}}'; var x,y,z; x=s.replace('Password :','<BR>Password :'); z=x.replace('Card ','<BR>Card '); z;")
PROMPT EXTRACT:<BR>_{{!EXTRACT}}_<BR><BR>VAR2:<BR>_{{!VAR2}}_
And..., yep, it works directly...! 8)
Oh...!, but hum, I think I had noticed that v10.0.5 for CR doesn't interpret the '<BR>' Tag correctly in the 'PROMPT', but this is the Output I get in the 'PROMPT', and it should work the same I reckon if you paste that Content in some multiline Input Field:

Code: Select all

EXTRACT:
_20 : Garena ShellsPassword : (Password)Card Number : (Card Number)_

VAR2:
_20 : Garena Shells
Password : (Password)
Card Number : (Card Number)_
(Tested on iMacros for FF v8.8.2, Pale Moon v26.3.3 (=FF47), Win10_x64.)
- (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...
Post Reply