AutoHotkey Community

It is currently May 27th, 2012, 9:14 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 22 posts ]  Go to page Previous  1, 2
Author Message
 Post subject:
PostPosted: February 21st, 2006, 9:04 pm 
Offline
User avatar

Joined: December 29th, 2004, 1:28 pm
Posts: 2545
jroad wrote:
I get your example to work, but not with one of my original requirements, which is that the two parameters must be enclosed in double quotes:
Code:
testprog.exe "param a" "param b"

Unless I'm misunderstanding... try:
Code:
""testprog.exe" "param a" "param b""


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 21st, 2006, 10:12 pm 
Offline

Joined: February 6th, 2006, 3:12 am
Posts: 26
Quote:
Unless I'm misunderstanding... try:
Code:
Code:
""testprog.exe" "param a" "param b""

Yes, I have tried this:
Code:
prog2 = C:\dev\code\ahk\general\ShowParams\ShowParams.ahk
a = C:\Program Files\Foo
b = C:\Nice Path\Bar
Run %comspec% /k ""%prog2%" "%a%" "%b%""

I wasn't very clear with my example. I was trying to show what the line would look like if typed from the command line, not using PhiLho's sample code. So, how would you manipulate the above test code so that PhiLho's ShowParams receives two quoted parameters such as:
Code:
"C:\Program Files\Foo" "C:\Nice Path\Bar"

instead of:
Code:
C:\Program Files\Foo C:\Nice Path\Bar


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 21st, 2006, 10:38 pm 
Offline
User avatar

Joined: December 29th, 2004, 1:28 pm
Posts: 2545
Here's an example you could use to place quote characters around each item sent:
Code:
prog2 = C:\dev\code\ahk\general\ShowParams\ShowParams.ahk
a = C:\Program Files\Foo
b = C:\Nice Path\Bar
Run %comspec% /c ""%prog2%" "'"'"%a%"'"'" "'"'"%b%"'"'"",, Hide


Although PhiLho's ShowParams test app works, I was lazy...:
Code:
MsgBox, %1%`n%2%`n%3%`n%4%`n%5%`n%6%`n%7%`n%8%`n%9%


BTW... Unless you are intentially trying to leave the cmd window open you may want to use cmd /c and the Hide option instead of using cmd /k . For more info type cmd /? from a cmd prompt and see the Run command in the AHK help file.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 22nd, 2006, 12:41 am 
Offline

Joined: February 6th, 2006, 3:12 am
Posts: 26
Quote:
Code:
Code:
prog2 = C:\dev\code\ahk\general\ShowParams\ShowParams.ahk
a = C:\Program Files\Foo
b = C:\Nice Path\Bar
Run %comspec% /c ""%prog2%" "'"'"%a%"'"'" "'"'"%b%"'"'"",, Hide 


Please correct me if I'm wrong but it appears the "' pieces are trying to build a double quote from 2 single quotes? If so, that's not what the program will take (I tested it.) On the screen it looks similar but it is not.
Compare:
Code:
MsgBox `'`' or ""


Is that what your code is doing or am I not understanding?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 22nd, 2006, 12:47 am 
Offline
User avatar

Joined: December 29th, 2004, 1:28 pm
Posts: 2545
Hmm... you're right. I'll try and play around with it a bit more...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 22nd, 2006, 12:51 am 
Offline

Joined: February 6th, 2006, 3:12 am
Posts: 26
Quote:
Hmm... you're right. I'll try and play around with it a bit more...

I'm not sure if you got a chance to read all the previous posts, but I have a workaround (shortpaths for target) solution. So, at this point I think the matter is more intellectual curiosity than dire need for solution. In any case, thanks for your input.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 22nd, 2006, 1:25 am 
Offline
User avatar

Joined: December 29th, 2004, 1:28 pm
Posts: 2545
Anytime :) . This seems to work ok on my system (WinXP Pro SP2):

Code:
prog2 = C:\dev\code\ahk\general\ShowParams\ShowParams.ahk
a = C:\Program Files\Foo
b = C:\Nice Path\Bar
Run %comspec% /c ""%prog2%" """"%a%"""" """"%b%""""",, Hide


Basically the quote character has to be put in quotes and quotes need to be put around the whole thing. So you end up with 4 quote characters on each side. The first (on left) and last (on right) for each section to enclose the section, three quotes in a row to escape the quote character and the variable content in the middle. :)


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 22 posts ]  Go to page Previous  1, 2

All times are UTC [ DST ]


Who is online

Users browsing this forum: BrandonHotkey, Google Feedfetcher and 67 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