Choch Posted July 20, 2006 Share Posted July 20, 2006 (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 July 20, 2006 by Choch Link to comment Share on other sites More sharing options...
BPBNA Posted July 20, 2006 Share Posted July 20, 2006 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") Link to comment Share on other sites More sharing options...
Valuater Posted July 20, 2006 Share Posted July 20, 2006 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) Link to comment Share on other sites More sharing options...
Choch Posted July 23, 2006 Author Share Posted July 23, 2006 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 Link to comment Share on other sites More sharing options...
Bert Posted July 23, 2006 Share Posted July 23, 2006 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. The Vollatran project My blog: http://www.vollysinterestingshit.com/ 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