In 2 completely different applications I have a problem where it will not let me convert a posix representation of a path to a colon separated one. The first example:
log (valwiniconpic's filePath() as string)
set valiconchs to (POSIX file (valwiniconpic's filePath() as string))
log "half done!"
log valiconchs as string
OR WITH CURRENT APPLICATION
log (valwiniconpic's filePath() as string)
tell current application to set valiconchs to (POSIX file (valwiniconpic's filePath() as string))
log "half done!"
log valiconchs as string
valwiniconpic is a custom subclass of NSImageView that has an NSString property filePath (taken from a drag drop operation), as you can see that isn’t (or shouldn’t be) the problem. When I use current application it fails at the set rather that the log.
The only thing is which confuses me totally, is that this recent code works:
set valmytempdir to (current application's NSTemporaryDirectory()) as string
try
tell application "Finder" to make new folder at (posix file valmytempdir) with properties {name: "com.RichardBirkett.DialogMaker"}
end try
valwinemailbody's writeRTFDToFile_atomically_(valmytempdir & "com.RichardBirkett.DialogMaker/message.rtfd", true)
tell application "Mail"
activate
tell (make new outgoing message with properties {sender:(valwinemailfrom's titleOfSelectedItem()) as string, subject:valemailsubject, content:""})
make new to recipient at the end of to recipients with properties {name:"Richard Birkett", address:"dev.richard@me.com"}
if valwinemaildata's state() as boolean then --if user allows access to data
set valemaildata to NSDictionary's dictionaryWithObjects_forKeys_({DisplayDialogController's subgetprops_(me), ChooseFromListController's subgetprops_(me), ChooseFileController's subgetprops_(me)}, {"displaydialog", "choosefromlist", "choosefile"})
set valstatelogpath to valmytempdir & "com.RichardBirkett.DialogMaker/StateLog.plist"
valemaildata's writeToFile_atomically_(valstatelogpath, true)
tell content -- send log and prefs
make new attachment with properties {file name: (posix file valstatelogpath) as string} at after last paragraph
try
make new attachment with properties {file name: (path to preferences) as string & "com.RichardBirkett.DialogMaker.plist"} at after last paragraph
on error
set the end to "prefs failed to be collected"
end try
end tell
end if
tell content to make new attachment with properties {file name: (posix file (valmytempdir & "com.RichardBirkett.DialogMaker/message.rtfd")) as string} at after last paragraph--send message and all user added attachments
send
end tell
set valwindowstoclose to valwindowstoclose & valemailsubject
end tell