Finder

I’m getting slightly embarrassed how much I need your help at times but I feel ASOC is poor as well :lol:. Anyway…

...
log valmytempdir -- a string: /var/folders/m2/h4n6xbmx70xdz1hz9gx9yvfc0000gn/T/com.RichardBirkett.DialogMaker/
	tell application "Finder"
		log (posix file valmytempdir)-- Finder got an error: AppleEvent handler failed. (error -10000)
		log "if"
...

This fails, does not log “if” as I stated, but when I run the following in AS Editor:

POSIX file "/var/folders/m2/h4n6xbmx70xdz1hz9gx9yvfc0000gn/T/com.RichardBirkett.DialogMaker/"

it returns a perfect colon separated file path. And I tried

log (posix file (valmytempdir as string))

but it didn’t help at all!

Is this a stupid mistake, a Lion bug or what people call ‘finder scripting’ in a depressing sense?

I think that if you add “tell me to log” instead of just log in the Finder tell block it will solve your problems. Since log is not part of the Finder’s dictionary you need to tell your own app (me) to do it instead. It’s like a sub-tell block inside the Finder tell block.

You need to do this all the time. Plus I found out you can’t run ASOC-specific code inside a tell block of an app, so if you need some variables defined for your tell block using ASOC code it needs to be done before the tell block starts and also coerced to standard AS types, like string, integer, etc.

Had the same problem a while ago…

Helpful? :wink:

Browser: Safari 531.22.7
Operating System: Mac OS X (10.6)

if you want to log within a “tell application” block, you have to say “tell current application to log …”

Ahhh thanks!