Jump to content
Sign in to follow this  
quielb

See If Already Running.

Recommended Posts

quielb

I want to check to see if my autoit exe is already running. Is there a way to get the PID of self?

And when I use WinGetProcess which PID will it return? The Pid of the other autoit exe or the PID of the autoit exe I just started?

I tried:

if WinGetProcess("magreader.exe") = -1 Then
   MsgBox(0,"Already Running", "The Magstripe Reader is already running use ALT-SHIFT-D to access")
   exit
EndIf

And of course it exits every time cause of course magreader.exe is running.

Share this post


Link to post
Share on other sites
Valuater

maybe

$g_szVersion = "My XP Cleaner"
If WinExists($g_szVersion) Then
    MouseMove(500,5)
    MsgBox(262208, "* NOTE * ", "*XPClean Menu* was already running  ", 5)
    SoundPlay ($Sound_lnk,1)
    Exit; It's already running
EndIf
AutoItWinSetTitle($g_szVersion)

thats what i use

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
Jos

I want to check to see if my autoit exe is already running. Is there a way to get the PID of self?

And when I use WinGetProcess which PID will it return? The Pid of the other autoit exe or the PID of the autoit exe I just started?

I tried:

if WinGetProcess("magreader.exe") = -1 Then
   MsgBox(0,"Already Running", "The Magstripe Reader is already running use ALT-SHIFT-D to access")
   exit
EndIf

And of course it exits every time cause of course magreader.exe is running.

Check out the standard udf _Singleton()

:think:


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
quielb

I can probably use ProcessList( "magreader.exe" ) to get all the running instances of magreader.exe but how do I get PID of self?

Share this post


Link to post
Share on other sites
quielb

The singelton worked perfectly

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×