| View previous topic :: View next topic |
| Author |
Message |
corrupt
Joined: 29 Dec 2004 Posts: 2421
|
Posted: Tue Feb 21, 2006 8:04 pm Post subject: |
|
|
| 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"" |
|
|
| Back to top |
|
 |
jroad
Joined: 06 Feb 2006 Posts: 26
|
Posted: Tue Feb 21, 2006 9:12 pm Post subject: |
|
|
| 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 |
|
|
| Back to top |
|
 |
corrupt
Joined: 29 Dec 2004 Posts: 2421
|
Posted: Tue Feb 21, 2006 9:38 pm Post subject: |
|
|
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. |
|
| Back to top |
|
 |
jroad
Joined: 06 Feb 2006 Posts: 26
|
Posted: Tue Feb 21, 2006 11:41 pm Post subject: |
|
|
| 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:
Is that what your code is doing or am I not understanding? |
|
| Back to top |
|
 |
corrupt
Joined: 29 Dec 2004 Posts: 2421
|
Posted: Tue Feb 21, 2006 11:47 pm Post subject: |
|
|
| Hmm... you're right. I'll try and play around with it a bit more... |
|
| Back to top |
|
 |
jroad
Joined: 06 Feb 2006 Posts: 26
|
Posted: Tue Feb 21, 2006 11:51 pm Post subject: |
|
|
| 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. |
|
| Back to top |
|
 |
corrupt
Joined: 29 Dec 2004 Posts: 2421
|
Posted: Wed Feb 22, 2006 12:25 am Post subject: |
|
|
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.  |
|
| Back to top |
|
 |
|