Jump to content
Sign in to follow this  
ainner

Detecting that another autoit is already running

Recommended Posts

ainner

Is it possible to detect that an AutoIt exe file is already running without knowing it's name.

For example :

I wanna run Fruit.exe but I don't want it to start if there's another autoit already running.

It would be easy to do an "If ProcessExists" but I have no idea what can be running since they are many autoit process that are trigger depending on the user.

Thx

Edited by ainner

Share this post


Link to post
Share on other sites
schilbiz

Q3. How can I prevent more than one copy of my script from running at once / detect another copy of my script running?

A1. You can use a function called _Singleton to detect multiple instances of your script. An example of how to use this code:

CODE: AutoIt

#include <Misc.au3>
_Singleton("TheNameOfMyScript")

In this instance, the script will immediately exit if there is already one copy running. If you simply want know if another copy is running,

you can use code similar to the next example:

CODE:

AutoIt

#include <Misc.au3>
If _Singleton("MyScriptName", 1) Then
 ; We know the script is already running. Let the user know.
    MsgBox(0, "Script Name", "This script is already running. Using multiple copies of this script at the same breaks the [(UltimaCoder)] License!")
    Exit
Endif

This is from the FAQs

Edited by schilbiz

Share this post


Link to post
Share on other sites
Emiel Wieldraaijer

??????????????

basicly you are saying

I run one program which is made in AutoIt and i will not allow another program which is written in AutoIt !

if this is correct .. good luck ..

otherwise .. if you want to check if your program is run and you do not want people to rename the exe

- First do a check for the existense of a ini file which is created later

- Let the program create an inifile in the temp folder when it's started

- Use adlib enable function to check if the ini file isn't deleted otherwise recreate it


Best regards,Emiel Wieldraaijer

Share this post


Link to post
Share on other sites
schilbiz

I see what you are asking, you want to be able to tell if some other Autoit script is running but you don't know which? The FAQ suggestion seems to only work if you are trying to run it but know which .exe you are running.

That may be tough to do.

Edited by schilbiz

Share this post


Link to post
Share on other sites
ainner

Yeah, I got a form running in the Run key and the user gotta click on "Accept" for it to close then I delete the run entry in the registry. The thing is I don't want another autoit to start installing an application on top of my form when the user open a session.

Since we're making new scripts every week I can't block them all unless there's a way to know if there's already another autoit that is curently running.

Edited by ainner

Share this post


Link to post
Share on other sites
SmOke_N

Yeah, I got a form running in the Run key and the user gotta click on "Accept" for it to close then I delete the run entry in the registry. The thing is I don't another autoit to start installing an application on top of my form when the user open a session.

Since we're making new scripts every week I can't block them all unless there's a way to know if there's already another autoit that is curently running.

Just use _Singleton() in your scripts from now on... Unless you want to hunt through every old exe you've sent out and check it's checksum and delete it when found.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites
rover

easy

all AutoIt programs have a hidden window titled AutoIt v3

use winlist and parse results

Edited by rover

I see fascists...

Share this post


Link to post
Share on other sites
SmOke_N

easy

all AutoIt programs have a hidden window titled AutoIt v3

use winlist and parse results

That would prevent "any" autoit script from running, I was under the impression he/she was only wanting to stop a specific one they made... Is this incorrect?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites
ainner

easy

all AutoIt programs have a hidden window titled AutoIt v3

use winlist and parse results

I'll try that and I'll give you feedback thx <_<

Share this post


Link to post
Share on other sites
ainner

That would prevent "any" autoit script from running ...

That's what I want.

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.