You could try:
(file "Library:Application Support:.syssettings12a239c8044f4" of the startup disk) as string
that will fail if the file doesn’t exist, or give you the simple text path if it does. You should then be able to work with it the same as your hard coded paths. I just tried deleting a file using that reference and it worked.
Geoff
From: applescript-users-bounces+geoffg=email@hidden [mailto:applescript-users-bounces+geoffg=email@hidden] On Behalf Of Jason Lantz
Sent: Monday, November 01, 2010 12:02 PM
To: email@hidden
Subject: Delete a hidden file
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.
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"
exists file "Leopard HD:Library:Application Support:.syssettings12a239c8044f4"
if true then set trialcounter to "Leopard HD:Library:Application Support:.syssettings12a239c8044f4"
And here are the results:
tell application "Finder"
exists file "Leopard HD:Library:Application Support:.syssettings12a239c8044f4"
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
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"
exists file "Library:Application Support:.syssettings12a239c8044f4" of the startup disk
if true then set trialcounter to "Library:Application Support:.syssettings12a239c8044f4" of the startup disk
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?