 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
MaienM Guest
|
Posted: Mon Oct 15, 2007 5:49 pm Post subject: The programms close right after starting them. |
|
|
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
|
Posted: Mon Oct 15, 2007 6:35 pm Post subject: |
|
|
#persistent? _________________
Unless otherwise noted, all code is untested.
Common Answers: 1.(Loops, Viruses, etc.) 2. Search 3.RTFM |
|
| Back to top |
|
 |
MaienM Guest
|
Posted: Mon Oct 15, 2007 6:53 pm Post subject: |
|
|
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
|
Posted: Mon Oct 15, 2007 6:56 pm Post subject: |
|
|
| I tried it, it still doesnt work:D |
|
| Back to top |
|
 |
BoBoĻ Guest
|
Posted: Mon Oct 15, 2007 7:00 pm Post subject: |
|
|
| Quote: | | That way my systray gets a little too crowded | #NoTrayIcon ? |
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 2558 Location: Australia, Qld
|
Posted: Tue Oct 16, 2007 5:17 am Post subject: Re: The programms close right after starting them. |
|
|
| 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.
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.  |
|
| Back to top |
|
 |
MaienM Guest
|
Posted: Tue Oct 16, 2007 8:19 am Post subject: |
|
|
| 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.  |
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:D
Maybe it helps to know that it are programms which run in dos windows.
I've got to go now, I''ve got maths:( (@school now) |
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 2558 Location: Australia, Qld
|
Posted: Tue Oct 16, 2007 10:50 am Post subject: |
|
|
| 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.
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 |
|
 |
Guest
|
Posted: Tue Oct 16, 2007 2:35 pm Post subject: |
|
|
| 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 
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
|
Posted: Tue Oct 16, 2007 2:53 pm Post subject: |
|
|
Well, I'm out of ideas. I keep thinking there is something I'm forgetting. Something to do with how a process is launched... |
|
| Back to top |
|
 |
gtmattz
Joined: 29 Mar 2007 Posts: 38
|
Posted: Tue Oct 16, 2007 3:44 pm Post subject: |
|
|
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 |
|
 |
MaienM Guest
|
Posted: Wed Oct 17, 2007 10:21 am Post subject: |
|
|
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
|
Posted: Wed Oct 17, 2007 11:38 am Post subject: |
|
|
Try This
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 |
|
 |
ToLazyToLogIn Guest
|
Posted: Sun Oct 21, 2007 3:58 pm Post subject: |
|
|
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  |
|
| Back to top |
|
 |
ToLazyToLogin Guest
|
Posted: Sun Oct 21, 2007 4:25 pm Post subject: |
|
|
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 |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|