AutoHotkey Community

It is currently May 26th, 2012, 3:27 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 104 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7  Next
Author Message
 Post subject:
PostPosted: March 13th, 2009, 2:16 pm 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
Sean wrote:
Quote:
StdoutToVar_CreateProcess("dir") doesn't work, you have to write
StdoutToVar_CreateProcess("cmd /K dir")
Yes, it's a normal behavior. dir is not a stand-alone application, it's an internal command of the command prompt, cmd.exe.


Thanks Sean, I thought it just does not work.
Are there any other commands that need cmd /K prefix?
Can you automate it in your function? So if a command fails cmd /k is added automatically, so it works same as in cmd?
Does it make sense?

_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun :wink:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 13th, 2009, 3:24 pm 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
HotKeyIt wrote:
Are there any other commands that need cmd /K prefix?
Just type Help in the command prompt, then you'll get a list of commands.
Quote:
Can you automate it in your function? So if a command fails cmd /k is added automatically, so it works same as in cmd?
Does it make sense?
Although it seems to make sense, I'm not sure if it'll not have any side effect.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 13th, 2009, 5:26 pm 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
Sean wrote:
HotKeyIt wrote:
Are there any other commands that need cmd /K prefix?
Just type Help in the command prompt, then you'll get a list of commands.
Quote:
Can you automate it in your function? So if a command fails cmd /k is added automatically, so it works same as in cmd?
Does it make sense?
Although it seems to make sense, I'm not sure if it'll not have any side effect.


So as far as I understand I can try to add "cmd /K " to any command to make sure it'll always work, right?

_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun :wink:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 14th, 2009, 3:46 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
HotKeyIt wrote:
So as far as I understand I can try to add "cmd /K " to any command to make sure it'll always work, right?
You're right, although I don't recommend it. If you insist to use it, however, you may perfer /c to /k.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 15th, 2009, 7:25 pm 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
Thanks Sean.

_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun :wink:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 25th, 2009, 3:39 am 
Offline

Joined: December 13th, 2006, 7:10 am
Posts: 118
Very nice and usefull script Sean; thank you for posting.

Metaxal wrote:
Sean wrote:
Metaxal wrote:
However it seems to crash without notice when the command is not correct, like:
It's not a crash, it'll just execute ExitApp if failed to create a process as it's pointless to keep running then.


Ah ok I see. Well, I d'ont like my app to exit when one function call fails ;)
Fortunatly, this can easily be changed :)


So, could we say that it is safe to simply replace that "ExitApp" with "Return" ?
Does this have side effects ?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 25th, 2009, 3:47 am 
Offline

Joined: December 13th, 2006, 7:10 am
Posts: 118
Rizzo wrote:
Are there any advantages with using the COM or not using the COM?


I'm asking to myself the same question... :roll: :?:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 25th, 2009, 5:31 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
Smurth wrote:
So, could we say that it is safe to simply replace that "ExitApp" with "Return" ?
No problem if you do clean-up yourself: CloseHandle all the created anonymous pipe handles.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 25th, 2009, 5:32 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
Quote:
Are there any advantages with using the COM or not using the COM?
They are now simply alternatives. You can use whatever you prefer.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 10th, 2009, 9:41 pm 
Offline

Joined: July 15th, 2006, 6:07 pm
Posts: 254
Didn't want to hijack this thread with a self inflicted wound but I am struggling with parameters so asked about it over on the help board HERE. Thx.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 11th, 2009, 6:07 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
wakewatcher wrote:
Didn't want to hijack this thread with a self inflicted wound but I am struggling with parameters so asked about it over on the help board HERE. Thx.
This has nothing to do with the script. You just have to properly enclose the parameters containing spaces in quotes.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 11th, 2009, 9:49 am 
Offline

Joined: July 15th, 2006, 6:07 pm
Posts: 254
yep that's why I didn't want to de-rail this thread. But I'm glad you took a look as you found the misplaced " for me! Thanks.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 6th, 2009, 11:02 am 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
Hej Sean if you are still watching.

I modified function to support ExitCode (via ErrorLevel as usual) and made some trivial changes (changed func name and slightly param names and order so its more similar to Run command)

I also made formal documentation.

I will prolly add some more features when time comes to it, like injection of environment variables, and option not to block script (like Run command does).

Cheers and thx again for this awesomeness.

Function
Documentation

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 7th, 2009, 1:49 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
majkinetor wrote:
Cheers and thx again for this awesomeness.
Thanks. Regarding ExitCode, I had prepared the following code, however, never needed to add it.
Code:
While   DllCall("GetExitCodeProcess", "Uint", hProcess, "UintP", nExitCode) && nExitCode=259
{
   Sleep,   300
   If   A_Index = 10
   {
      DllCall("TerminateProcess", "Uint", hProcess, "Uint", 0)
      Break
   }
}


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Noob questions..
PostPosted: July 7th, 2009, 7:02 am 
Two noob questions..

1. The ExitApp problem, i dont want my app to exit.. any help

Code:
   If Not   DllCall("CreateProcess", "Uint", 0, "Uint", &sCmd, "Uint", 0, "Uint", 0, "int", True, "Uint", 0x08000000, "Uint", 0, "Uint", sDir ? &sDir : 0, "Uint", &si, "Uint", &pi)   ; bInheritHandles and CREATE_NO_WINDOW
      ExitApp


2. What is best, as i am going to distribute the script that calls Rasdial.exe

- RASDIAL "%connection%" /disconnect
OR
- %comspec% /c RASDIAL "%connection%" /disconnect

Thanks..


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 104 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Google [Bot], Google Feedfetcher and 17 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