Attach with Gmail

Support for iMacros. The iMacros software is the unique solution for automating every activity inside a web browser, for data extraction and web testing.
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
LAPIII
Posts: 254
Joined: Tue Oct 07, 2008 7:24 pm

Attach with Gmail

Post by LAPIII » Fri Feb 05, 2010 6:47 pm

I want to loop an upload of every single file of the path in a CSV file:

Code: Select all

SET !DATASOURCE iMacros<SP>Uploader.csv
SET !DATASOURCE_COLUMNS 1
SET !LOOP 2
SET !DATASOURCE_LINE {{!LOOP}}
TAG POS=1 TYPE=INPUT:FILE FORM=NAME:frm_upload ATTR=NAME:uploaded_file CONTENT={{!COL1}}
TAG POS=1 TYPE=TEXTAREA FORM=NAME:frm_upload ATTR=NAME:S1 CONTENT=Done!  
I'm Using DS since the IDs change and I have a relative positioning problem. This is my macro so far, from the inbox interface:

Code: Select all

VERSION BUILD=6851105     
SIZE X=1292 Y=761    
URL GOTO=https://mail.google.com/mail/?shva=1#inbox     
SIZE X=1292 Y=761    
FRAME F=4     
'Compose
DS CMD=CLICK X=77 Y=111
'New page loaded      
'To
DS CMD=CLICK X=263 Y=159
'Subject
DS CMD=CLICK X=258 Y=226
'Attach
DS CMD=CLICK X=270 Y=250
'Body
DS CMD=CLICK X=294 Y=312 
Send
DS CMD=CLICK X=211 Y=120
New page loaded
  1. Is all this possible or must I feed the paths to the macro one by one?
  2. The words after the apostrophes, can I just move them to the appropriate DS line as a CONTENT parameter?
Daniel, Tech Support
Posts: 1483
Joined: Tue Jan 26, 2010 11:35 am

Re: Attach with Gmail

Post by Daniel, Tech Support » Mon Feb 08, 2010 6:29 pm

Hello,

You can in deed loop through the CSV, however I believe you would need to run a few macro one after another:
1. Login, start new message, set subject
2. Attach files in a loop
3. Send the message

Because if you loop the whole macro, it will try to create and send a new message on every iteration.

I hope I understood your question correctly...

Best regards,
Daniel, iOpus Support
LAPIII
Posts: 254
Joined: Tue Oct 07, 2008 7:24 pm

Re: Attach with Gmail

Post by LAPIII » Mon Feb 08, 2010 9:17 pm

LAPIII wrote: The words after the apostrophes, can I just move them to the appropriate DS line as a CONTENT parameter? [/list]
And, I think I'll just use one macro to login and another in a loop to click compose, fill To & Subject fields, attach and send. How does this look:

Code: Select all

VERSION BUILD=6851105     
SIZE X=1292 Y=761    
URL GOTO=https://mail.google.com/mail/?shva=1#inbox     
SIZE X=1292 Y=761    
FRAME F=4 
'Compose
DS CMD=CLICK X=77 Y=111
'New page loaded      
'To
DS CMD=CLICK X=263 Y=159
'Subject
DS CMD=CLICK X=258 Y=226
Attach
DS CMD=CLICK X=270 Y=250
TAG POS=1 TYPE=INPUT:FILE FORM=NAME:frm_upload ATTR=NAME:uploaded_file CONTENT=Template:!FOLDERIMACROSlicense.txt
SET !DATASOURCE iMacros<SP>Uploader.csv
SET !DATASOURCE_COLUMNS 1
SET !LOOP 2
SET !DATASOURCE_LINE {{!LOOP}}
TAG POS=1 TYPE=INPUT:FILE FORM=NAME:frm_upload ATTR=NAME:uploaded_file CONTENT={{!COL1}}
TAG POS=1 TYPE=TEXTAREA FORM=NAME:frm_upload ATTR=NAME:S1 CONTENT=Done!   
Daniel, Tech Support
Posts: 1483
Joined: Tue Jan 26, 2010 11:35 am

Re: Attach with Gmail

Post by Daniel, Tech Support » Tue Feb 09, 2010 12:13 pm

Hello,

Yes, those of them that you plan to use to enter text, can be moved to CONTENT as described here.

Best regards,
Daniel, iOpus Support
LAPIII
Posts: 254
Joined: Tue Oct 07, 2008 7:24 pm

Re: Attach with Gmail

Post by LAPIII » Tue Feb 09, 2010 2:24 pm

The words after the apostophe are the element names, not the text I want to enter. This is my macro:

Code: Select all

VERSION BUILD=6851105     
SIZE X=1292 Y=761    
URL GOTO=https://mail.google.com/mail/?shva=1#inbox     
SIZE X=1292 Y=761    
FRAME F=4     
'Compose
DS CMD=CLICK X=77 Y=111
'New page loaded      
'To
DS CMD=CLICK X=263 Y=159 CONTENT=LAPIII9@gmail.com
'Attach
DS CMD=CLICK X=270 Y=250    
SET !DATASOURCE iMacros<SP>Uploader.csv
SET !DATASOURCE_COLUMNS 1
SET !LOOP 2
SET !DATASOURCE_LINE {{!LOOP}}
TAG POS=1 TYPE=INPUT:FILE FORM=NAME:frm_upload ATTR=NAME:uploaded_file CONTENT={{!COL1}}
TAG POS=1 TYPE=TEXTAREA FORM=NAME:frm_upload ATTR=NAME:S1 CONTENT=Done!  
Send
DS CMD=CLICK X=211 Y=120
New page loaded
I got this error:

Code: Select all

Found wrong macro command while loading file: New(Line:15)
 (Error code: -203)
Please help with the error?
Daniel, Tech Support
Posts: 1483
Joined: Tue Jan 26, 2010 11:35 am

Re: Attach with Gmail

Post by Daniel, Tech Support » Tue Feb 09, 2010 6:25 pm

Hello,

Is your CSV stored in the right folder?
May be renaming iMacros<SP>Uploader.csv to something like iMacros_Uploader.csv would be a good idea :)
Daniel, iOpus Support
LAPIII
Posts: 254
Joined: Tue Oct 07, 2008 7:24 pm

Re: Attach with Gmail

Post by LAPIII » Wed Feb 10, 2010 12:23 am

Changing the name did eliminate that error, but now I get this:

Code: Select all

Error in Line 12:

TYPE=INPUT:FILE FORM=NAME:frm_upload ATTR=NAME:uploaded_file 
 (Error code: -301)
And here's the new macro:

Code: Select all

VERSION BUILD=6851105     
SIZE X=1292 Y=761    
URL GOTO=https://mail.google.com/mail/?shva=1#inbox     
SIZE X=1292 Y=761    
FRAME F=4     
'Compose
DS CMD=CLICK X=77 Y=111
'New page loaded      
'To
DS CMD=CLICK X=263 Y=159 CONTENT=LAPIII9@gmail.com
'Attach
DS CMD=CLICK X=270 Y=250    
SET !DATASOURCE iMacros_Uploader.csv
SET !DATASOURCE_COLUMNS 1
SET !LOOP 2
SET !DATASOURCE_LINE {{!LOOP}}
TAG POS=1 TYPE=INPUT:FILE FORM=NAME:frm_upload ATTR=NAME:uploaded_file CONTENT={{!COL1}}
TAG POS=1 TYPE=TEXTAREA FORM=NAME:frm_upload ATTR=NAME:S1 CONTENT=Done!  
'Send
DS CMD=CLICK X=211 Y=120
'New page loaded
  1. Why does the error indicate the wrong line #?
  2. To upload to gmail, do I need to click the Browse button (first screenshot) in the iMacros File Upload Window vs the ordinary browse window?
  3. If so then how do I automate this? Is it like an ordinary javascript popup?
  4. And what do I do if I click Browse (second screenshot)?
IFU.PNG
IFU.PNG (4.63 KiB) Viewed 8021 times
Browse.PNG
Browse.PNG (29.29 KiB) Viewed 8019 times
Daniel, Tech Support
Posts: 1483
Joined: Tue Jan 26, 2010 11:35 am

Re: Attach with Gmail

Post by Daniel, Tech Support » Wed Feb 10, 2010 1:09 pm

Hello,

Error 301: Error in Line x (TAG command not found in web page). I guess you need to make sure that control is there.

1. It is showing the line number of the working code, i.e. without all comments. I think this will be changed in future versions to show the line number of the visible text
2. Yes
3. This is there to help you automate the real browser popup. I.e. after you click and select a file, iMacros will add necessary tags to respond to real browser popups.
4. Pick up a file that you want to upload. After the macro is recorded, you can change the file name and path to the values from your CSV.

Best regards,
Daniel, iOpus Support
LAPIII
Posts: 254
Joined: Tue Oct 07, 2008 7:24 pm

Re: Attach with Gmail

Post by LAPIII » Wed Feb 10, 2010 11:55 pm

Code: Select all

TAG POS=1 TYPE=SPAN ATTR=ID::k4
DS isn't very accurate with me, so I'll use relative positioning
This is the line that I get in Firefox, but wont work in IIM browser:

Code: Select all

TAG POS=1 TYPE=EMBED ATTR=HEIGHT:100%&&WIDTH:100%&&FLASHVARS:alpha=0&apiId=5&&WMODE:transparent&&ALLOWSCRIPTACCESS:always&&QUALITY:high&&NAME:FLASH_UPLOADER_5&&ID:FLASH_UPLOADER_5&&SRC:uploader/uploaderapi2.swf&&TYPE:application/x-shockwave-flash&&TXT: 
This does work in IIM browser, I think it should model after one of these lines, but I don't know how to code the attach TAG:

Code: Select all

FRAME F=4
TAG POS=1 TYPE=SPAN ATTR=ROLE:link&&TXT:Compose<SP>Mail
TAG POS=1 TYPE=TD ATTR=CLASS:*&&TXT:To:
TAG POS=R1 TYPE=TEXTAREA FORM=NAME:NoFormName ATTR=ID:* CONTENT=someone@email.com
TAG POS=1 TYPE=TD ATTR=CLASS:*&&TXT:Subject:
TAG POS=R1 TYPE=INPUT:TEXT FORM=NAME:NoFormName ATTR=ID:* CONTENT=Not<SP>important
User avatar
Tech Support
Posts: 4947
Joined: Tue Sep 20, 2005 7:25 pm
Contact:

Re: Attach with Gmail

Post by Tech Support » Thu Feb 11, 2010 7:17 am

Are you running this in Firefox? Please note that the upload feature in Firefox works only with standard upload boxes, while the iMacros Browser upload support works with every upload box.
LAPIII
Posts: 254
Joined: Tue Oct 07, 2008 7:24 pm

Re: Attach with Gmail

Post by LAPIII » Thu Feb 11, 2010 2:02 pm

I'm using the iMacros browser and just didn't know how to get make the 'Attach' line of code. Another reason I switched to relative positioning is that I can use HTML macros made in Firefox, but I can't make them in iMacros Browser.
Daniel, Tech Support
Posts: 1483
Joined: Tue Jan 26, 2010 11:35 am

Re: Attach with Gmail

Post by Daniel, Tech Support » Thu Feb 11, 2010 5:21 pm

Hi,

Are you recording this macro? Have you initially recorded it in Firefox? If yes, it could be that GMail renders different code for different browsers and this is why iMacros Browser can't find the control. Check the html in iMacros Browser.

Best regards,
Daniel, iOpus Support
LAPIII
Posts: 254
Joined: Tue Oct 07, 2008 7:24 pm

Re: Attach with Gmail

Post by LAPIII » Fri Feb 12, 2010 4:48 pm

Daniel, iOpus wrote: Check the html in iMacros Browser.
If you meant the source code, then how do I access it with iMacro's browser. With the source code, can you write that line of macro code because I don't know how to read through source code?
Daniel, Tech Support
Posts: 1483
Joined: Tue Jan 26, 2010 11:35 am

Re: Attach with Gmail

Post by Daniel, Tech Support » Fri Feb 12, 2010 7:49 pm

Hello,

Yes, you can view the source code in iMacros by right-clicking on the website you're browsing and selecting "View source".
I suggest that you simply re-record it with iMacros browser, to avoid incompatibilities.

Best regards,
Daniel, iOpus Support
LAPIII
Posts: 254
Joined: Tue Oct 07, 2008 7:24 pm

Re: Attach with Gmail

Post by LAPIII » Sat Feb 13, 2010 12:24 am

View Source only gives me:

Code: Select all

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head></head><body><div></div></body></html> 
This is my macro:

Code: Select all

VERSION BUILD=6851105     
TAB T=1     
TAB CLOSEALLOTHERS     
URL GOTO=https://mail.google.com/mail/?hl=en&shva=1#inbox     
FRAME F=4     
TAG POS=1 TYPE=SPAN ATTR=ID::r2   
'New page loaded      
'New page loaded      
TAG POS=1 TYPE=TEXTAREA FORM=NAME:NoFormName ATTR=ID::ga CONTENT=EmailAddress
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:NoFormName ATTR=ID::g7 CONTENT=Subject 
TAG POS=1 TYPE=SPAN ATTR=ID::ks   
ONDIALOG POS=1 BUTTON=OK CONTENT=
TAG POS=1 TYPE=B ATTR=TXT:Send  

I still get randow ATTR ID's which don't work right even with * after every instance of ATTR=ID::
Post Reply