How to add script to unlock a locked file

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

How to add script to unlock a locked file Sun Mar 29, 2015 2:34 pm • by polocanada
I was able to run permission reset using script for Hazel perfectly fine.

No I'm trying to add script to UNLOCK a file but it fails, mostly with a "1" which indicates error or failure and in fact the file doesn't get unlocked.

None of these worked....

tell application "Finder"
set locked of every file of folder this_folder to false
end tell
....
tell application "Finder"
set locked of file tfile to false
end tell
....
tell application "Finder"
set locked of file theFile to false
end tell

....

I also tried shell script but I didn't get any further...

chflags -R nouchg %1
....
SetFile -a l %1

=======

Does any of these has a slight chance to work?
Thanks.
polocanada
 
Posts: 7
Joined: Sun Mar 29, 2015 2:26 pm

Re: How to add script to unlock a locked file Mon Mar 30, 2015 11:17 am • by Mr_Noodle
Have you tried the scripts outside of Hazel on the file in question? Also, when $1 in a shell script, it's best to enclose it in double-quotes to shield against things like spaces in the path.
Mr_Noodle
Site Admin
 
Posts: 11236
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Mr_Noodle wrote:Have you tried the scripts outside of Hazel on the file in question? Also, when $1 in a shell script, it's best to enclose it in double-quotes to shield against things like spaces in the path.


I kind of give up on that already, but yes, I tried at least one of the scripts above worked, as these are scripts I found elsewhere on the web.

Thanks for the "double-quote" top. That may have been the issue after all.
polocanada
 
Posts: 7
Joined: Sun Mar 29, 2015 2:26 pm


Return to Support