AppleScript and NSOpenPanel in Lion


hi folks,

i'm 'porting' of snow leopard scripts lion using applescript editor , i'm having significant problems getting nsopenpanel's openpanel() working. in original script used code along lines of:

code:
tell application "automator runner" tell «class opep»  		  	get it's properties    	set floating true  	set «class cacd» true  	set «class almt» true  	set «class titl» "select items matroskify"  	  	«event appscalm» "setshowshiddenfiles:" given «class psof»:it, «class witp»:{false}    	activate  	if («event pansdisp» it) not 0 -- cancel button  		--the path names property list of posix paths  		set posixpaths it's «class filo»  	end if    end tell
in lion got errors regarding use of «class cacd», dug around bit , ended with:

code:
set myopenpanel current application's nsopenpanel's openpanel()  myopenpanel's setcanchoosefiles_(true)  myopenpanel's setcanchoosedirectories_(true)  myopenpanel's setallowsmultipleselection_(false)  myopenpanel's runmodal -- returns list of file url's  set posixpaths myopenpanel's urls()
while compiles, 'nsopenpanel doesn’t understand openpanel message' when wrap in on run ... end run block , run it.

enlighten me stupid mistake i've made time?

in advance...
 

you can't run cocoa applescripts directly in applescript editor - there cocoa-applescript applet template can create editor run code, although debugging bit of pain. option use applescriptobjc explorer.
 


Forums Macs Mac Programming


  • iPhone
  • Mac OS & System Software
  • iPad
  • Apple Watch
  • Notebooks
  • iTunes
  • Apple ID
  • iCloud
  • Desktop Computers
  • Apple Music
  • Professional Applications
  • iPod
  • iWork
  • Apple TV
  • iLife
  • Wireless

Comments

Popular posts from this blog

Mac OS X Server as File Server for 50/50 Mac & PC Workgroup

Permissions Problem?

iPhone won't sync with iTunes