Home | Blog | Software | Reviews and Features | Forum | Help | Donate | About us
topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • September 03, 2015, 12:11:25 PM
  • Proudly celebrating 10 years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: DONE: Single Application Instance  (Read 19571 times)

richardsugg

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 4
    • View Profile
    • Donate to Member
DONE: Single Application Instance
« on: March 03, 2006, 11:32:17 AM »
I would love to see an application that would prevent more than one instance of an application from opening.  For instance, I use Bibleworks, but it allows multiple instances, which I don't like.  It also opens up other windows that are a part of an instance of the application.  In other words, The single instance application can't go by the window title, but would have to go by the process name.

Thanks!
Richard
« Last Edit: March 07, 2006, 01:35:52 AM by brotherS »

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 35,007
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Donate to Member
Re: Single Application Instance
« Reply #1 on: March 03, 2006, 11:55:40 AM »
richard, this is a nice idea that can be reasonably added to a program like our find+run robot and new launch bar program - i will be adding such features in the near future, so that you can tell it that it should bring any currently running instance to the foreground instead of launching a new process.

skrommel

  • Fastest code in the west
  • Developer
  • Joined in 2005
  • ***
  • Posts: 886
    • View Profile
    • 1 Hour Software by skrommel
    • Donate to Member
Re: Single Application Instance
« Reply #2 on: March 03, 2006, 02:03:48 PM »
 :) I seem to remember that my SingleApp tool will do this if you specify the class.

You find the thread here: http://www.donationcoder.com/forum/index.php?topic=1826.0.


Sorry, months since I made that one... But maybe a v2.0 is needed?

Skrommel
Please stop by my site at  1 Hour Software by skrommel  for downloads and more info.
« Last Edit: March 03, 2006, 02:06:09 PM by skrommel »

wr975

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 369
    • View Profile
    • Donate to Member
Re: Single Application Instance
« Reply #3 on: March 03, 2006, 03:46:40 PM »
Until mouser or skrommel come up with some better solution, you could just use a custom Authotkey script to start your application. Just change PROCESSNAME and PATH/APP.EXE.

Code: [Select]
process,exist,PROCESSNAME
if errorlevel = 0
    run,PATH/APP.EXE
else
    WinActivate, ahk_pid %errorlevel%
« Last Edit: March 03, 2006, 03:50:52 PM by wr975 »

skrommel

  • Fastest code in the west
  • Developer
  • Joined in 2005
  • ***
  • Posts: 886
    • View Profile
    • 1 Hour Software by skrommel
    • Donate to Member
Re: Single Application Instance
« Reply #4 on: March 04, 2006, 02:45:45 PM »
 :) Try this one!

SingleInstance - Only allow one instance of a program to run.

Features:
- User defined programs.
- Option to detect hidden programs.
- Won't close instances started before SingleInstance.

You'll find the downloads and more info at 1 Hour Software by Skrommel.

AutoHotkey doesn't support global messagehooks, so I couldn't catch the programs before they were created, but I hope you can live with the "flicker".

Skrommel
Please stop by my site at  1 Hour Software by skrommel  for downloads and more info.
« Last Edit: March 04, 2006, 02:59:00 PM by skrommel »

Hirudin

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 543
    • View Profile
    • Donate to Member
Re: DONE: Single Application Instance
« Reply #5 on: March 30, 2006, 01:38:06 AM »
Whoa, don't turn the response time down to "0"! I had it like that for a while, then noticed my CPU usage was at 50%! After turning off Single Instance it dropped down to ~0%, and after starting SI again it went to 50% again!
After starting Single Instance again, confirming the CPU usage was 50% I changed the response time back to "1" which brought the CPU usage back to ~0%.

Screenshot - 3_30_2006 , 12_24_54 AM.png

saddler

  • Participant
  • Joined in 2007
  • *
  • default avatar
  • Posts: 2
    • View Profile
    • Donate to Member
Re: DONE: Single Application Instance
« Reply #6 on: August 29, 2007, 08:36:31 AM »
hi!

can you make this application to find the duplicated application by performing a window title check instead of PID?
i've seen that you can put something like this:
WinGetTitle, title, ahk_id %wID%,,,$ 
to get the window title but i don't know this scripting language to modify your tool, so can you help?
i need a program to monitor the programs are running by the window_title because i need to block some users in the company i work to open more than one specific web-based application, but in the same time to still have access to other sites.
For eg. let's say we have Test1 web-based application and the IE window title will be Test1 - Microsoft Internet Explorer. They also use Test2 and Test3 from IE, but Test1 should be opened only once.

So... anyone with an idea? Can you give me the code, at least, and to compile it by myself?

Thanks in advance!
Cristian

I tryed google to find something like this and your application was the closest to what i want. There is also another one, PWone.exe, a command line tool but that one can't be found for download anymore.

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 35,007
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Donate to Member
Re: DONE: Single Application Instance
« Reply #7 on: August 29, 2007, 06:09:22 PM »
Quote
So... anyone with an idea? Can you give me the code, at least, and to compile it by myself?

I think all of skrommel's downloads come with source code in ahk format.

ps. don't forget to consider sending skrommel a donation if you like his stuff  :up:

saddler

  • Participant
  • Joined in 2007
  • *
  • default avatar
  • Posts: 2
    • View Profile
    • Donate to Member
Re: DONE: Single Application Instance
« Reply #8 on: August 29, 2007, 06:36:03 PM »
i know he has posted the source code but my programming skills aren't that good  8)
that's why i'm asking help here :)

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 35,007
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Donate to Member
Re: DONE: Single Application Instance
« Reply #9 on: August 29, 2007, 07:01:46 PM »
Oh sorry i misunderstood your request for the source code, now i see you were asking for some help with the not yet written source code for the features you are asking for. sorry! hopefully one of the ahk coders here will help.

RobC

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 21
    • View Profile
    • Donate to Member
Re: DONE: Single Application Instance
« Reply #10 on: December 03, 2009, 07:05:30 AM »
I am trying to prevent multiple instances of FireFox.
I tried with SingleInstance, but cannot get it to work (with FF).
Is there a trick as to what I should list in your Options Dialog ?
EG any of these ? 
firefox
firefox.exe
C:\Program Files\Mozilla Firefox\firefox.exe

Thanks,
Rob

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 4,393
    • View Profile
    • Donate to Member
Re: DONE: Single Application Instance
« Reply #11 on: December 03, 2009, 07:53:11 AM »
Please try this bit of AHK code.  I've written it as a shell hook that should only allow one instance of Firefox to exist.

Code: AutoIt
  1. Gui +LastFound
  2. hWnd := WinExist()
  3. DllCall( "RegisterShellHookWindow", UInt, hWnd )
  4. MsgNum := DllCall( "RegisterWindowMessage", Str, "SHELLHOOK" )
  5. OnMessage( MsgNum, "ShellMessage" )
  6. DetectHiddenWindows, On
  7. SetTitleMatchMode, 2
  8.  
  9. ShellMessage( wParam, lParam )
  10. {
  11.     WinGetClass, myClass, ahk_id %lParam%
  12.    
  13.     If ( wParam = 1 ) ; HSHELL_WINDOWCREATED
  14.     {
  15.         If ( InStr( myClass, "MozillaUIWindowClass" ) )
  16.         {
  17.             WinGet, myList, List, ahk_class MozillaUIWindowClass
  18.             If ( myList > 1 )
  19.             {
  20.                 WinClose, % "ahk_id " . lParam
  21.             }
  22.         }
  23.     }
  24. }
  25.  

RobC

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 21
    • View Profile
    • Donate to Member
Re: DONE: Single Application Instance
« Reply #12 on: December 03, 2009, 11:02:08 AM »
Thanks for that.
Could you advise what program to use to 'compile' it, and how to do it ?
Or, attach a compiled version.

Rob

srhamy

  • Participant
  • Joined in 2009
  • *
  • default avatar
  • Posts: 3
    • View Profile
    • Donate to Member
Re: DONE: Single Application Instance
« Reply #13 on: December 03, 2009, 02:03:05 PM »

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 4,393
    • View Profile
    • Donate to Member
Re: DONE: Single Application Instance
« Reply #14 on: December 03, 2009, 02:52:56 PM »
Here you go.  Source/binary download