| View previous topic :: View next topic |
| Author |
Message |
godsstigma
Joined: 04 Nov 2008 Posts: 222 Location: Memphis, TN
|
Posted: Fri Feb 26, 2010 6:18 pm Post subject: Passing Params to running script via CMD |
|
|
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 |
|
 |
da_boogey_man Guest
|
Posted: Fri Feb 26, 2010 7:32 pm Post subject: |
|
|
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
|
|
| Back to top |
|
 |
godsstigma
Joined: 04 Nov 2008 Posts: 222 Location: Memphis, TN
|
Posted: Fri Feb 26, 2010 8:58 pm Post subject: |
|
|
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:
%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 |
|
 |
SoLong&Thx4AllTheFish
Joined: 27 May 2007 Posts: 4999
|
Posted: Fri Feb 26, 2010 11:07 pm Post subject: |
|
|
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 |
|
 |
godsstigma
Joined: 04 Nov 2008 Posts: 222 Location: Memphis, TN
|
Posted: Fri Feb 26, 2010 11:11 pm Post subject: |
|
|
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 |
|
 |
SoLong&Thx4AllTheFish
Joined: 27 May 2007 Posts: 4999
|
|
| Back to top |
|
 |
godsstigma
Joined: 04 Nov 2008 Posts: 222 Location: Memphis, TN
|
Posted: Fri Feb 26, 2010 11:13 pm Post subject: |
|
|
lol got that too!
 |
|
| Back to top |
|
 |
|