AutoHotkey Community

It is currently May 26th, 2012, 8:11 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 15 posts ] 
Author Message
PostPosted: July 15th, 2009, 8:23 pm 
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


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: July 15th, 2009, 8:32 pm 
Offline
User avatar

Joined: March 19th, 2008, 12:43 am
Posts: 5480
Location: the tunnel(?=light)
Are you enclosing the target in quotes?

Code:
run, "program" -switch

_________________
Image
Try Quick Search for Autohotkey or see the tutorial for newbies.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 15th, 2009, 8:39 pm 
no i haven't tried that, what does that do?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: July 15th, 2009, 8:41 pm 
i just tried that and it did not work


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: July 15th, 2009, 8:49 pm 
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


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: July 15th, 2009, 8:53 pm 
Offline

Joined: March 8th, 2008, 11:36 am
Posts: 64
Location: Santa Barbara
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)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 15th, 2009, 8:56 pm 
err, what's n?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: July 16th, 2009, 3:07 am 
bump


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: July 16th, 2009, 7:44 am 
Offline

Joined: February 7th, 2008, 9:48 pm
Posts: 509
// n=2
/// n=3


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 16th, 2009, 9:53 pm 
ty


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: July 17th, 2009, 12:53 am 
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


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: July 17th, 2009, 12:58 am 
and does anyone know a command to get that helpful box up when there's no errors? for debugging


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: July 17th, 2009, 8:47 am 
Offline

Joined: March 8th, 2008, 11:36 am
Posts: 64
Location: Santa Barbara
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/xprxm ... amples.htm


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 17th, 2009, 9:47 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7502
Location: Australia
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 17th, 2009, 5:20 pm 
lexicos i think that is my problem, thanks


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 15 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: [VxE], Bing [Bot], BrandonHotkey, over21, SifJar, StepO and 70 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group