Thursday, December 14, 2017

#1 2009-09-14 10:06:32 am

HippoMan
Member
Registered: 2008-09-18
Posts: 114

Stay-open app with no window?

I have an AppleScript that is nothing more than an on idle handler that I have saved as a Stay-Open app, and I'm trying to convert it to an ASOC app. I'm getting lost about how to make my ASOC app be a Stay-Open app with no window.

Could someone point me to the appropriate docs, or perhaps give me a hint?

Thanks in advance.


Filed under: stay-open, no-window, asoc

Offline

 

#2 2009-09-14 10:13:17 am

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

Re: Stay-open app with no window?

Hi,

just delete the window in Interface Builder.
I'd like to know what is the advantage of AppleScript Studio compared to AppleScript without using the enhanced GUI features? wink


regards

Stefan

Offline

 

#3 2009-09-14 11:05:58 am

HippoMan
Member
Registered: 2008-09-18
Posts: 114

Re: Stay-open app with no window?

Thank you very much.

I deleted the window, but the app doesn't stay open. How do I make it a Stay-Open app which appropriately calls an on idle handler?

The reason I'm doing this is because my original AppleScript app needs to call a Core Services function. The way I implemented that was to write an executable which does nothing more than call this function, and then invoke that executable via do shell script at the appropriate times during my AppleScript's on idle handler.

I figured that since ASOC provides a bridge between AppleScript and Cocoa, I could write something that is more efficient by making a direct call to the Core Services function via my ASOC app, instead of having to invoke a new process simply to make that one, single function call.

In case anyone is interested, this is the AppleScript app that I'm talking about: http://macscripter.net/viewtopic.php?id=30456

Also, I think that it would be a good learning exercise for me to try to convert some of my existing AppleScripts to ASOC apps.

Last edited by HippoMan (2009-09-14 11:13:47 am)

Offline

 

#4 2009-09-14 11:21:52 am

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

Re: Stay-open app with no window?

normally if you create a new AppleScript Application project and just Build & Go
the app stays open until you press ⌘Q oder terminate the task in Xcode


regards

Stefan

Offline

 

#5 2009-09-14 11:36:08 am

HippoMan
Member
Registered: 2008-09-18
Posts: 114

Re: Stay-open app with no window?

Well, I originally tried that, and the app didn't stay open, and that's why I posted my previous question. But I had been hacking with the application a lot before removing the Window, and so maybe I messed something up.

Therefore, after reading your reply, I started over from scratch, and this time the app did indeed stay open. So thank you.

But I still have a problem with the idle handler that I mentioned.

Here's what I did:

* Create a new Cocoa-Applescript application.
* Open MainMenu.xib
* Delete the Window
* Save the changes in Interface Builder
* Go to my AppDelegate and implement an on idle handler
* Do a Build and Run

This time, the app stayed open like it was supposed to, but the on idle handler isn't firing.

So do idle handlers not work in ASOC? Or is there something special I have to do in order to enable them?

Last edited by HippoMan (2009-09-14 11:36:58 am)

Offline

 

#6 2009-09-14 11:45:16 am

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

Re: Stay-open app with no window?

At this point I must quit, because I don't have Snow Leopard


regards

Stefan

Offline

 

#7 2009-09-14 11:49:23 am

HippoMan
Member
Registered: 2008-09-18
Posts: 114

Re: Stay-open app with no window?

StefanK wrote:

At this point I must quit, because I don't have Snow Leopard


Well, I just want to thank you for all your help.

Offline

 

#8 2009-09-14 11:50:37 am

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

Re: Stay-open app with no window?

You're welcome


regards

Stefan

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)