1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

iMacro Question

Discussion in 'Other Scripting Languages' started by oToom, Jan 7, 2013.

  1. oToom

    oToom Newbie

    Joined:
    Oct 4, 2009
    Messages:
    24
    Likes Received:
    1
    If for instance I am uploading files to a website. And I get this from recording my action..

    TAG POS=1 TYPE=INPUT:FILE FORM=ACTION://upload.*.com/ ATTR=NAME:media[] CONTENT=F:\Folder\FileName.jpg

    If I was to say want to loop through 10 images. How would I go about doing this?
    All the file names are different.

    Thanks for any help.
     
  2. Aaric

    Aaric Elite Member

    Joined:
    Mar 7, 2010
    Messages:
    1,577
    Likes Received:
    1,121
    Gender:
    Male
    Location:
    USA
    SET !ERRORIGNORE YES
    SET !DATASOURCE FILENAMES.csv
    SET !DATASOURCE_COLUMNS 1000
    SET !LOOP 1
    TAG POS=1 TYPE=INPUT:FILE FORM=ACTION://upload.*.com/ ATTR=NAME:media[] CONTENT=F:\Folder\{{!COL1}}.jpg



    Make a text or csv file and put all file names from folder to first row..if they are all .jpg if not then use{{!COL1}} instead {{!COL1}}.jpg and write full image name and extension in csv file.

    Let me know if i can help you further. :) :)
     
    Last edited: Jan 7, 2013
  3. Mfarrell123

    Mfarrell123 Newbie

    Joined:
    Jan 22, 2011
    Messages:
    17
    Likes Received:
    11
    Here is an example of a loop that I have used. Don't know if it helps.

    SET !DATASOURCE C:\users.csv
    SET !DATASOURCE_COLUMNS 1
    'Start at line 2 to skip the header in the file
    SET !LOOP 1
    SET !DATASOURCE_LINE {{!LOOP}}
    WAIT SECONDS=3
    TAG POS=1 TYPE=SPAN ATTR=TXT:Follow
    WAIT SECONDS=8
    URL GOTO=https : // twitter . com /{{!COL1}}
    WAIT SECONDS=4
     
  4. Aaric

    Aaric Elite Member

    Joined:
    Mar 7, 2010
    Messages:
    1,577
    Likes Received:
    1,121
    Gender:
    Male
    Location:
    USA
    Also if you can rename files to 1,2,3,4 etc then you do not need to use !DATASOURCE.

    Just declare SET !VAR1 EVAL("Math.floor(Math.random()*10 + 1);") in starting of macro

    and use !VAR1.jpg instead {{!COL1}}.jpg


    Got it working?
     
  5. oToom

    oToom Newbie

    Joined:
    Oct 4, 2009
    Messages:
    24
    Likes Received:
    1
    Sorry have been busy today at work. Will give this a try in a minute.
    Only problem is there is around 8000 images in the folder. I will be uploading 20 at a time. Or more. But would rather not upload 8000 names to a .csv file haha.

    May look into python on how to change the names of files in a folder. Let it run through all the 8000 images incrementing the number like you say, 1,2,3,4 etc etc.
     
  6. Aaric

    Aaric Elite Member

    Joined:
    Mar 7, 2010
    Messages:
    1,577
    Likes Received:
    1,121
    Gender:
    Male
    Location:
    USA
    select all images in windows explorer and rename them all to same name eg IM


    they will get renamed itself as

    IM (1)
    IM (2)
    IM (3)
    IM (4)

    use IM<sp>({{!LOOP}}).jpg
    I was also busy@
     
    Last edited: Jan 8, 2013
  7. oToom

    oToom Newbie

    Joined:
    Oct 4, 2009
    Messages:
    24
    Likes Received:
    1
    Superb mate thank you. Saves me learning python haha.
    Wish I could afford uBot or something, But iMacros ff add-on is all I can do for now.

    EDIT. For some reason when I try that it causes doubles.
    IM (1)
    IM (1)
    IM (2)
    IM (2). etc etc.
    Menaing 2 files are called the same...
    Didn't even think this was possible?
     
    Last edited: Jan 8, 2013
  8. Aaric

    Aaric Elite Member

    Joined:
    Mar 7, 2010
    Messages:
    1,577
    Likes Received:
    1,121
    Gender:
    Male
    Location:
    USA
    you are most welcome, let me know if i can do anything else
     
  9. oToom

    oToom Newbie

    Joined:
    Oct 4, 2009
    Messages:
    24
    Likes Received:
    1
    Figured the reason that it was making doubles with the same name was because one was .jpg one was .png. If there was a .gif it would make another with the same name.

    Still haven't had time to test this but will try get round to it now haha. Thanks again I'll report back.
     
  10. Abe_Wae

    Abe_Wae Newbie

    Joined:
    Jan 6, 2013
    Messages:
    5
    Likes Received:
    0
    am really trying to post with all the data of my prblem wth my macros
    but cant y?