Monday, December 18, 2017

#1 2011-04-02 04:52:44 am

airbuff
Member
Registered: 2008-10-01
Posts: 60

on launched not working

My script starts like this:

Applescript:

on launched theObject
   display dialog "This displays a dialog when your app is launched!"
end launched
on clicked theObject
   if title of theObject = "OK" then
       my the_script()
   else
       quit me
       delay 30
   end if
end clicked

The "on launched" part is not working. It runs like the "on launched" part doesn´t exist.

I have searche the forum and found, there should be dialog examples in /Developer/Examples/AppleScript Studio/.

On my system, there is only "Mail Search".

Any hints for getting "on launched" running and/or to find the examples for download somewhere are highly appreciated :-)

Offline

 

#2 2011-04-02 04:55:50 am

StefanK
Member
From:: St. Gallen, Switzerland
Registered: 2006-10-21
Posts: 11482
Website

Re: on launched not working

Have you connected on launched in Interface Builder?


regards

Stefan

Offline

 

#3 2011-04-02 05:24:59 am

airbuff
Member
Registered: 2008-10-01
Posts: 60

Re: on launched not working

No. I can´t find it neither. Could not find how to attach screenshot of inspector for you.

Offline

 

#4 2011-04-02 05:31:46 am

StefanK
Member
From:: St. Gallen, Switzerland
Registered: 2006-10-21
Posts: 11482
Website

Re: on launched not working

In Interface Builder highlight File's Owner in the Main(Menu.nib) window
In Inspector window select the AppleScript Inspector tab (⌘7) and choose a script from the Script popup menu.
In the Event handler view below check the checkbox Application > launched


regards

Stefan

Offline

 

#5 2011-04-02 05:47:41 am

airbuff
Member
Registered: 2008-10-01
Posts: 60

Re: on launched not working

Application does´t show up here, but I have helped myself using "opened" for the main window:

Applescript:

on opened theObject
   --do somthing
end opened

I strugle with the options ticked in the inspector quite often. It seem, even I have saved, they are not recognized before closing Interface Builder sometimes.

Thanks Stefan.

Offline

 

#6 2011-04-02 05:51:20 am

StefanK
Member
From:: St. Gallen, Switzerland
Registered: 2006-10-21
Posts: 11482
Website

Re: on launched not working

Application is only available for File's Owner or Application, you must select the appropriate item in the main window (.nib or .xib) of Interface Builder  not the main window of your application

Last edited by StefanK (2011-04-02 05:52:55 am)


regards

Stefan

Offline

 

#7 2011-04-02 06:00:46 am

airbuff
Member
Registered: 2008-10-01
Posts: 60

Re: on launched not working

On Application, all handler checkboxes are greyed out here.

Offline

 

#8 2011-04-02 06:03:40 am

StefanK
Member
From:: St. Gallen, Switzerland
Registered: 2006-10-21
Posts: 11482
Website

Re: on launched not working

please read post #4 again and follow exactly the instructions


regards

Stefan

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)