tttommeke Posted December 30, 2007 Share Posted December 30, 2007 Somethimes you have programs that are only allowed to run once so when the user looks in processlist their won't be like 100X{Program}. This is a function that will look if the program isn't started yet by previous users and if it is he will close himself down (You can add easily a msgbox or so with it) Func _AlreadyRunning() If ProcessExists(@Scriptname) Then $list = ProcessList() for $i = 1 to $list[0][0] If $list[$i][0] = @ScriptName And $list[$i][1] <> @AutoItPID Then Exit EndIf Next EndIf EndFunc Link to comment Share on other sites More sharing options...
ashley Posted December 30, 2007 Share Posted December 30, 2007 sorry to brake the news but this is alot quicker. #include<Misc.au3> _Singleton("Filename", 0) Free icons for your programs Link to comment Share on other sites More sharing options...
martin Posted December 30, 2007 Share Posted December 30, 2007 Somethimes you have programs that are only allowed to run once so when the user looks in processlist their won't be like 100X{Program}. This is a function that will look if the program isn't started yet by previous users and if it is he will close himself down (You can add easily a msgbox or so with it) Func _AlreadyRunning() If ProcessExists(@Scriptname) Then $list = ProcessList() for $i = 1 to $list[0][0] If $list[$i][0] = @ScriptName And $list[$i][1] <> @AutoItPID Then Exit EndIf Next EndIf EndFunc As ashley says, but also it's too easy for someone to rename an exe and then your method would fail I think. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
gseller Posted December 31, 2007 Share Posted December 31, 2007 Sweet!! I like the smaller one.. LOL Link to comment Share on other sites More sharing options...
WeMartiansAreFriendly Posted January 1, 2008 Share Posted January 1, 2008 (edited) As ashley says, but also it's too easy for someone to rename an exe and then your method would fail I think.@Scriptname is dynamic, but I believe it would be inaccurate if another process had the same name other than the script. Edited January 1, 2008 by mrRevoked Don't bother, It's inside your monitor!------GUISetOnEvent should behave more like HotKeySet() Link to comment Share on other sites More sharing options...
DirtDBaK Posted January 1, 2008 Share Posted January 1, 2008 ture its dynamic but your right you could run it, rename it, then run it again... I always used _Singleton() and it worked fine for my purpose... [center][/center] Link to comment Share on other sites More sharing options...
ghetek Posted January 9, 2008 Share Posted January 9, 2008 ack!!! nerds bickering run for the hills! Link to comment Share on other sites More sharing options...
DirtDBaK Posted January 9, 2008 Share Posted January 9, 2008 ack!!! nerds bickering run for the hills!Dude shut the hell up... [center][/center] Link to comment Share on other sites More sharing options...
ghetek Posted January 9, 2008 Share Posted January 9, 2008 Dude shut the hell up...Whoa, just messing around man. Don't take offense. Link to comment Share on other sites More sharing options...
DirtDBaK Posted January 9, 2008 Share Posted January 9, 2008 k well newbie's bother me, and I'm not really to nice to them all the time. Mainly ones that like to create bots or 'pranks' On the other hand I am really cool to newbies that want to actually learn things, I'm always open to hear about their Ideas and help them write scripts.. [center][/center] Link to comment Share on other sites More sharing options...
ghetek Posted January 9, 2008 Share Posted January 9, 2008 k well newbie's bother me, and I'm not really to nice to them all the time. Mainly ones that like to create bots or 'pranks'On the other hand I am really cool to newbies that want to actually learn things, I'm always open to hear about their Ideas and help them write scripts..im practically a newb myself but i help when i can. Most of us work in IS or some similar industry. We can all joke around about our profession and society's image of fat guys hunching over in dark places lit by the glow of a computer screen. take care man. Link to comment Share on other sites More sharing options...
DirtDBaK Posted January 10, 2008 Share Posted January 10, 2008 Hah ok thought you were another of the newbies that I would grow to hate. [center][/center] Link to comment Share on other sites More sharing options...
DW1 Posted January 10, 2008 Share Posted January 10, 2008 LMAO @ this whole thread AutoIt3 Online Help Link to comment Share on other sites More sharing options...
MilesAhead Posted January 12, 2008 Share Posted January 12, 2008 ture its dynamic but your right you could run it, rename it, then run it again... I always used _Singleton() and it worked fine for my purpose... That's a neat function. If you believe MS that GUIDs really are unique a nice touch is to use one of those GUID string generators and paste it in for the name param. I've been using that for Kernel Object names such as named mutexes, memory mapped files etc.. since Win9x. _Singleton("49437747-7A33-450C-AE71-7790430CBAE8") as example My Freeware Page Link to comment Share on other sites More sharing options...
Thamiel Posted February 2, 2009 Share Posted February 2, 2009 Sweet works great to solve an issue I had with multiple runs Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now