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 

StdoutToVar
Goto page Previous  1, 2, 3, 4, 5, 6, 7  Next
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
HotKeyIt



Joined: 18 Jun 2008
Posts: 2196
Location: GERMANY

PostPosted: Fri Mar 13, 2009 2:16 pm    Post subject: Reply with quote

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?
_________________
AutoHotFile - ToolTip(n,text,title,options) Wink
Back to top
View user's profile Send private message
Sean



Joined: 12 Feb 2007
Posts: 2219

PostPosted: Fri Mar 13, 2009 3:24 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
HotKeyIt



Joined: 18 Jun 2008
Posts: 2196
Location: GERMANY

PostPosted: Fri Mar 13, 2009 5:26 pm    Post subject: Reply with quote

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?
_________________
AutoHotFile - ToolTip(n,text,title,options) Wink
Back to top
View user's profile Send private message
Sean



Joined: 12 Feb 2007
Posts: 2219

PostPosted: Sat Mar 14, 2009 3:46 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
HotKeyIt



Joined: 18 Jun 2008
Posts: 2196
Location: GERMANY

PostPosted: Sun Mar 15, 2009 7:25 pm    Post subject: Reply with quote

Thanks Sean.
_________________
AutoHotFile - ToolTip(n,text,title,options) Wink
Back to top
View user's profile Send private message
Smurth



Joined: 13 Dec 2006
Posts: 104

PostPosted: Sat Apr 25, 2009 3:39 am    Post subject: Reply with quote

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 Wink
Fortunatly, this can easily be changed Smile


So, could we say that it is safe to simply replace that "ExitApp" with "Return" ?
Does this have side effects ?
Back to top
View user's profile Send private message
Smurth



Joined: 13 Dec 2006
Posts: 104

PostPosted: Sat Apr 25, 2009 3:47 am    Post subject: Reply with quote

Rizzo wrote:
Are there any advantages with using the COM or not using the COM?


I'm asking to myself the same question... Rolling Eyes Question
Back to top
View user's profile Send private message
Sean



Joined: 12 Feb 2007
Posts: 2219

PostPosted: Sat Apr 25, 2009 5:31 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
Sean



Joined: 12 Feb 2007
Posts: 2219

PostPosted: Sat Apr 25, 2009 5:32 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
wakewatcher



Joined: 15 Jul 2006
Posts: 200

PostPosted: Sun May 10, 2009 9:41 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
Sean



Joined: 12 Feb 2007
Posts: 2219

PostPosted: Mon May 11, 2009 6:07 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
wakewatcher



Joined: 15 Jul 2006
Posts: 200

PostPosted: Mon May 11, 2009 9:49 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
majkinetor



Joined: 24 May 2006
Posts: 4116
Location: Belgrade

PostPosted: Mon Jul 06, 2009 11:02 am    Post subject: Reply with quote

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
_________________
Back to top
View user's profile Send private message
Sean



Joined: 12 Feb 2007
Posts: 2219

PostPosted: Tue Jul 07, 2009 1:49 am    Post subject: Reply with quote

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
   }
}
Back to top
View user's profile Send private message
shajul_offline
Guest





PostPosted: Tue Jul 07, 2009 7:02 am    Post subject: Noob questions.. Reply with quote

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..
Back to top
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page Previous  1, 2, 3, 4, 5, 6, 7  Next
Page 5 of 7

 
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