 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
William Guest
|
Posted: Wed Jun 18, 2008 8:44 am Post subject: How to send file path to ahk when using sendto in right menu |
|
|
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
|
Posted: Wed Jun 18, 2008 9:01 am Post subject: |
|
|
| Passed on parameters are called %0% %1% etc not %FilePath% |
|
| Back to top |
|
 |
William Guest
|
Posted: Wed Jun 18, 2008 9:25 am Post subject: |
|
|
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
|
Posted: Wed Jun 18, 2008 9:41 am Post subject: |
|
|
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 |
|
 |
Vade
Joined: 14 Jun 2008 Posts: 5
|
Posted: Wed Jun 18, 2008 9:45 am Post subject: |
|
|
| 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 |
|
 |
William Guest
|
Posted: Wed Jun 18, 2008 9:50 am Post subject: |
|
|
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
|
Posted: Wed Jun 18, 2008 12:13 pm Post subject: |
|
|
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 |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|