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 

using run with a command line switch

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





PostPosted: Wed Jul 15, 2009 7:23 pm    Post subject: using run with a command line switch Reply with quote

i want to run a program and have it run with a switch like

Code:
run, program -switch


I've tried all the variants i can think of anyone have an idea how to run a program with a command line switch
Back to top
sinkfaze



Joined: 18 Mar 2008
Posts: 5044
Location: the tunnel(?=light)

PostPosted: Wed Jul 15, 2009 7:32 pm    Post subject: Reply with quote

Are you enclosing the target in quotes?

Code:
run, "program" -switch

_________________
Try Quick Search for Autohotkey or see the tutorial for newbies.
Back to top
View user's profile Send private message Send e-mail
Guest






PostPosted: Wed Jul 15, 2009 7:39 pm    Post subject: Reply with quote

no i haven't tried that, what does that do?
Back to top
Guest






PostPosted: Wed Jul 15, 2009 7:41 pm    Post subject: Reply with quote

i just tried that and it did not work
Back to top
Guest






PostPosted: Wed Jul 15, 2009 7:49 pm    Post subject: Reply with quote

i'm trying to have the script run wow in a window but the -window switch won't work for me like this

Code:
Run, C:\program files\world of warcraft\wow.exe -windowed
Back to top
deleyd



Joined: 08 Mar 2008
Posts: 64
Location: Santa Barbara

PostPosted: Wed Jul 15, 2009 7:53 pm    Post subject: Reply with quote

If this is not a regular .exe program, then try:
Code:
Run, "%comspec%" /c  ""Show Params.ahk"  "param one"  "param two"  "param three"", , Hide
;    ^         ^     ^^               ^  ^         ^  ^         ^  ^           ^^
;    +---------+     |+---------------+  +---------+  +---------+  +-----------+|
;                    |                                                          |
;                    +----------------------------------------------------------+ cmd.exe strips off these outer "


Otherwise, if it's a regular .exe program, then parameter passing rules are usually:
  • 2n backslashes followed by a " produce n backslashes + start/end double quoted part
  • (2n) + 1 backslashes followed by a " produce n backslashes + a literal quotation mark
  • n backslashes not followed by a quotation mark produce n backslashes
  • a closing " followed immediately by another ", the 2nd " is taken literally and added to the parameter. (This rule appears to be undocumented.)


(I'm currently working on some detailed documentation for passing parameters using the Run command, which I'll add to my http://www.autohotkey.net/~deleyd/xprxmp/autohotkey_expression_examples.htm)
Back to top
View user's profile Send private message Visit poster's website
Guest






PostPosted: Wed Jul 15, 2009 7:56 pm    Post subject: Reply with quote

err, what's n?
Back to top
Guest






PostPosted: Thu Jul 16, 2009 2:07 am    Post subject: Reply with quote

bump
Back to top
closed



Joined: 07 Feb 2008
Posts: 509

PostPosted: Thu Jul 16, 2009 6:44 am    Post subject: Reply with quote

// n=2
/// n=3
Back to top
View user's profile Send private message
Guest






PostPosted: Thu Jul 16, 2009 8:53 pm    Post subject: Reply with quote

ty
Back to top
Guest






PostPosted: Thu Jul 16, 2009 11:53 pm    Post subject: Reply with quote

i guess i didn't understand?


Code:
run, "c:\program files\world of warcraft\wow.exe" "\\-windowed"


i've tried alot more than that but alot of them didn't run at all, on the ones that didn't work i got a debug that listed \\windowed as one of my variables so that's a step in the right direction
Back to top
Guest






PostPosted: Thu Jul 16, 2009 11:58 pm    Post subject: Reply with quote

and does anyone know a command to get that helpful box up when there's no errors? for debugging
Back to top
deleyd



Joined: 08 Mar 2008
Posts: 64
Location: Santa Barbara

PostPosted: Fri Jul 17, 2009 7:47 am    Post subject: Reply with quote

windowed is a variable? use %windowed%

Not quite sure what you want the parameter to be.

Perhaps you want:
Code:
run, "c:\program files\world of warcraft\wow.exe" "\\-%windowed%"

but... I'm not sure what the two slashes are there for. Perhaps you want:
Code:
run, "c:\program files\world of warcraft\wow.exe" "-%windowed%"


However, it's possible wow.exe will include the double quotes as part of the parameter instead of using them as parameter delimiters. They may not be necessary:
Code:
run, "c:\program files\world of warcraft\wow.exe" -%windowed%
(depends on what the windowed variable is.)

The thing about Windows OS is the newly created process (wow.exe) is responsible for parsing the command line to extract the parameters. (If the program *.exe is written in C/C++, then the C/C++ compiler which compiles the program secretly adds code to the executable which retrieves the command line and parses it to get the parameters. In this case at least there's a consistent standard.)
_________________
http://www.autohotkey.net/~deleyd/xprxmp/autohotkey_expression_examples.htm
Back to top
View user's profile Send private message Visit poster's website
Lexikos



Joined: 17 Oct 2006
Posts: 7295
Location: Australia

PostPosted: Fri Jul 17, 2009 8:47 am    Post subject: Reply with quote

Anonymous wrote:
i'm trying to have the script run wow in a window but the -window switch won't work for me like this
Code:
Run, C:\program files\world of warcraft\wow.exe -windowed
That works just fine for me after changing "C:\program files" to the appropriate path. However, if you have the "Maximized" option enabled you won't see a titlebar or window borders. Unfortunately there doesn't seem to be an opposite of the -maximized switch.

Btw, I always run WoW in "Maximized Windowed" mode, and I've had no problem resizing the windows via WinMove.
Back to top
View user's profile Send private message Visit poster's website
Guest






PostPosted: Fri Jul 17, 2009 4:20 pm    Post subject: Reply with quote

lexicos i think that is my problem, thanks
Back to top
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