I’d like to know if there is a way to a count everytime I start my application – to an invisible file. For example the invisible file would contain “1” the first time, “2” the second time etc…
Something like recording the number of time it gets opened.
I could probably do that in AS but I’d prefer to do it in shell script. Could anyone help me with that please?
there are several ways, but consider that there is no 100% security.
One of them is an invisible property list file in the application support folder with an inconspicuous name
if checkCounter() then trialExpired()
on checkCounter()
set counterFilePath to ((path to application support from user domain as text) & ".aekzugbkljsu")
set counterFilePOSIXPath to quoted form of POSIX path of counterFilePath
try
(counterFilePath & ".plist") as alias
set cnt to do shell script "defaults read " & counterFilePOSIXPath & " cnt"
if cnt = 5 then return true
do shell script "defaults write " & counterFilePOSIXPath & " cnt -int " & ((cnt + 1) as text)
on error
do shell script "defaults write " & counterFilePOSIXPath & " cnt -int 0"
end try
return false
end checkCounter