I am working on a imacro script and i am just stuck with it and can't figure out what i am doing wrong.
It is a macro thát visits a certain forum part and it needs to click 2 links.
They are almost identical except for 1 part.
It is used to download attachments.
Code i got at the moment:
TAG POS=1 TYPE=A ATTR=ID:aid* EXTRACT=href
tab open
tab t=2
url goto={{!EXTRACT}}
TAB CLOSE
TAG POS=2 TYPE=A ATTR=ID:aid* EXTRACT=href
tab open
tab t=2
url goto={{!EXTRACT}}
I also tried it like this:
TAG POS=1 TYPE=A ATTR=HREF:*linkhere*/forum.php?mod=attachment&aid=* EXTRACT=href
tab open
tab t=2
url goto={{!EXTRACT}}
SET !EXTRACT NULL
TAB CLOSE
TAG POS=2 TYPE=A ATTR=TXT:*.pdf EXTRACT=HREF
SET link EVAL("'{{!EXTRACT}}'.match(/(http.*)\./)[1];")
URL GOTO={{link}}
but still no luck.
As you see 1 file is a image, but the 2nd file can be a pdf or zip/rar file.
Most of them are pdf tough.
Hopefully can point me in the right direction with this as i got no clue anymore...
Why don't you simply save the files directly?
Do you need to open them in a different tab?
TAG POS=1 TYPE=IMG ATTR=HREF:http://*.jpg CONTENT=EVENT:SAVEITEM
TAG XPATH="/html/body/div[1]/form/div[3]/div/h2/span[2]/a[1]" CONTENT=EVENT:SAVETARGETAS
or something like that depending on what you have there.
I prefer to refer items by XPATH, but that's just me
Related
I'm using the last version of iMacro and of Firefox.
I'm trying to run it so it downloads a .csv into a specific folder on a different drive that's on the network which it does have access to, the machine that is.
However, every time I see to download it, it does it in the default folder.
Now I did change the download folder but, since I need iMacro to also rename it it just won't cut it exactly.
Here's the code. Now I know I inserted a comment in there, I was playing around to make it work.
Thank you.
VERSION BUILD=8890130 RECORDER=FX
TAB T=1
URL GOTO=WEBSITE
FRAME F=1
TAG POS=1 TYPE=INPUT:TEXT ATTR=NAME:username CONTENT=USERNAME
SET !ENCRYPTION NO
TAG POS=1 TYPE=INPUT:PASSWORD ATTR=NAME:password CONTENT=PASSWORD
TAG POS=1 TYPE=BUTTON ATTR=TXT:LOG<SP>IN
URL GOTO=WEBSITE
WAIT SECONDS=15
TAG POS=1 TYPE=DIV ATTR=ID:ext-gen1194
TAG POS=1 TYPE=A ATTR=TXT:Today
TAG POS=1 TYPE=SPAN ATTR=ID:button-1030-btnInnerEl
WAIT SECONDS=10
ONDOWNLOAD FOLDER=* FILE=+_{{!NOW:yyyymmdd}}.csv WAIT=YES
'ONDOWNLOAD FOLDER="\\\\DifferentServer\\path\\path\\path\\path\\path\\" FILE=+{{!NOW:yyyymmdd}}.csv WAIT=YES
WAIT SECONDS=10
TAG POS=1 TYPE=SPAN ATTR=ID:button-1055-btnIconEl
WAIT SECONDS=10
TAB CLOSEALLOTHERS
TAB T=1
TAB CLOSE
VERSION BUILD=6060703 RECORDER=CR
URL GOTO=URL
TAG POS=1 TYPE=INPUT:BUTTON ATTR=*
WAIT SECONDS=6
This is the code I'm using for .iim file to click on a button on a website. But I couldn't understand what this code is and what are those tag pos and button attr. When I run this code there's an error like this.
RuntimeError: element INPUT specified by * was not found, line: 3
What is this error and how to tackle it. Please help.
TAG POS=1 TYPE=INPUT:BUTTON ATTR=*
This is a button that submits something. Find that button on web page. Right click on it and select "Inspect Element". Then you will see HTML code of that button.
If it has property name="somename" or id="someid" then you will put
TAG POS=1 TYPE=INPUT:BUTTON ATTR=NAME:somename
TAG POS=1 TYPE=INPUT:BUTTON ATTR=ID:someid
I have been trying to resolve this issue through different angles but not having any luck. Even tried using PHP to generate iMacro code to do this but really no luck.
Basically I am trying to use iMacro to pull some form data but the problem is on every page of the form I have 100 links to click but the issue is that I don't know how to tell iMacro to keep clicking the links in the table without specifying each link's name in the attribute:
TAG POS=1 TYPE=A FORM=NAME:win0 ATTR=TXT:Trip<SP>to<SP>China
TAG POS=1 TYPE=A FORM=NAME:win0 ATTR=TXT:Trip<SP>to<SP>Mexico
TAG POS=1 TYPE=A FORM=NAME:win0 ATTR=TXT:Trip<SP>to<SP>Japan
TAG POS=1 TYPE=A FORM=NAME:win0 ATTR=TXT:Trip<SP>to<SP>Brazil
See how the ATTR=TXT field indicates the text of the element in the table? This means to get iMacro to click all the links I have to specify every element's text....This is a pain..Is there a way I can get iMacro to click on the links without specifying the text?
UPDATE: Here is the updated code that highlights but won't click the first link.
FRAME NAME=TargetContent
TAG POS={{!LOOP}} TYPE=A FORM=NAME:win0 ATTR=TXT:*
'New tab opened
TAB T=2
TAG POS={{!LOOP}} TYPE=DIV ATTR=ID:win2divUW_CO_JOBDTL_VW_UW_CO_JOB_DESCR EXTRACT=TXT
TAB CLOSE
SAVEAS TYPE=EXTRACT FOLDER=C:\Users\Documents\iMacro FILE=TestRun.csv
Here is what the HTML of the first link in table looks like, it is all generated by the server:
<a name="UW_CO_sd_HL$0" id="UW_CO_sd_HL$0" tabindex="72" href="javascript:hAction_win0(document.win0,'UW_CO_sd_HL$0', 0, 0, 'Trip To Tokyo', false, true);" class="PSHYPERLINK">Tokyo</a>
The second HTML link in table looks like:
<a name="UW_CO_sd_HL$1" id="UW_CO_sd_HL$0" tabindex="78" href="javascript:hAction_win0(document.win0,'UW_CO_sd_HL$1', 0, 0, 'Tonka Side', false, true);" class="PSHYPERLINK">Tonka</a>
UPDATE 2:
Here is the iMacro code after I do experimental recording and then x/y co-ordinate click. The code is from clicking the first couple of elements.
CLICK X=131 Y=473
TAB T=2
TAB CLOSE
TAB T=1
CLICK X=153 Y=500
TAB T=2
TAB CLOSE
TAB T=1
CLICK X=194 Y=541
TAB T=2
TAB CLOSE
TAB T=1
CLICK X=152 Y=572
TAB T=2
TAB CLOSE
TAB T=1
CLICK X=149 Y=608
TAB T=2
TAB CLOSE
TAB T=1
CLICK X=169 Y=629
TAB T=2
TAB CLOSE
TAB T=1
CLICK X=173 Y=666
TAB T=2
TAB CLOSE
TAB T=1
This code can be transformed to work better.
TAG POS={{!LOOP}} TYPE=A FORM=NAME:win0 ATTR=TXT:Trip<SP>to<SP>*
For example if the links HTML looks like this
Trip to Somewhere
Then you can use these combinations of iMacros code to click the links.
TAG POS={{!LOOP}} TYPE=A FORM=NAME:win0 ATTR=CLASS:link&&TXT:*
TAG POS={{!LOOP}} TYPE=A FORM=NAME:win0 ATTR=ID:linkid&&TXT:*
TAG POS={{!LOOP}} TYPE=A FORM=NAME:win0 ATTR=HREF:www.somelink.com/soomething_different_here/*&&TXT:*
Each of these combinations can work.
Im getting the following error with imacros
URL GOTO=http://www.tblog.com/blog_admin/addpost.php?view=full
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:post_form ATTR=NAME:ititle CONTENT={{!VAR1}}
TAG POS=1 TYPE=IMG ATTR=ID:mce_editor_0_code
TAB T=2
FRAME F=0
TAG POS=1 TYPE=TEXTAREA FORM=NAME:source ATTR=ID:htmlSource CONTENT={{!VAR8}}
TAG POS=1 TYPE=INPUT:BUTTON FORM=NAME:source ATTR=ID:insert
TAG POS=1 TYPE=INPUT:SUBMIT FORM=NAME:post_form ATTR=NAME:publish&&VALUE:Publish<SP>This<SP>Post!
TypeError: can't access dead object, line: 9 (Error code: -1001)
If somebody can help here are some logging details
account:lugartecnologico52
paswword:1234
The site is tblog.com
We need to open a blank tab to address this error.
steps to follow
Open a tab
Add these commands
Tab T=2
Tab T=1
Run the macro
Let me know in case of any queries
This line was working before but now it doesn't extract the text, I guess this is happening because it is clicking inside the box. This only happen when I use Firefox, using Internet Explorer is ok.
VERSION BUILD=8021970
TAB T=1
TAB CLOSEALLOTHERS
URL GOTO=http://www.fakemailgenerator.com/
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:emailForm ATTR=ID:fName&&VALUE:* EXTRACT=TXT
it looks like the value you need is disappear when imacros tries to scrape it, but you can use this code to get email:
URL GOTO=http://www.fakemailgenerator.com/
TAG POS=1 TYPE=span attr=id:cxtEmail EXTRACT=TXT
or you can scrape htm of your tag and parse it to get value attribute