This content has been marked as final. Show 7 replies
The problem with your code is this line:
aRenameFile("Prefs","Prefs" & x = x+1 & ".ini")
It probably should be
x = x + 1
aRenameFile("Prefs","Prefs" & x & ".ini")
Incidentally, an alternative approach would be to create an 'index' file. You use this index file to match a user to a pref file name. Something like this:
Thanks for the answer... Your code seems more suitable than mine but i am not really insterested to keep any record of the number of users that will use my system. All i want is to rename the prefs file every time a new user clicks the exit button. Can we modify your code to do that?
Well, I think i now understand better what you are trying to do in your code. But when i call this handler (on a mousedown event) i get the folloowing error.
Script error: String expected
prefFile = baReadIni("Users", userid, "error", the moviePath & "Users.ini")
Any idea why is that?
that means that 'userid' is not a string -- change it to
baReadIni("Users", string(userid), "error", the moviePath & "Users.ini")
All i am getting is a user ini file with the following information
and no actual prefs2 or prefs3 files. I have tried this through both a projector and the director's authoring enviroment
I think i knwo where is the problem... the index file does not update itself and perhaps that's why the new files are not created. Any idea on how to solve this?
For anyone who is interested thats the answer to the above problem. It only runs in a projector
set budd = new (xtra "BudAPI")
set x = 1
TheNewINI = 1
repeat while TheNewINI <> 0
set TheNewINI = baFileExists(the moviepath & "Preferences\prefs" & x & ".ini")
if TheNewINI = 0 then
baCopyFile("J:\PhD Development work\My Director Works\Apps_with_Afrodity\Preferences\prefs.ini", "J:\PhD Development work\My Director Works\Apps_with_Afrodity\Preferences\" & "prefs" & x & ".ini", "Always")
x = x + 1