My app is a commandline application with a GUI for its settings.
If you run the program without parameters it opens the GUI.
But if you run it with parameters, it runs the script without any GUI.
I have the script set to look for commandline parameters and if there are none, it will launch the GUI, if not, it will run it's sequence and then exit.
Well, that's what is supposed to happen.
What happens is, if the GUI is open, the second instance kills the first one.
If I turn #SingleInstance to off, then it lets the user open multiple options GUIs which I don't want.
Here's what I want:
1. Be able to run the GUI instance and commandline instances at the same time.
2. Not be able to open two GUIs.
3. Have the commandline instances to not kill the GUI instance.
Maybe if there was a way to detect a previously running instance of the application?
gui that allows cmdline executions
Re: gui that allows cmdline executions
Hmmm, I think I might have figured it out (always happens after I post).
I only need to kill the second instance of the gui.
If I do this, then it leaves any first instance alone, but if I call it with parameters, it allows the hidden instance to run.
I only need to kill the second instance of the gui.
If I do this, then it leaves any first instance alone, but if I call it with parameters, it allows the hidden instance to run.
Code: Select all
#singeinstance, off
if not %0%
{
winget, windowcount,Count,%appname%
if(windowcount > 1){
exitapp
}
gosub, MAINWINDOW
}else{
loop %0%
givenpath := %a_index%
{
loop %givenpath%, 1
{
msgbox, %a_loopfilelongpath%
}
}
exitapp ;end the program now
}
My Stuff: mousey; volume; ahkinfo; instantbirder; npp highlighter; Dynamic File Menu; tv - a treeview library;
Re: gui that allows cmdline executions
I think that's the idea. I have some GUI setups where I give the GUI a particular name (window title) so that I can easily have a separate script identify it. That approach can be a helpful adjunct.
Re: gui that allows cmdline executions
Funny, this code works on my own computer, but doesn't work on others. I tried it on another computer and it keeps the gui from launching the first time, not the second.
My Stuff: mousey; volume; ahkinfo; instantbirder; npp highlighter; Dynamic File Menu; tv - a treeview library;
Re: gui that allows cmdline executions
You can debug it by breaking it down into steps. Eliminate the initial directive. Have the script display the command line, so that you can verify it. Display the window count, so that you can verify that. Etc.
Who is online
Users browsing this forum: Mannaia666, peter_ahk and 152 guests