Jump to content

session controle


Rex
 Share

Recommended Posts

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

Link to comment
Share on other sites

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 by 99ojo
Link to comment
Share on other sites

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 :mellow:

thx

Cheers

/Rex

Link to comment
Share on other sites

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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...