Error with Posix command

Hi,

If I add these two line of code in ASOC app in handler applicationWillFinishLaunching_(aNotification)

set unixTemp to “/tmp/”
set filePathTemp to ((POSIX file unixTemp) as string) & “temp.tif”

I receive error:
*** -[UntitledAppDelegate applicationWillFinishLaunching:]: Can’t make «script» into type string. (error -1700)

Why? The code works in ASS o AS

Alex

For some reason, specifiers like that don’t work; you have to say “unixTemp as POSIX file”. See ‘AppleScript Gotchas’ on pages 106-107.

Hi Sahne,

Thanks. I’ arrived at page 50… :wink:

Alex

If you need a HFS path, why not


set filePathTemp to boot volume of (system info) & ":tmp:temp.tif"

PS: or the sophisticated version


set startupVolume to (current application's NSFileManager's defaultManager()'s displayNameAtPath_("/")) as string
set filePathTemp to startupVolume & ":tmp:temp.tif"