EXTRACT, EVAL, EVENT Help

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
JonaSenpai
Posts: 2
Joined: Thu Jul 25, 2019 4:23 pm

EXTRACT, EVAL, EVENT Help

Post by JonaSenpai » Thu Jul 25, 2019 4:47 pm

Basically I have a job at a college that involves editing user's registration so that the system can recognize them. I need multiple scripts but I simply don't know how to program at all so.. I'm going to show you what I go so far and then you guys could maybe help me? I have literally zero programming knowledge.

1) The problem with this code is that, besides IMacros, I'm running a system-wide macro also that copys Student IDs from CSV file and I attempt to run this script to paste what I copy into the text box so it can search what I copied. Only thing is, it clicks and highlights the textbox correctly but it doesn't actually paste anything I copied. I need help on this or correct/improve anything to make me actually paste what i have from different application. (P.S I'm aware IMacros can pull data from CSV files but that's simply too complicated for me to understand :cry: )

Code: Select all

VERSION BUILD=1005 RECORDER=CR
TAG POS=1 TYPE=SELECT FORM=ID:aspnetForm ATTR=ID:ctl00_gc_ucStudentSearch1_ddSearchFor CONTENT=%1
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_gc_ucStudentSearch1_txtKeyWord CONTENT={{!CLIPBOARD}}
EVENT TYPE=KEYPRESS SELECTOR="ctl00_gc_ucStudentSearch1_txtKeyWord" CHAR="v" MODIFIERS="ctrl"
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:aspnetForm ATTR=ID:ctl00_gc_ucStudentSearch1_searchSt
TAG POS=1 TYPE=TABLE ATTR=ID:stSearchGrid
TAG POS=1 TYPE=TD ATTR=TXT:Student
2) This code is my trash attempt at putting a default address, putting the student's gender to male, grabbing the student's default username that is already present in the text box, adding a value to that username so it don't result in a duplicate profile and pasting it back into the username text box. The problem here is that some students have proper usernames while most don't. Basically I want to use the EVAL code so it can detect the following username "a@a.com" then add numbers to that username so it always result in a non-duplicate profile like "a@a.com10984", "a@a.com109837", so on and so on.

Code: Select all

VERSION BUILD=1005 RECORDER=CR
TAG POS=1 TYPE=INPUT:CHECKBOX FORM=ID:aspnetForm ATTR=ID:ctl00_gc_ucStudentProfile1_chkOptEmail CONTENT=YES
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_gc_ucStudentProfile1_txtAddr1 CONTENT=560<SP>Exterior<SP>St
TAG POS=1 TYPE=SELECT FORM=ID:aspnetForm ATTR=ID:ctl00_gc_ucStudentProfile1_drpGender_drpDropDownControl CONTENT=%2
TAG POS=1 TYPE=INPUT:CHECKBOX FORM=ID:aspnetForm ATTR=ID:ctl00_gc_ucStudentProfile1_chkOptPostal CONTENT=YES
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_gc_ucStudentProfile1_txtUsername EXTRACT=TXT
SET !EXTRACT NULL 
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_gc_ucStudentProfile1_txtUsername EXTRACT=TXT
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_gc_ucStudentProfile1_txtUsername CONTENT={{!EXTRACT}}1234
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:aspnetForm ATTR=ID:ctl00_gc_ucStudentProfile1_btnSave
I don't know how you guys could test this, I can't give website because lack of authorization to even see these elements but.. I'm sure you can see the ATTR of which I'm actually trying to click on and make changes to.
chivracq
Posts: 8790
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: EXTRACT, EVAL, EVENT Help

Post by chivracq » Thu Jul 25, 2019 5:53 pm

JonaSenpai wrote:
Thu Jul 25, 2019 4:47 pm
Basically I have a job at a college that involves editing user's registration so that the system can recognize them. I need multiple scripts but I simply don't know how to program at all so.. I'm going to show you what I go so far and then you guys could maybe help me? I have literally zero programming knowledge.

1) The problem with this code is that, besides IMacros, I'm running a system-wide macro also that copys Student IDs from CSV file and I attempt to run this script to paste what I copy into the text box so it can search what I copied. Only thing is, it clicks and highlights the textbox correctly but it doesn't actually paste anything I copied. I need help on this or correct/improve anything to make me actually paste what i have from different application. (P.S I'm aware IMacros can pull data from CSV files but that's simply too complicated for me to understand :cry: )

Code: Select all

VERSION BUILD=1005 RECORDER=CR
TAG POS=1 TYPE=SELECT FORM=ID:aspnetForm ATTR=ID:ctl00_gc_ucStudentSearch1_ddSearchFor CONTENT=%1
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_gc_ucStudentSearch1_txtKeyWord CONTENT={{!CLIPBOARD}}
EVENT TYPE=KEYPRESS SELECTOR="ctl00_gc_ucStudentSearch1_txtKeyWord" CHAR="v" MODIFIERS="ctrl"
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:aspnetForm ATTR=ID:ctl00_gc_ucStudentSearch1_searchSt
TAG POS=1 TYPE=TABLE ATTR=ID:stSearchGrid
TAG POS=1 TYPE=TD ATTR=TXT:Student
2) This code is my trash attempt at putting a default address, putting the student's gender to male, grabbing the student's default username that is already present in the text box, adding a value to that username so it don't result in a duplicate profile and pasting it back into the username text box. The problem here is that some students have proper usernames while most don't. Basically I want to use the EVAL code so it can detect the following username "a@a.com" then add numbers to that username so it always result in a non-duplicate profile like "a@a.com10984", "a@a.com109837", so on and so on.

Code: Select all

VERSION BUILD=1005 RECORDER=CR
TAG POS=1 TYPE=INPUT:CHECKBOX FORM=ID:aspnetForm ATTR=ID:ctl00_gc_ucStudentProfile1_chkOptEmail CONTENT=YES
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_gc_ucStudentProfile1_txtAddr1 CONTENT=560<SP>Exterior<SP>St
TAG POS=1 TYPE=SELECT FORM=ID:aspnetForm ATTR=ID:ctl00_gc_ucStudentProfile1_drpGender_drpDropDownControl CONTENT=%2
TAG POS=1 TYPE=INPUT:CHECKBOX FORM=ID:aspnetForm ATTR=ID:ctl00_gc_ucStudentProfile1_chkOptPostal CONTENT=YES
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_gc_ucStudentProfile1_txtUsername EXTRACT=TXT
SET !EXTRACT NULL 
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_gc_ucStudentProfile1_txtUsername EXTRACT=TXT
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_gc_ucStudentProfile1_txtUsername CONTENT={{!EXTRACT}}1234
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:aspnetForm ATTR=ID:ctl00_gc_ucStudentProfile1_btnSave
I don't know how you guys could test this, I can't give website because lack of authorization to even see these elements but.. I'm sure you can see the ATTR of which I'm actually trying to click on and make changes to.

FCIM...! :mrgreen: (Read my Sig...)
=> iMacros for CR v10.0.5, 'Free'/'PE'...?/ CR75...?, OS...?


1- Well, several Things are playing and you are getting a bit caught in a "Chicken and Egg" Situation, but pasting Content from the OS Clipboard is "basically" not supported in iMacros for CR.
The 1st Method you are trying with '{{!CLIPBOARD}}' is not supported in iMacros for CR. (Documented in the Wiki...)
And the 2nd where using the 'EVENT' Mode, you "cleverly" try to do a 'Ctrl^v' ('Paste') requires the 'MODIFIERS' Parameter which I think is only supported in iMacros for FF (until v8.9.7 and v9.0.3, as the 'EVENT' Mode is not implemented at all in v10.0.2 for FF).
So you are a bit stuck here...!

Workaround(s) would be if you can switch Browsers to use FF (FF67/68 at the moment), then '{{!CLIPBOARD}}' should work in v10.0.2 for FF.
And if you can "go back' to an older Version of FF, then you could use iMacros for FF v8.9.7 (works fine on FF v55.0.3) which is fully functional and for which both Methods would work.

And pulling your Data directly from the '.CSV' is indeed like you mention another Way..., and it's not that complicated... But...!, not mentioned in your FCI, you will need the 'PE' Version to do that. The 'FIO'-Module needed for Local File Access needed for that Functionality is not included in the 'Free' Version.

Another "Workaround" also would be, if from the 1st Process that generates the Data, if you could save the Data you want to have on the Clipboard to some mini-Temp '.TXT' File, then it's possible to open that '.TXT' File directly in the Browser (in a 2nd Tab maybe) and to extract it's Content using the 'EXTRACT' Mechanism.

And another one would be if you open your '.CSV' once from Excel/OO/LO, to re-save that File as '.HTML', that you can then treat like a "standard" '.HTML' File/Page and also open directly from your Browser and from iMacros thus...


2- Hum, your Script looks OK to me with the following part:

Code: Select all

SET !EXTRACT NULL 
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_gc_ucStudentProfile1_txtUsername EXTRACT=TXT
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_gc_ucStudentProfile1_txtUsername CONTENT={{!EXTRACT}}1234
Check with a "PROMPT _{{!EXTRACT}}_" that the Extract is "clean" and doesn't contain any Space/Tab/Return, ... that you would then first need to "clean" using 'EVAL()'.
- (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...
JonaSenpai
Posts: 2
Joined: Thu Jul 25, 2019 4:23 pm

Re: EXTRACT, EVAL, EVENT Help

Post by JonaSenpai » Mon Jul 29, 2019 2:36 pm

Thank you for getting back to me so quickly. I just tried a few of the things you stated. I'm running Windows 10 version 1709, iMacros Free Chrome Extension, On Chrome Browser Version 75.0.3770.142 (Official Build) (64-bit).

Like I stated though you can't even access the website because its a few ASPX pages. Even if I give it, you simply just can't go on to try it what I'm talking about. I definitely wasn't aware the browsers had different functionality. The sad thing is, I don't have admin privileges in my work facility but I was hoping to automate most of my work to impress a few higher ups.

Since I can't pull from CSV file with out some commands then that's a no-go. I attempted the 2nd workaround to where I converted my CSV file into a txt file but.. a problem popped up into where I couldn't even copy and paste line by line. I don't know what should I do to automate data extraction per line in the txt file on the 2nd tab.

I did the same with the HTML file. Searched around for a few days, tried some things, I have zero idea how to grab data from one line, paste it, finish rest of data automation, and then go to the next line to repeat; probably a combination of FF Clipboard, and HTML- CSV would do the trick? I'm not sure but I'll edit this if I find solution.
chivracq
Posts: 8790
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: EXTRACT, EVAL, EVENT Help

Post by chivracq » Mon Jul 29, 2019 4:02 pm

JonaSenpai wrote:
Mon Jul 29, 2019 2:36 pm
Thank you for getting back to me so quickly. I just tried a few of the things you stated. I'm running

Code: Select all

Windows 10 version 1709, iMacros Free Chrome Extension, On Chrome Browser Version 75.0.3770.142 (Official Build) (64-bit). 
Like I stated though you can't even access the website because its a few ASPX pages. Even if I give it, you simply just can't go on to try it what I'm talking about. I definitely wasn't aware the browsers had different functionality. The sad thing is, I don't have admin privileges in my work facility but I was hoping to automate most of my work to impress a few higher ups.

Since I can't pull from CSV file with out some commands then that's a no-go. I attempted the 2nd workaround to where I converted my CSV file into a txt file but.. a problem popped up into where I couldn't even copy and paste line by line. I don't know what should I do to automate data extraction per line in the txt file on the 2nd tab.

I did the same with the HTML file. Searched around for a few days, tried some things, I have zero idea how to grab data from one line, paste it, finish rest of data automation, and then go to the next line to repeat; probably a combination of FF Clipboard, and HTML- CSV would do the trick? I'm not sure but I'll edit this if I find solution.
OK for your FCI... :D

Hum, and "try" not to edit "too much" your previous Posts as you "progress", you can better post an Update in a separate Post, this is one of the Reasons I systematically quote, or other Users trying to "follow" this Thread will get "a bit lost"... :wink:

Well, "Admin Rights", if you can plug in a USB-Stick, you could use FF Portable... => Best FCI is FF v55.0.3 + iMacros for FF v8.9.7.
Or upload first the whole Folder with FF Portable completely setup already (=> with iMacros and all other Add-ons you want to use), zipped, to some shared Drive on Internet from where you could download and copy it locally to your Work-PC... (And you can zip it with a Password + change the Extension to '.TXT' to bypass any "Virus Detection" / 'Group Policy' on '.EXE'/'.ZIP' etc...)
But FF v55.0.3 is maybe already a bit old now, iMacros v8.9.7 for FF also works on Pale Moon => PM28 is up to date and also has a Portable Version.

Concerning the '.TXT' Workaround, you may need to add an extra Column at the complete Right End of your '.CSV' (from 'Excel') that would contain some kind of "Separator" (=> "##" for example) to be able to re-split the Content of the whole '.TXT' File into Rows.
Or you can use "###" to split between Rows and "##" to split between Cells (within) a Row.

But the "Convert the '.CSV' to '.HTML'" Workaround would be the easiest I would think. Then you can simply use the "Standard" iMacros 'EXTRACT' Mechanism to pull the Data that you need. And if you have several Cols in the original '.CSV', a mini-Trick is to first convert it to '.XLS'/'.XLSX'/'.ODS'/whatever..., then give all Cols a different Colour (or at least to the Col(s) you'll need) before converting it to '.HTML', and that Colour can be used as Attribute for the 'ATTR' Parameter for the 'TAG' Command to identify the correct Col/Cells.
- (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