AutoHotkey Community

It is currently May 26th, 2012, 8:09 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: June 18th, 2008, 9:44 am 
I am trying to write a ahk "send with Gmail", which will work as:
1. Right click a file
2. Choose sendto...
3. Choose "send with Gmail"
4. ahk works, then open an IE, go to gmail.com, then compose a mail, send the file which in step 1 as the attachment.

Now the problem is, I cannot get the file path which need in the step 4.

I make a shortcut for my exe file and copy it to the "Sendto" folder, and edit the shortcut target as
"C:\Documents and Settings\Administrator\Desktop\test.exe" /FilePath:%1

Then use "FilePath" in my ahk script, but cannot get the file path.

Anyone can help me?

My script is here
----
Run, www.gmail.com
WinWaitActive,Gmail: Email from Google
sleep,100
Send, Username{TAB}password{Enter}

IfWinExist, Gmail
WinActivate

Send,c ;compose a mail
sleep,100
WinWaitActive,Gmail - Compose Mail
Send, abc@abc.com{TAB}backup ;seciever and subject
Mouseclick,L,280,360 ;attachment link

Send, %FilePath% ;problem is here!!!


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: June 18th, 2008, 10:01 am 
Offline

Joined: May 27th, 2007, 9:41 am
Posts: 4999
Passed on parameters are called %0% %1% etc not %FilePath%


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 18th, 2008, 10:25 am 
Need I do something on the shortcut target in the sendto folder?
Now the shortcut target is
"C:\Documents and Settings\Administrator\Desktop\test.exe"


HugoV wrote:
Passed on parameters are called %0% %1% etc not %FilePath%


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: June 18th, 2008, 10:41 am 
Offline

Joined: May 27th, 2007, 9:41 am
Posts: 4999
Example.ahk:
Code:
MsgBox number of command line switches: %0%
MsgBox switch1: %1%

Run as example.ahk "fullpathtofile"
It will show the number of CL parameters passed (stored in %0%)
and the 1st parameter, you used %filepath% which is not correct.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 18th, 2008, 10:45 am 
Offline

Joined: June 14th, 2008, 11:46 am
Posts: 5
William wrote:
Need I do something on the shortcut target in the sendto folder?
Now the shortcut target is
"C:\Documents and Settings\Administrator\Desktop\test.exe"


HugoV wrote:
Passed on parameters are called %0% %1% etc not %FilePath%


No, just create a .lnk to your compiled script in sendto folder. In the script, use %1% to get the full file path.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 18th, 2008, 10:50 am 
Thanks!!! It works!!

Vade wrote:
No, just create a .lnk to your compiled script in sendto folder. In the script, use %1% to get the full file path.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: June 18th, 2008, 1:13 pm 
Offline
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
Guess I am too late! :(
Anyways. Here is the script I created to test it :

Code:
FileFullPath=%1%

If ( FileFullPath = "" )
 {
   SplitPath, A_MyDocuments,, A_UserDir
   SendTo := A_UserDir "\SendTo"
   FileGetShortcut, %SendTo%\GMail.lnk, OutTarget
   If ( OutTarget <> A_ScriptFullPath )
        FileCreateShortcut, %A_ScriptFullPath%, %SendTo%\GMail.lnk, %A_ScriptDir%
   ExitApp
 } Else  {
   Loop, %FileFullPath%,1
      FileFullPath := A_LoopFileLongPath
 }

MsgBox, % FileFullPath 


It automatically creates gmail.lnk in SendTo folder. If you ever move the script to a different folder, running the script will auto-update the LNK.

:)

_________________
URLGet - Internet Explorer based Downloader
StartEx - Portable Shortcut Link


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: BrandonHotkey, Google Feedfetcher, poserpro, sjc1000, Tilter_of_Windmills and 52 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group