script to toggle lock/unlock status for file

Hi there,

I’m afraid I’m only beginning to figure out how to use Applescript, but until I have some meagre proficiency, can anyone suggest a script that can toggle the lock/unlock status of a file selected in DT?

I tend to need to change locking status a lot, and being able to do it with a single KB shortcut would be great. Even two separate scripts to lock and unlock would be great… thanks in advance to anyone who can help!

See documentation in the script comments

-- see https://discourse.devontechnologies.com/t/script-to-toggle-lock-unlock-status-for-file/13638/1
-- can be used with, e.g., KeyBoard Maestro to toggle locking for a group of records
-- record selection can be non-contiguous and include groups
-- change commenting at [a] depending on the lock state you want this script to change

tell application id "com.devon-technologies.thinkpro2"
	repeat with eachItem in (selection as list)
		-- [a] -- un/comment one or the other (not both) depending on lock state desired
		-- 	set locking of eachItem to true
		set locking of eachItem to false
	end repeat
end tell

Brilliant, thank you!

Isn’t there already a shortcut to do that?

I use ^⌘K to lock/unlock the selected file.

Hm, doesn’t work for me. Is it located somewhere in the menus?

LOL, of course you’re right. :laughing:

That is the key command in Data > Mark > As Locked/Unlocked.

Great. I should have dug a little deeper in the menus. Thank you.