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 

The programms close right after starting them.
Goto page 1, 2  Next
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
MaienM
Guest





PostPosted: Mon Oct 15, 2007 5:49 pm    Post subject: The programms close right after starting them. Reply with quote

I created a script that shows a small menu, to start a aplication (to make my shortcuts menu less crowded)
When I run this script and I choose Start Server, the programms open and then close again.
Could someone please tell me what I am doing wrong?

Code:
#Singleinstance Force
Menu, wow, add, Start WoW, WOW
Menu, wow, add
Menu, wow, add, Start Server, Ascent
Menu, wow, add
Menu, wow, add, Navicat, Navicat
Menu, wow, add, Db Editor, DB
Menu, wow, Show
return

WOW:
Run C:\Games\World of Warcraft 2.1.3\WoW.bat
Process, priority, WoW.exe, High
return

Ascent:
Run C:\AC Web Ultimate Repack\Ascent\logonserver.exe
Process, wait, logonserver.exe, 1
Process, priority, logonserver.exe, High
Run C:\AC Web Ultimate Repack\Ascent\ascent.exe
Process, wait, ascent.exe, 1
Process, priority, ascent.exe, High
return

Navicat:
Run C:\Program Files\PremiumSoft\Navicat 8.0 MySQL\navicat.exe
return

DB:
Run C:\Documents and Settings\HP_Administrator\Mijn documenten\Zooi\AscentDBEditor.exe
return


P.S. Sorry for my english, I'm dutch.
Back to top
engunneer



Joined: 30 Aug 2005
Posts: 6772
Location: Pacific Northwest, US

PostPosted: Mon Oct 15, 2007 6:35 pm    Post subject: Reply with quote

#persistent?
_________________
Unless otherwise noted, all code is untested.
Common Answers: 1.(Loops, Viruses, etc.) 2. Search 3.RTFM
Back to top
View user's profile Send private message Visit poster's website
MaienM
Guest





PostPosted: Mon Oct 15, 2007 6:53 pm    Post subject: Reply with quote

That prevents the script itself from closing, right.
Could do that, but is that really the only solution?
That way my systray gets a little too crowded.
But it IS a solution, I think, so I'll give it a try.
Back to top
MaienM
Guest





PostPosted: Mon Oct 15, 2007 6:56 pm    Post subject: Reply with quote

I tried it, it still doesnt work:D
Back to top
BoBoĻ
Guest





PostPosted: Mon Oct 15, 2007 7:00 pm    Post subject: Reply with quote

Quote:
That way my systray gets a little too crowded
#NoTrayIcon ?
Back to top
Lexikos



Joined: 17 Oct 2006
Posts: 2558
Location: Australia, Qld

PostPosted: Tue Oct 16, 2007 5:17 am    Post subject: Re: The programms close right after starting them. Reply with quote

MaienM wrote:
I created a script that shows a small menu, to start a aplication (to make my shortcuts menu less crowded)
When I run this script and I choose Start Server, the programms open and then close again.
Could someone please tell me what I am doing wrong?
There doesn't appear to be anything that should terminate the program(s). They are probably closing on their own for some unrelated reason, or perhaps as a reaction to having their priority set. Confused

Check ErrorLevel after Process, wait, if you're not already sure that they're actually starting.
help wrote:
If a matching process is discovered, ErrorLevel is set to its Process ID (PID). If the command times out, ErrorLevel is set to 0.

MaienM wrote:
P.S. Sorry for my english, I'm dutch.
I'd never have guessed. Your English seems better than many native English-speakers. Laughing
Back to top
View user's profile Send private message
MaienM
Guest





PostPosted: Tue Oct 16, 2007 8:19 am    Post subject: Reply with quote

lexikos wrote:
MaienM wrote:
P.S. Sorry for my english, I'm dutch.
I'd never have guessed. Your English seems better than many native English-speakers. Laughing

Thanks:D

The programms dont terminate when I manually change their priority, and I am quite sure they do actually start up, I see them start and about 1 second later they close again.
I allready tried if #persistent works, it didn't make a difference.
If I manually run the programms, or if I run them by using a .bat file, they do not close.
I also tried to let the AHK script open that .bat file, but they still close:(
I hope someone knows anything about this, it is kind of iritating:DVery Happy

Maybe it helps to know that it are programms which run in dos windows.
I've got to go now, I''ve got maths:(Sad (@school now)
Back to top
Lexikos



Joined: 17 Oct 2006
Posts: 2558
Location: Australia, Qld

PostPosted: Tue Oct 16, 2007 10:50 am    Post subject: Reply with quote

Quote:
Maybe it helps to know that it are programms which run in dos windows.
Not really. Console applications (aka "programs which run in dos windows") aren't really any different from normal windows applications. They just usually don't have any windows...
Quote:
If I manually run the programms, or if I run them by using a .bat file, they do not close.

When one process (i.e. AutoHotkey.exe) launches another, the "child process" usually inherits the "environment" of the process that launched it. (For instance, environment variables like %temp% or %windir%, as you would use in a .bat file.)
Quote:
I also tried to let the AHK script open that .bat file, but they still close:(
Any files launched by the .bat file would inherit the environment of the .bat file, which would have inherited the environment of AutoHotkey. Confused

Which version of Windows are you on? Windows XP (iirc) and Vista have "compatibility features" that are inherited as a side-effect of inheriting environment variables. Specifically, the environment variable __COMPAT_LAYER may override any compatibility settings that may be configured for whatever process you are launching. Using the following before using 'run' usually prevents this.
Code:
EnvSet, __COMPAT_LAYER
(I'd consider this a long-shot, btw.)
Back to top
View user's profile Send private message
Guest






PostPosted: Tue Oct 16, 2007 2:35 pm    Post subject: Reply with quote

Quote:

Quote:
If I manually run the programms, or if I run them by using a .bat file, they do not close.

When one process (i.e. AutoHotkey.exe) launches another, the "child process" usually inherits the "environment" of the process that launched it. (For instance, environment variables like %temp% or %windir%, as you would use in a .bat file.)


You are losing me here..
I know how to launch a programm from a .bat (allright, I addmit, I stole it out of a .bat file I had lying around), but thats just as far as my knowledge of .bat files goes.

I use Windows Xp MCE, maybe that is the problem??

Quote:
EnvSet, __COMPAT_LAYER

I tried adding this, it didn't work SadSad

My code now looks like this, I added the thing you guys suggested.
Code:
#Persistent
#Singleinstance Force
Menu, wow, add, Start WoW, WOW
Menu, wow, add
Menu, wow, add, Start Server, Ascent
Menu, wow, add
Menu, wow, add, Navicat, Navicat
Menu, wow, add, Db Editor, DB
Menu, wow, Show
return

WOW:
Run C:\Games\World of Warcraft 2.1.3\WoW.bat
Process, priority, WoW.exe, High
return

Ascent:
EnvSet, __COMPAT_LAYER
Run C:\AC Web Ultimate Repack\Logon\logonserver.exe
Process, wait, logonserver.exe, 1
Process, priority, logonserver.exe, High
EnvSet, __COMPAT_LAYER
Run C:\AC Web Ultimate Repack\Realm 1\ascent.exe
Process, wait, ascent.exe, 1
Process, priority, ascent.exe, High
return

Navicat:
Run C:\Program Files\PremiumSoft\Navicat 8.0 MySQL\navicat.exe
return

DB:
Run C:\Documents and Settings\HP_Administrator\Mijn documenten\Zooi\AscentDBEditor.exe
return
Back to top
Lexikos



Joined: 17 Oct 2006
Posts: 2558
Location: Australia, Qld

PostPosted: Tue Oct 16, 2007 2:53 pm    Post subject: Reply with quote

Well, I'm out of ideas. Sad I keep thinking there is something I'm forgetting. Something to do with how a process is launched...
Back to top
View user's profile Send private message
gtmattz



Joined: 29 Mar 2007
Posts: 38

PostPosted: Tue Oct 16, 2007 3:44 pm    Post subject: Reply with quote

Is this the whole script?

I copied your code and substituted applications on my PC for all the programs in yours, as I dont have the same ones, but regardless, the script functioned perfectly well for me.

Is this menu embedded in a larger script? It is possible that there is something else in the script that is causing the programs to close.

The code you pasted initially is correct however, and it works fine.
_________________
Code:
If (IQ < ShoeSize)
{
    Sympathy := 0
}
Back to top
View user's profile Send private message
MaienM
Guest





PostPosted: Wed Oct 17, 2007 10:21 am    Post subject: Reply with quote

It is the whole script, I run it by making a shortcut/icon for it in rocketdock.
The problem also exist with the WoW.bat, which is also a console application.
I still think the problem is that it are console apps, the other progamms don't have this problem.
Strange, uh?
Back to top
Superfraggle



Joined: 02 Nov 2004
Posts: 846
Location: London, UK

PostPosted: Wed Oct 17, 2007 11:38 am    Post subject: Reply with quote

Try This

Code:
Run,cmd /k WoW.bat


The forwardslash k forces the command line window to stay open so you can see what it says, Why its not running.

Im guessing you may just have to set the working directory of each one.
_________________
Steve F AKA Superfraggle

http://r.yuwie.com/superfraggle
Back to top
View user's profile Send private message MSN Messenger
ToLazyToLogIn
Guest





PostPosted: Sun Oct 21, 2007 3:58 pm    Post subject: Reply with quote

Hello,

i got the same problem with my script, it has something to do with the Run command, some programs don't have a problem to become started through it, but others do.

I haven't found a fix for it so far, so i would be pleased to get a solution also Smile
Back to top
ToLazyToLogin
Guest





PostPosted: Sun Oct 21, 2007 4:25 pm    Post subject: Reply with quote

Ok, i guess i've found the problem.

The space within the names (folder and files) is what the run command through AHK can't handle.
It works quite good with any programs which doesnt have a space within their names (like c:\games\tetris.exe)

As soon as you got a space somewhere, the run command doesnt work anymore (like c:\my games\tetris game.exe).

I tried to rename some folders or names but then again some programs dont work properly anymore.

Does anyone got an idea how to fix that problem pls?

Thanks to Superfraggle for his tip, the console gave me the reply: can't find file c:\my (when i tried to run c:\my games...), this way i found out that the space is the problem.

Thx, Shasaar
Back to top
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
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