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 

Passing Params to running script via CMD

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



Joined: 04 Nov 2008
Posts: 222
Location: Memphis, TN

PostPosted: Fri Feb 26, 2010 6:18 pm    Post subject: Passing Params to running script via CMD Reply with quote

if i have a compiled script that is running with the #singleinstance ignore directive, how can i pass parameters to the script as described here?
http://www.autohotkey.com/docs/Scripts.htm#cmd

Is this even possible?
Back to top
View user's profile Send private message
da_boogey_man
Guest





PostPosted: Fri Feb 26, 2010 7:32 pm    Post subject: Reply with quote

What kind of parameters are you passing? How are you trying to pass them to your script.exe? Can you show your code {or the relevant part}?

I made an EXE which replaces text {it goes a bit further than AHK's "native" replace}. I use "Win+Space" as the trigger then input the "code letters" which tell my program what to put {from an INI file}. You can use:
Hotkey, KeyName, Label, Options
...for your trigger. And something like this {directly from my replacer script}:
Code:
do_Replace:
  Input, outKeys, V,, %HS_List%

  If outKeys <> xx
    {
      outLen := StrLen(outKeys)

      Loop, %outLen%
        SendEvent, {BS}

      If outKeys = dt
        {
          FormatTime, b_Date, YYYYMMDDHH24MISS, %DtForm%
          tmpRepSt := %b_Date%
          SendInput, %b_Date%
        }
      Else
        {
          tmpRepSt := varRepSt_%outKeys%
          IfInString, tmpRepSt, `%clip`%
            StringReplace, tmpRepSt, tmpRepSt, `%clip`%, %Clipboard%, A

          StringReplace, tmpRepSt, tmpRepSt, ~~, `n, A
          SendInput, {Raw} %tmpRepSt%
        }
    }

Return


Other than removing that "#SingleInstance Ignore" that's about all I can think of. But it all depends on the purpose of your script, AFAIK.

DBM
Back to top
SoLong&Thx4AllTheFish



Joined: 27 May 2007
Posts: 4999

PostPosted: Fri Feb 26, 2010 7:41 pm    Post subject: Reply with quote

Perhaps
http://www.autohotkey.com/docs/commands/OnMessage.htm
IPC http://www.autohotkey.com/forum/topic21699.html
reload with parameters http://www.autohotkey.com/forum/viewtopic.php?p=268240#268240
Question
_________________
AHK Wiki FAQ
TF : Text files & strings lib, TF Forum
Back to top
View user's profile Send private message
godsstigma



Joined: 04 Nov 2008
Posts: 222
Location: Memphis, TN

PostPosted: Fri Feb 26, 2010 8:58 pm    Post subject: Reply with quote

Thanks guys for the suggestions.

I am going to set up a right click context menu within explorer that will send the following to my script when a certain file is right clicked:

Code:

c:\myapp.exe %1


%1 being the file that is right clicked.

The script will use this file.

As my app takes too much time to load, so reloading is not an option. I really don't want to create a second exe that will receive the cmd params and then pass to my main app. This is very undesirable.

With all that being said, anyone have any ideas?
Back to top
View user's profile Send private message
SoLong&Thx4AllTheFish



Joined: 27 May 2007
Posts: 4999

PostPosted: Fri Feb 26, 2010 11:07 pm    Post subject: Reply with quote

But that is easy to solve. Why use the context menu? No need! Simply use a hotkey in your script that will send ^c which will get the filepath from explorer into the clipboard and take it from there.
_________________
AHK Wiki FAQ
TF : Text files & strings lib, TF Forum
Back to top
View user's profile Send private message
godsstigma



Joined: 04 Nov 2008
Posts: 222
Location: Memphis, TN

PostPosted: Fri Feb 26, 2010 11:11 pm    Post subject: Reply with quote

Thanks Hugov~

I already have a massive amount of hotkeys and one included to do just that, but i thought it would be easier for my users to have a context menu item in place as well.
Back to top
View user's profile Send private message
SoLong&Thx4AllTheFish



Joined: 27 May 2007
Posts: 4999

PostPosted: Fri Feb 26, 2010 11:12 pm    Post subject: Reply with quote

drag & drop file(s) ?
_________________
AHK Wiki FAQ
TF : Text files & strings lib, TF Forum
Back to top
View user's profile Send private message
godsstigma



Joined: 04 Nov 2008
Posts: 222
Location: Memphis, TN

PostPosted: Fri Feb 26, 2010 11:13 pm    Post subject: Reply with quote

lol got that too!
Smile
Back to top
View user's profile Send private message
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