iMacro script for exporting all orders on Aliexpress to file (ali-export-all-orders.iim)

Status
Not open for further replies.

DropBock

Newbie
Joined
Dec 28, 2015
Messages
25
Reaction score
12
Just finished with testing and fixing my script for today. Its called ali-export-all-orders.iim


Selection_517.jpg

its pretty self explanatory but just in case,

first you have to save the code in a new file under the macro folder.
then you fire up a new browser session , WARNING: iMacro will close open tabs.
then you go to Selection_513.jpg (without ?)
then you note the number of pages with orders(bottom at the page), in my case it would be 8: Selection_512.jpg
then you insert that number in iMacro frame inside browser like this: Selection_514.jpg
and finally you play loop and take a coffe break. its possible to use computer at the same time but for me it went best if i let the active window be the iMacro working window.

The result is a bunch of .csv files and it look like this: Selection_515.jpg

fileformat: orders_(name of the person its supposed to ship)_(status)_(order-id)

the content of the .csv files is pretty messed up and not even comma delimited but it works great for me.

example:
Selection_516.jpg


perhaps someone might find it useful.

Regards from Martin
 
Just used this. Works great! Only thing you forgot to mention is that this needs to be played with iMacros for Firefox. I tried with Chrome first and struggled.
 
It dosent work.

I save it as .iim and Play (Loop) 64 Times but get this error:
Retry timeout, line: 58 (Error code: -1001)
 
Last edited:
you can probably make it work by removing line 28 which says "SET !ERRORIGNORE NO"
 
btw. is someone wants a cleaner code and/or customized i could perhaps help you. just give me a try in PM.
 
I have not much, but would be willing to donate 10 € if I have a way to export all the orders to a csv file.
 
It doesnt work if i comment out the line 28

I habe over 60 pages and i think the script needs to much ram or there is an other problem with the script or imacro :/ I'm looking for a long time but i dint not find a working script. But the author of this scripts post it on over 15 sites....and now i come here to use it and it doesnt work :(

I Hope really anyone can help
 
Here is a new script. it loops the order pages and opens each page of the orders and download each as html file and when its done im using a script that converts the html file to readable format.

To use the iMacro script you have to be on the order page at aliexpress.com
also you have to change 68 in the iMacro javascript file "for(l=1;l<68;l++)" to the count of your order pages. (plus one)

i have tried it and it seems to work well, actually its run full for the first time right now but im tired and have been coding all night so beware of bugs.

iMacro script:
Code:
var load;
load =  "CODE:";
//* load +=  "SET !ERRORIGNORE YES" + "\n";  *//
load +=  "TAG POS={{i}} TYPE=A ATTR=TXT:View<SP>Detail" + "\n";
load +=  "WAIT SECONDS=1" + "\n";

load +=  "TAB T=2" + "\n";
load +=  'TAG POS=1 TYPE=* ATTR=CLASS:"order-no" EXTRACT=TXT' + "\n";
load +=  "SAVEAS TYPE=HTM FOLDER=* FILE=ali_order-ID-{{!EXTRACT}}" + "\n";
 load +=  "TAB CLOSE " + "\n"; 
 load +=  "TAB T=1" + "\n";


var MACRO2;
MACRO2 =  "CODE:";
MACRO2 +=  'TAG POS=1 TYPE=A ATTR=TXT:{{l}}' + "\n";
MACRO2 +=  "WAIT SECONDS=2" + "\n";



for(l=1;l<68;l++) {
  iimSet("l",l);


for(i=1;i<11;i++) {
  iimSet("i",i);
  iimPlay(load);


}
iimSet("l",l);
iimPlay(MACRO2);
}

the script
Code:
#!/bin/bash

for i in $(ls iMacros/Downloads/ali_order-ID-*); do
order_id_from_file=$(echo $i |grep [0-9*]*.htm|grep [0-9*] -o |tr -d '\n')

echo printing shit to the file $order_id_from_file

if [ -f  $order_id_from_file.txt ]
then
    echo "File $order_id_from_file.txt  exists, making backup and comparing"
cp $order_id_from_file.txt $order_id_from_file.bak
rm $order_id_from_file.diff
do_compare=YES
else
do_compare=NO
fi

cat $i| grep baobei-name  -A1 $i|html2text |tr -cd "[:print:]\n"|sed  '/^$/d' |sort -u > $order_id_from_file.txt

cat $i| grep '<dd class="order-no">' $i |html2text >> $order_id_from_file.txt

cat $i |grep ' <div class="user-shipping"' -A120  |grep data-status\=\"[0-9,a-z,A-Z,_]* -o >>  $order_id_from_file.txt

cat $i| grep '<dd class="order-status">'  -A5 $i|html2text  >> $order_id_from_file.txt


if [ "$do_compare" ==  YES ]
then
echo comparing..
diff $order_id_from_file.txt $order_id_from_file.bak > $order_id_from_file.diff
fi


done
cat *.diff


I have not much, but would be willing to donate 10 € if I have a way to export all the orders to a csv file.
that would be great. you can sponsor me at paypal.me/somethingornothing


atm its not CSV at all but more like this;
501xxxxxxxxxx006
Contact Name :John Doe
Address:Satan Rocks 1A
Not Stockholm, Sweden
Zip Code:777 77
Mobile:0000000
Tel:+46-
Fax:
501902265004005
-- 100pcs_datura_flower_datura_seeds_dwarf_Brugmansia_suaveolens_Flamenco
100pcs_datura_flower_datura_seeds_dwarf_Brugmansia_suaveolens_Flamenco_angel's
angel's_Trumpets_planting_datura_exotic_seeds_for_garden
Trumpets_planting_datura_exotic_seeds_for_garden
data-status="WAIT_BUYER_CONFIRM_GOODS
The seller has shipped your order
(order-id,shipping-info,product title(s),data-status,order-status)
 
It doesnt work if i comment out the line 28

I habe over 60 pages and i think the script needs to much ram or there is an other problem with the script or imacro :/ I'm looking for a long time but i dint not find a working script. But the author of this scripts post it on over 15 sites....and now i come here to use it and it doesnt work :(

I Hope really anyone can help
sorry about that, it was bad coded. i tried it for the first time in like a year today and it hanged my browser too.


but i have not posted that script to 15 different sites. thats a lie!
 
sorry about the bash script. it did not work as expected but it should not be too hard to fix this.

perhaps im able to do it tonight.
 
it was easier than suspected. i changed one line only "cat tjoho" to "cat $i" and it works.

what follows is an lazy attempt to convert the outpupt to csv. (in linux bash but would also work in windows trough cygwin)

for i in $(ls |xargs ls [5-9]*.txt); do echo $i $(head -2 $i|tail -1 |grep "Contact Name"[a-z,A-Z\ \:]* -o)|awk -F: '{print $2}'; done > data.1-names

for i in $(ls |xargs ls [5-9]*.txt); do echo $i $(head -1 $i|tail -1); done |awk -F\ '{print $2}' > data.2-id

for i in $(ls |xargs ls [5-9]*.txt); do echo $i $(head -8 $i|tail -6); done > data.3-address

for i in $(ls |xargs ls [5-9]*.txt); do echo $i $(head -12 $i|tail -4); done > data.4-products

for i in $(ls |xargs ls [5-9]*.txt); do grep data-status $i ; done > data.5-data-status

for i in $(ls |xargs ls [5-9]*.txt); do grep order-status $i ; done > order.6-status

paste -d, data.* > tjenamoss.csv


(there are some serious bugs with this i think. for example the delimiter "," could also exist in product titles and then it fails very good and also im not satisfied with the file/column called 'data.4-products' )
 
Status
Not open for further replies.
Back
Top