Rex Posted February 23, 2010 Posted February 23, 2010 Hi there i have created a program that when it starts, create a temp work folder - and when exits it deletes the folder. But now there is more then one person that uses the program at the same time, so when the first one closes the prog. it deletes the temp folder and with it the other users files. Does any of U have an idea to how i can check if a other instans of the prog is running (on different computers) but the prog is placed in a shared network drive. I thought about putting a session file in the temp folder, but not sure how to control when to delete the folder and when not to. Hopes that some one can push me in the correct direction Cheers /Rex
99ojo Posted February 23, 2010 Posted February 23, 2010 (edited) Hi, you may create for every instance a random temp folder. So every instance has its own tempfolder and could delete it, if program is closed. I did something else for a temporary filename, you may use it (i did already rewrite): $tempfolder = _rndname () ; $tempfolder = @HOUR & @MIN & @SEC DirCreate (@Scriptdir & "\" & $tempfolder) sleep (5000) DirRemove (@Scriptdir & "\" & $tempfolder) Func _rndname () Local $folder = "", $wert For $i = 1 To 10 Do $wert = Random (65, 122, 1) Until $wert < 91 Or $wert > 96 $folder &= Chr ($wert) Next Return $folder EndFunc ;-)) Stefan Edited February 23, 2010 by 99ojo
notsure Posted February 23, 2010 Posted February 23, 2010 (edited) I'd say; DirCreate (@Scriptdir & "\" & @IPAddress1) DirRemove (@Scriptdir & "\" & @IPAddress1) If you need to know who it is for some reason, you can track it. If your network is using Dynamic IPaddresses you could consider to use @DATE behind it or something. Edited February 23, 2010 by notsure
Rex Posted February 23, 2010 Author Posted February 23, 2010 Hi, you may create for every instance a random temp folder. So every instance has its own tempfolder and could delete it, if program is closed. I did something else for a temporary filename, you may use it (i did already rewrite): $tempfolder = _rndname () ; $tempfolder = @HOUR & @MIN & @SEC DirCreate (@Scriptdir & "\" & $tempfolder) sleep (5000) DirRemove (@Scriptdir & "\" & $tempfolder) Func _rndname () Local $folder = "", $wert For $i = 1 To 10 Do $wert = Random (65, 122, 1) Until $wert < 91 Or $wert > 96 $folder &= Chr ($wert) Next Return $folder EndFunc ;-)) Stefan You just gave me the idea i needed thx Cheers /Rex
Rex Posted February 23, 2010 Author Posted February 23, 2010 I'd say; DirCreate (@Scriptdir & "\" & @IPAddress1) DirRemove (@Scriptdir & "\" & @IPAddress1) If you need to know who it is for some reason, you can track it. If your network is using Dynamic IPaddresses you could consider to use @DATE behind it or something. Could be an good idea, but we are connecting to desktops threw Server2008 so the ip would be the same for all users ;( but still an good idea thou. Cheers /Rex
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