Ulrich's code below posted back in 2011... stops current program from starting if instance of program is already running. I have been playing with it for several days trying to make it close the "running program" and then starting fresh program.
I am asking for a piece of code that would close the running instance of "myprog" before starting the new instance of "myprog". kindest regards and thank you for all replies.
I am asking for a piece of code that would close the running instance of "myprog" before starting the new instance of "myprog". kindest regards and thank you for all replies.
Code:
-- There can be only one! local highlander = 0; applications = Window.EnumerateTitles(true); for handle, title in pairs(applications) do if (String.Find(title, "Highlander - Powered by AutoPlay Media Studio", 1, false) ~= -1) then highlander = highlander + 1; end end if (highlander > 0) then -- Another instance of the application is already running g_SilentShutdown = true; Window.Close(Application.GetWndHandle(), CLOSEWND_TERMINATE); else g_SilentShutdown = false; end
Comment