Selecting a file

select file "screensaver_pref.plist" of (path to home folder as string)

so I have this file “screensaver_pref.plist” in my home folder (just to test). I want to have applescript select it (as it is part of a larger applescript.)

it keeps giving me an error

what’s the proper code?

Um, what?

sorry,

i have apple script code that rename a selected file to “com.apple.screensaver.Abstract.” & MACaddress & “.plist”

but for this to work, I need to have the file selected through appplescript.

how do I do it?


set MACaddress to (do shell script "ifconfig en0 ether | awk '/ether/ {print $2}' | tr -d ':'")
set new_file_name to "com.apple.screensaver.Abstract." & MACaddress & ".plist"


<-- select code inserted here -->

tell application "Finder" to set name of item 1 of (get selection) to new_file_name


No need to select it… take this for example.

set desktopItem to (path to desktop as Unicode text) & "file1.txt"

tell application "Finder" to set name of file desktopItem to "file2.txt"

haha! of course! stupid me.

thanks! got it to work! you’re a big help james!

anytime! =)