AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to send file path to ahk when using sendto in right menu

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
William
Guest





PostPosted: Wed Jun 18, 2008 8:44 am    Post subject: How to send file path to ahk when using sendto in right menu Reply with quote

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!!!
Back to top
SoLong&Thx4AllTheFish



Joined: 27 May 2007
Posts: 4999

PostPosted: Wed Jun 18, 2008 9:01 am    Post subject: Reply with quote

Passed on parameters are called %0% %1% etc not %FilePath%
Back to top
View user's profile Send private message
William
Guest





PostPosted: Wed Jun 18, 2008 9:25 am    Post subject: Reply with quote

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%
Back to top
SoLong&Thx4AllTheFish



Joined: 27 May 2007
Posts: 4999

PostPosted: Wed Jun 18, 2008 9:41 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
Vade



Joined: 14 Jun 2008
Posts: 5

PostPosted: Wed Jun 18, 2008 9:45 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
William
Guest





PostPosted: Wed Jun 18, 2008 9:50 am    Post subject: Reply with quote

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.
Back to top
SKAN



Joined: 26 Dec 2005
Posts: 8688

PostPosted: Wed Jun 18, 2008 12:13 pm    Post subject: Reply with quote

Guess I am too late! Sad
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.

Smile
_________________
URLGet - Internet Explorer based Downloader
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group