I asked this question before, but was unable to make any of the suggestions work. I think I need provide more detailed information, so I am trying again.
Objectives: 1. To delete a specific hidden file 2. For the script to work on any machine (aka absent of hard coded file paths) 3. To delete the file without requiring the user to directly choose or select the file
Here's my original script (which works):
tell application "Finder" try exists file "Leopard HD:Library:Application Support:.syssettings12a239c8044f4" if true then set trialcounter to "Leopard HD:Library:Application Support:.syssettings12a239c8044f4" end try
delete trialcounter end tell
And here are the results:
tell application "Finder" exists file "Leopard HD:Library:Application Support:.syssettings12a239c8044f4" false delete "Leopard HD:Library:Application Support:.syssettings12a239c8044f4" item ".syssettings12a239c8044f4 11-42-29" of item ".Trash" of folder "j.lantz" of folder "Users" of startup disk end tell
Notice that despite the fact that the existence of the hidden file comes back false, the script proceeds anyway and somehow manages to delete the file. Unfortunately, this script isn't sufficient for me because the file paths are hard coded. To fix this I tried the following script.
tell application "Finder" try exists file "Library:Application Support:.syssettings12a239c8044f4" of the startup disk if true then set trialcounter to "Library:Application Support:.syssettings12a239c8044f4" of the startup disk end try
delete trialcounter end tell
This is essentially the same as the first script except that I removed "Leopard HD" from the file path and replaced it with "of the startup disk" at the end. This script returns a syntax error that says "Can't get 'Library:Application Support:.syssettings12a239c8044f4' of the startup disk. Access not allowed."
I feel like the solution here is probably quite simple, but I can't figure it out. What am I doing wrong?
|