Sign in to follow this  
Followers 0
Choch

File attribute

5 posts in this topic

#1 ·  Posted (edited)

I've been working on a licensing program, and I was wondering if there is way to assign a file as "in use" and also check whether a file is in use for the duration of a script?? This would be so helpful to me...

EDIT:

What I'm really looking for, is anything that can flag a file only for the duration of the script, so that even if the script fails out or is closed before it is finished, the file will unflag.

Edited by Choch

Share this post


Link to post
Share on other sites



I'm not sure if this would work if the script terminates abnormally... but try

Func OnAutoItExit()
   ;;;;;;;change attribute back to normal
EndFunc;==>OnAutoItExit

You can also change the function that autoit runs before it exits to something instead of OnAutoItExit by using Opt("OnExitFunc", "FunctionName")

Share this post


Link to post
Share on other sites

I'm not sure if this would work if the script terminates abnormally... but try

Func OnAutoItExit()
  ;;;;;;;change attribute back to normal
EndFunc;==>OnAutoItExit

You can also change the function that autoit runs before it exits to something instead of OnAutoItExit by using Opt("OnExitFunc", "FunctionName")

Combined with watching for the process

While 1
    
    if Not ProcessExists("Program.exe") Then Exit
    
    Sleep(10)
    
WEnd

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

Im afraid thats not quite going to work.... Although the onautoitexit func is a good idea, I don't think that function will run if the script is terminated while only halfway finished. As for processexist check, that won't work unless i were to run a seperate executable, just to monitor the first one. But that doesn't fix my problem, because if a computer crashes, or if it is turned off, or if (I work at a internet cafe) a user logs out, both scripts will be terminated, and I'm left without a license file. (Currently, in order to manage the licensing on one of our games, I wrote an auto-it to grab the first license in a specified folder, and then just move the license to a different directory, and copy it back when the game closes.) But as I said, users will logout before the script is finished, or any number of things to mess it up. What would be great is if there is a way to somehow render the license file as 'in use' for the duration of the script, so that it would automatically revert, no matter how the script closes

Share this post


Link to post
Share on other sites

When the user plays a game, do you have the license file stored on a server? If so, you could have a script running on the server that looks for a process to exist on the client PC. It would poll the PC, say every few seconds. When the process doesn't exist, you get the license back.

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  
Followers 0