Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- — Place this file in your /Users/YourShortName/Library/Script Libraries/ folder
- global appName
- on logAppSetToRunInBackgroundOnly(appName)
- set entryExists to missing value
- set currentDate to (current date) as string
- set theFile to (path to desktop as text) & ".Logz" & ":" & "Background_Only_Apps.log" --value can be changed
- set myName to appName
- try
- if myName is not in (paragraphs of (read file theFile) as text) then
- set theText to myName & " was set to run in " & quote & "Background Only" & quote & " mode on " & currentDate
- do shell script "echo " & quoted form of theText & " >> " & quoted form of POSIX path of theFile
- end if
- on error errMsg number errNum
- set theText to myName & " was set to run in " & quote & "Background Only" & quote & " mode on " & currentDate
- do shell script "echo " & quoted form of theText & " >> " & quoted form of POSIX path of theFile
- end try
- end logAppSetToRunInBackgroundOnly
- on removeLogEntry(appName)
- set entryExists to missing value
- set theFile to (path to desktop as text) & ".Logz" & ":" & "Background_Only_Apps.log" --value can be changed
- set myName to appName
- do shell script "cat " & quoted form of POSIX path of theFile & " | egrep -v " & ¬
- "'" & myName & "' | pbcopy ; pbpaste > " & quoted form of POSIX path of theFile
- end removeLogEntry
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement