Utterly Confused

I have tried multiple test scripts to try to attempt simple tasks.

Such as deleting “/Macintosh HD/Users/rob/Library/Safari/History.plist” but, I have no idea how to get that path into an AppleScript, I have tried using “:”, and that failed. Where does the AppleScript start the path? If I were to save an Application script in my home folder, would the AppleScript be able to go “/Library/Safari” or would I have to go “/Macintosh HD/Users/rob/Library/Safari” ?

And, I am having trouble renaming a file, probably due to the same problem with paths. I want to rename “/Macintosh HD/Users/rob/Library/Safari/History.plist” to “/Macintosh HD/Users/rob/Library/Safari/History.plist.locked” when you click one button, and then when you click another button, to change “History.plist.locked” back into “History.plist”

This is terribly confusing me, and I’ve tried for hours to get this to work witout success.

Here’s some code to play with.

To delete:

set user_ to path to current user folder as text
set saf_history to user_ & "Library:Safari:History.plist"

try
	tell application "Finder" to delete file saf_history
on error e
	display dialog e
end try

To rename:

set user_ to path to current user folder as text
set saf_history to user_ & "Library:Safari:History.plist"

set dd to display dialog "Do something to Safari's history file?" buttons ¬
	{"Lock", "Unlock", "Cancel"} default button 3

if button returned of dd is "Lock" then
	try
		tell application "Finder" to set name of file saf_history to "History.plist.locked"
	on error e
		display dialog e
	end try
else
	if button returned of dd is "Unlock" then
		try
			tell application "Finder" to set name of file (saf_history & "History.plist.locked") to "History.plist"
		on error e
			display dialog e
		end try
	end if
end if

– Rob