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 

Run/RunWait with parameters not working

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Icarus



Joined: 24 Nov 2005
Posts: 507

PostPosted: Fri Sep 19, 2008 12:18 am    Post subject: Run/RunWait with parameters not working Reply with quote

Either I am too tired or something is wrong...

Trying to call a script/executable with command line parameters but with no success.

Here is a test script which will call itself with a command line parameter.

Code:

#SingleInstance Force

exec := A_ScriptName
params = %1%

If( params = "" )
   RunWait "%exec%" "hello world"   
Else
   msgbox %params%

ESC::ExitApp


I get an error "failed to launch".
Anyone?
_________________
Sector-Seven (Music and Utilities)
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger
[VxE]



Joined: 07 Oct 2006
Posts: 1496

PostPosted: Fri Sep 19, 2008 5:38 am    Post subject: Reply with quote

Code:
#SingleInstance Force

exec := A_ScriptFullPath ; not A_ScriptName
params = %1%

If( params = "" )
   RunWait %A_AhkPath% "%exec%" "hello world"
; when passing parameters to an uncompiled script, use this method
; since you really shouldn't try to pass parameters to a non-exe
Else
   msgbox %params%

ESC::ExitApp

Question
_________________
My Home Thread
More Common Answers: [1]. It's in the FAQ [2]. Ternary ( a ? b : c ) guide [3]. Post code inside [code][/code] tags !
Back to top
View user's profile Send private message
Icarus



Joined: 24 Nov 2005
Posts: 507

PostPosted: Fri Sep 19, 2008 5:55 am    Post subject: Reply with quote

Thanks man, didnt think about it.
Although, I see no reason why it cannot work without it.

I mean - if you go to command line and run this script, it does work.
C:\>Test.ahk "hello world"

works - so its only a problem of AHK?

Anyways - this is helpful so thanks Smile .
_________________
Sector-Seven (Music and Utilities)
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   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