November 20, 200520 yr I am trying to write a script that will close the program after so many days. In other words the program is only a demo. I found this one but I am having problems with it. If ( IsEmpty ( FirstRunDate ) ) Set Field ( FirstRunDate , Get ( CurrentDate ) ) Else If ( Get ( CurrentDate ) > FirstRunDate + 30 ) Exit Application End If End If I am obviously putting it in wrong. I made a new table called FirstRunDate, because when I write the script an error occurs, "The table cannot be found" I also wrote it as a field. What am I doing wrong? I also do not see how to make it start right when the user opens the program the first time. I hope this makes sense. Thank you.
November 21, 200520 yr You should use both the table name and the field name. Go to Layout [Prefs] If [isEmpty(Prefs::FirstRunDate)] Set Field [Prefs::FirstRunDate; Get(CurrentDate)] Else If [Get(CurrentDate) > Prefs::FirstRunDate + 30] Exit Application End If Prefs is a one-record table (in your case, FirstRunDate could serve the same purpose). Set the script to run upon opening in File -> File Options.
Create an account or sign in to comment