"path to resource" - ScreenSaverEngine

Hi,

Can someone tell me how to get the path to ScreenSaverEngine unix file inside the ScreenSaverEngine.app bundle through script statements. Here’s the path to the containing folder:

/System/Library/Frameworks/ScreenSaver.framework/Versions/A/Resources/ScreenSaverEngine.app/Contents/MacOS

Can you use “path to resource” for this and how if yes?

Thanks,

Model: MacBook Pro
AppleScript: 2.2.3
Browser: Safari 536.26.17
Operating System: Mac OS X (10.8)

HI Tom,

Thanks for the hint. I forgot about unix! I ended up using this:

find “/System/Library/Frameworks/ScreenSaver.framework/Versions/A/Resources/ScreenSaverEngine.app” -name “ScreenSaverEngine”

/System/Library/Frameworks/ScreenSaver.framework/Versions/A/Resources/ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine

With some trial and error and a little luck, I finally got it to work! Now I just need to put it in a ‘do shell script’

Thanks a lot,

Model: MacBook Pro
AppleScript: 2.2.3
Browser: Safari 536.26.17
Operating System: Mac OS X (10.8)

Instead of using a search app like EasyFind or the terminal find command, I wrote this script some time ago. Initially, I used it as a droplet but then, I put in in a Run AppleScript action in an Automator workflow and saved as the service “Copy UNIX or MAC Path”.
Usage: navigate to any folder or file, select it in the Finder and then right click and navigate to the service. Select unix or mac in the dialog box and the full path will be copied to the clipboard, ready to be pasted as needed.

-- Copy UNIX or MAC Path --
-- Copy the full UNIX or MAC path of a selected file or folder to the Clipboard, ready to paste anywhere.

-- on open selection -- 'on open variable' block is required if saved as a droplet.
tell application "Finder"
	activate
	set ItemsCount to count selection as list
	if ItemsCount = 0 or ItemsCount > 1 then
		display dialog "There are " & ItemsCount & " items selected." & return & return & ¬
			"You must SELECT just ONE item and then" & return & ¬
			"right-click on the highlighted selection." & return & return & ¬
			"Do not just mouse over an item and right-click." with title ¬
			"Alert: Invalid Selection" buttons {"Cancel"} default button 1 giving up after 60
		set dialogResult to result
		set giveUp to gave up of dialogResult
		if giveUp is true then error number -128
	else
		set ShowList to {}
		set end of ShowList to selection as string
		with timeout of 60 seconds
			choose from list ShowList with title "The full path of your selection" with prompt ¬
				"Cancel if the selection is wrong." with empty selection allowed
			if result is false then error number -128
		end timeout
	end if
	set MyClip to selection as string
	display dialog "Select UNIX or MAC Path" with icon 1 buttons {"Cancel", "UNIX", "MAC"} ¬
		with title "Get the UNIX or MAC Path" default button 2 giving up after 60
	set dialogResult to result
	set giveUp to gave up of dialogResult
	if giveUp is true then error number -128
	set UserChoice to button returned of dialogResult
	if UserChoice is "UNIX" then
		set the clipboard to (POSIX path of MyClip)
	else
		set the clipboard to MyClip
	end if
end tell
do shell script "afplay -q 1 '/System/Library/Sounds/Purr.aiff'"
-- end open -- required for a droplet.