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 

Script responsive to command line AND drag&drop

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
dncarac



Joined: 31 Aug 2006
Posts: 60

PostPosted: Tue Jan 23, 2007 4:39 pm    Post subject: Script responsive to command line AND drag&drop Reply with quote

I've found script examples here and in the help for drag and drop, or for command line parameters.

Is there a way to make a single script work with both? That would enable use of the command line for file associations and drag and drop for GUIs.

Does that make sense to anyone?

Dave
Back to top
View user's profile Send private message
ahklerner



Joined: 26 Jun 2006
Posts: 1202
Location: USA

PostPosted: Tue Jan 23, 2007 5:53 pm    Post subject: Reply with quote

Quote:
make sense to anyone?


yep
Back to top
View user's profile Send private message
Lemming



Joined: 20 Dec 2005
Posts: 150
Location: Malaysia

PostPosted: Wed Jul 04, 2007 5:41 pm    Post subject: Reply with quote

something like this?

Code:
if 0 < 1  ; The left side of a non-expression if-statement is always the name of a variable.
{
    MsgBox Fancy GUI launched because there were no command line params
    ExitApp
}
Else
{
    MsgBox Looks like you entered %1% as the first param`n`nNO GUI FOR YOU!
    ExitApp
}


http://www.autohotkey.com/docs/Scripts.htm#cmd
Back to top
View user's profile Send private message
Helpy
Guest





PostPosted: Wed Jul 04, 2007 5:56 pm    Post subject: Reply with quote

That's the same thing, drag'n'dropping a file on a script is running this script with the file path as parameter. Except that's the short path, you have to do an extra step to get the long path.
Example that work even if no file is given:
Code:
If 0 = 1 ; Strange looking, no? :)
{
   Loop %1%   ; Avoid short name
   {
      filePath := A_LoopFileLongPath
   }
}
Else
{
   FileSelectFile filePath, 1
}
MsgBox %filePath%
Back to top
Display posts from previous:   
Post new topic   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