How can i use a webbased file ie csv file like csv file link with the SET !DATASOURCE command in imacros,the reason is that i want to use the webbased file?
SET !DATASOURCE profile1.csv
SET !DATASOURCE_COLUMNS 4
SET !DATASOURCE_LINE {{!LOOOP}}
TAG POS=1 TYPE=INPUT:TEXT ATTR=CLASS:textbox1 CONTENT={{!COL0}}
TAG POS=1 TYPE=INPUT:TEXT ATTR=CLASS:textbox2 CONTENT={{!COL1}}
TAG POS=1 TYPE=INPUT:TEXT ATTR=CLASS:textbox3 CONTENT={{!COL2}}
TAG POS=1 TYPE=INPUT:TEXT ATTR=CLASS:textbox4 CONTENT={{!COL3}}
This example reads CSV file from Hard Drive placed in Datasource folder. As for webased file the only idea I have right now is if you had something like a sheet in the web browser window. From it iMacros can read the whole table and use those data . But without JS scripting it can't be done easily.
Make an iMacros code that downloads that file from a webserver to your hard drive/datasource folder.
Related
I am trying to use imacros to upload videos to let's say youtube.
Currently it looks like this -
VERSION BUILD=8961227
RECORDER=FX
TAB T=1
TAB CLOSEALLOTHERS
URL GOTO=youtube
UPLOAD URL TAG POS=1 TYPE=A ATTR=TXT:Upload<SP>new<SP>videos
TAG POS=1 TYPE=INPUT:FILE FORM=ID:upload_form_basic ATTR=ID:file_basic CONTENT=C:\Users\Administrator\Desktop\UPLOAD<SP>Test\({{!LOOP}}).mp4
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:video_keywords CONTENT=
TAG POS=1 TYPE=INPUT:CHECKBOX ATTR=ID:terms CONTENT=YES
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:upload_form_basic ATTR=ID:upload_submit
WAIT SECONDS=20
The problem i am facing here is -
I have let's say 50 videos saved in this folder with random names all .mp4 format.
I want imacros to wait stipulated time frame before it comes back to this loop and pick the NEXT file in the same folder. I am unable to do that.
Can anyone help me how should i make imacros pick the next file in the second loop. ?
Hi. Simply create a file list then use it in the loop.
Move createlist.bat on your video folder and run once.
#echo off
dir /b /s *.mp4 > %USERPROFILE%\Documents\iMacros\Datasources\list.txt
By the way it will create with all subdirectories (!) on your video folder. If you want non recursive way use it:
#echo off
del %USERPROFILE%\Documents\iMacros\Datasources\list.txt
for /f "usebackq TOKENS=*" %%i in (`dir /b *.mp4`) do (echo %%~fnxi) >> %USERPROFILE%\Documents\iMacros\Datasources\list.txt
Now use the list.txt as datasource. The list.txt has only 1 column. You can call each line using {{!COL1}}}. For more info Form Filling.
SET !DATASOURCE list.txt
SET !LOOP 1
SET !DATASOURCE_LINE {{!LOOP}}
'.....
'..... URL GOTO www.yoursite...
'..... Fill here according to your site
'.....
'.....
TAG POS=1 TYPE=INPUT:FILE FORM=ID:upload_form_basic ATTR=ID:file_basic CONTENT={{!COL1}})
'.....
'.....
The {{!LOOP}}.FILE EXTENSION works for me with sequential numbers within my file names.
I need to make iMacros to automatically choose random photo from a folder on my PC. How do I arrange it?
This is the line from iMacros for adding some file manually:
TAG POS=1 TYPE=INPUT:FILE FORM=ID:insta-add-image-form-all ATTR=ID:edit-insta-image-upload CONTENT=/path/to/the/specific/file
Thanks.
For Shugar
Here’s how my script looks like:
asd.iim
VERSION BUILD=8920312 RECORDER=FX
TAB T=1
URL GOTO=https://onlypult.com/dashboard
TAG POS=1 TYPE=A ATTR=TXT:Calendar
TAG POS=1 TYPE=A ATTR=TXT:+
TAG POS=1 TYPE=INPUT:FILE FORM=ID:insta-add-image-form-all ATTR=ID:edit-insta-image-upload CONTENT={{rndFilePath}}
TAG POS=1 TYPE=BUTTON FORM=ID:insta-add-image-form-all ATTR=ID:edit-nextsubmit--2
TAG POS=1 TYPE=BUTTON FORM=ID:insta-add-image-form-all ATTR=ID:edit-nextsubmit--3
TAG POS=1 TYPE=BUTTON FORM=ID:insta-add-image-form-all ATTR=ID:edit-saveimaage
asd.js
SET folderPath /path/to/folder/
SET rndFilePath EVAL("var arrFile = []; var file = Components.classes['#mozilla.org/file/local;1'].createInstance(Components.interfaces.nsILocalFile); file.initWithPath('{{folderPath}}'); var filesEnum = file.directoryEntries; while (filesEnum.hasMoreElements()) {arrFile.push(filesEnum.getNext().QueryInterface(Components.interfaces.nsILocalFile).path);} arrFile[Math.floor(Math.random()*(arrFile.length))];")
PROMPT {{rndFilePath}}
Both files are in folder /iMacros/Macros.
When it comes to line with CONTENT={{rndFilePath}}, nothing happens.
Normally that line looks like this
TAG POS=1 TYPE=INPUT:FILE FORM=ID:insta-add-image-form-all ATTR=ID:edit-insta-image-upload CONTENT=/path/to/content.jpg
The thing is, I need to click and choose some file because there appears dropdown menu when I click on «upload from PC», I cannot just write copy-paste the path to the file. Is it possible?
If you’re using Firefox, the code below returns the full path to a random file from the folder ‘D:\Temp\img’ (specified with the ‘folderPath’ variable).
SET folderPath D:\\\Temp\\\img
SET rndFilePath EVAL("var arrFile = []; var file = Components.classes['#mozilla.org/file/local;1'].createInstance(Components.interfaces.nsILocalFile); file.initWithPath('{{folderPath}}'); var filesEnum = file.directoryEntries; while (filesEnum.hasMoreElements()) {arrFile.push(filesEnum.getNext().QueryInterface(Components.interfaces.nsILocalFile).path);} arrFile[Math.floor(Math.random()*(arrFile.length))];")
PROMPT {{rndFilePath}}
I am using imacros in firefox and saving some images and I want to be able to store the saved images names in a variable, but it seems that the code at the end of my code below
SET !EXTRACT {{!DOWNLOADED_FILE_NAME}}
PROMPT {{!DOWNLOADED_FILE_NAME}}
does not work in firefox, only in ie, does anyone no how I can save the filename of the image into a variable for latter use in my imacros script in firefox browser, I prefer not to use ie browser if at all possible
thanks
VERSION BUILD=8881205 RECORDER=FX
SET !ERRORIGNORE YES
SET !TIMEOUT_PAGE 10
SET !TIMEOUT_TAG 0
SET !WAITPAGECOMPLETE YES
SET !EXTRACT_TEST_POPUP NO
TAB T=1
URL GOTO=http://www.somerandomsite.com
TAG POS=5 TYPE=INPUT:SUBMIT ATTR=*
TAG POS=1 TYPE=IMG ATTR=SRC:http://*.jpg
ONDOWNLOAD FOLDER=C:\Users\pb\Pictures\produts FILE=* WAIT=YES
'Download the picture
TAG POS=1 TYPE=IMG ATTR=SRC:http://*.jpg CONTENT=EVENT:SAVEITEM
TAG POS=2 TYPE=DIV ATTR=CLASS:iv_thumb_image&&TXT:
ONDOWNLOAD FOLDER=C:\Users\pb\Pictures\produts FILE=* WAIT=YES
'Download the picture
TAG POS=1 TYPE=IMG ATTR=SRC:http://*.jpg CONTENT=EVENT:SAVEITEM
SET !EXTRACT {{!DOWNLOADED_FILE_NAME}}
PROMPT {{!DOWNLOADED_FILE_NAME}}
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
I am really new to iMacros but seem to have a basic understanding of how it works. However, I have two problems that I just can't seem to resolve. The iMacros loads from and executable service that is ran whenever needed to get information. Once the data is extracted the service takes it and writes it to a file on the servers C drive. This has been working fine up till about a month ago. Amazon changed the website and now I can't get the script to cooperate. All help resolving this would be greatly appreciated.
The script does not extract the text, and
A new iMacros browser opens after each run-through of the script.
I have researched the internet, manipulated the script many different ways, and I have used the record option, as well as the wizard to create the script to extract the data. I'm not sure what I am missing. My script is below.
VERSION BUILD=7401598
TAB T=1
URL GOTO=https://sellercentral.amazon.com/gp/fba/revenue-calculator/index.html/ref=au_xx_cont_xx?ie=UTF8&lang=en_US
WAIT SECONDS=10
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:search-form ATTR=ID:search-string CONTENT={{Asin}}
WAIT SECONDS=10
TAG POS=1 TYPE=BUTTON ATTR=ID:search-products
WAIT SECONDS=10
TAG POS=1 TYPE=BUTTON ATTR=ID:update-fees-link
WAIT SECONDS=10
TAG POS=1 TYPE=SPAN ATTR=TXT:Order<SP>Handling
WAIT SECONDS=10
TAG POS=1 TYPE=SPAN ATTR=TXT:Pick<SP>&<SP>Pack
WAIT SECONDS=10
TAG POS=1 TYPE=SPAN ATTR=TXT:Weight<SP>Handling
WAIT SECONDS=10
The text I need to extract is Order handling, Pick & Pack, Weight Handling.
You should try placing EXTRACT=TXT after the commands. Also check the html of page and make a command if record doesn't work. If for example you have a link on a page this would be it's HTML code.
click me
iMacros to extract link and text from this are.
TAG POS=1 TYPE=A ATTR=HREF:www.somestuff.com EXTRACT=TXT
TAG POS=1 TYPE=A ATTR=HREF:www.somestuff.com EXTRACT=HREF
There are few other variations but this is the main part. In your case this would be the proper code.
TAG POS=1 TYPE=BUTTON ATTR=ID:search-products EXTRACT = TXT
WAIT SECONDS=10
TAG POS=1 TYPE=BUTTON ATTR=ID:update-fees-link EXTRACT = TXT
WAIT SECONDS=10
TAG POS=1 TYPE=SPAN ATTR=TXT:Order<SP>Handling EXTRACT = TXT
WAIT SECONDS=10
TAG POS=1 TYPE=SPAN ATTR=TXT:Pick<SP>&<SP>Pack EXTRACT = TXT
WAIT SECONDS=10
TAG POS=1 TYPE=SPAN ATTR=TXT:Weight<SP>Handling EXTRACT = TXT
WAIT SECONDS=10
Try it and please use iMacros FireFox addon for this.
Edit:
You can declare one scraping macro in JavaScript.
var macroScrape;
macroScrape ="CODE:";
macroScrape +="TAG POS=1 TYPE=BUTTON ATTR=ID:search-products EXTRACT = TXT";
iimPlay(macroScrape)
var text=iimGetLastExtract();
alert(text);
I use only once EXTRACT command in once macro. If I need more info scraped I use more macro codes declared as a variable in the example above. This could work if you know how to use it.
iMacros support is sometimes really slow.