View Full Version : Single Instance
SwiperTheFox
07-01-2011, 03:28 PM
My updater will keep running as many times as you click on it. So I can have up to like 5 updaters at the same time... I was searching the forums and found this thread.
http://www.indigorose.com/forums/threads/24815-Close-Exe-during-update
In there I see Jassing said
I prefer to just detect that the exe is running and refuse to continue until the exe is closed...
How can I accomplish this? I was trying to use something like System.EnumerateProcesses but I also rather not have a pop up message saying its already running. I want it to just not run at all if 1 instance of the updater is already running with no error or pop up message.
Ulrich
07-01-2011, 04:01 PM
At the beginning of your Client Script, use Window.EnumerateProcesses() or Window.EnumerateTitles() to look for an existing instance of your updater. If there is one, exit the current program with Application.Exit() before showing any screens or downloading any files.
Ulrich
SwiperTheFox
07-04-2011, 07:05 PM
I'm trying to use Window.EnumerateProcesses but I can't get it to work. I am a beginner at scripting in TU just so you know. I have learned a lot (forums+help file) and I'm almost done with my first project but this thing I just can't nail. I've been stuck on it for an entire day. I don't understand this part
for j, file_path in processes do
file = String.SplitPath(file_path);
if (String.Lower(file.Filename..file.Extension)) == file_to_check_for then
instances_of_file = instances_of_file + 1;
end
end
The strings have me confused.
Assuming my file is called "My_Updater.exe" and its in "C:\\MyFolder". How would I write it out?
SwiperTheFox
07-16-2011, 05:52 PM
Anyone? This is the final part of my project and I'm stuck here.
jassing
07-17-2011, 04:19 PM
Assuming my file is called "My_Updater.exe" and its in "C:\\MyFolder". How would I write it out?
Just like that.
SwiperTheFox
07-18-2011, 10:49 AM
I've been trying. I either get it to where it keeps running multiple instances still, or it says its already running when its not. That's why I wanna see an example (besides the one in the help file) so I can not only use it, but to understand it as well.
Brian Belanger
07-18-2011, 12:29 PM
Hey, I happen to be working on the same thing. I found this from their MindQuake site:
Single Instance
(http://www.mindquake.com.br/en/code/109-singleinstance)
I'll let you know if I get it to work and how. Otherwise, you can let me know, if you beat me to it. :)
Brian
jassing
07-18-2011, 03:55 PM
Is file_to_check_for lower case, upper case, or mixed?
SwiperTheFox
07-18-2011, 06:16 PM
I have mine set in lowercase.
Powered by vBulletin™ Version 4.0.6 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.