I love Apple, but they messed up big...

Also you have multiple of the same subroutine skipToNextSong_(sender)

Richard,
Growl is a system information application, used by a lot of applications like cyberduck, forklift, Western Digital Backup, just to name the ones I am using.

Is it possible for you to delete the lines completely?

Wait, I comment it out.

Just a minute or two.

Update: Done, I have surrounded it with (* *) and uploaded it again.
It is the first time I am sharing a Mac application, so I could expect such issues. Sorry!

best Regards
pppfff

PS: Last months I was in Hatfield UK for 3 weeks. It is in Herefordshire as well. :slight_smile:

I already did, that’s how I found your multiple subroutine error.

hmmh,
then it will not help that I have done it as well.
And I do not have errors.

Is it running now ?

Richard,

if Growl is not installed on your machine, the script won’t compile because of the lack of GrowlHelper.app
Growl is not a part of OS X.

Thank you Stefan,
is there a way to make it universal ?
For users with Growl and without ?

Or is it only an issue when you compile it new ?

best regards
pppfff

for a pure AppleScript solution Growl must be installed on the developing machine to be able to compile the script.

But there are two workarounds:

¢ use a precompiled script including the Growl part, which can be loaded in case Growl is installed.
¢ use Growl.framework with an ObjC class which can be called by the script.

Actually the second way is not a workaround, it’s the best solution and quite easy to realize

Stefan,
both options are over my current level of experience.
I have just started to use Applescript and Xcode and Mac in general.

Could say some more words about solution 2, the easy one

:slight_smile:
pppfff

Stefan, yes that’s what I was pointing out.

pppfff, I wouldn’t have jumped in so deep anyway, think small aim big, try testing out, menu items, dock menu, simple cocoa. I started off taking existing scripts I had and replacing dialogs with text fields, one being dialog maker, it used to be a text view, text field and a pair of radio buttons, it has gone really well. At least less than 1000 lines :lol: and perhaps not so 3rd party dependant?

Hi Richard,
this is my first project and I have just copied the whole script for fading in and out 4 times.
For each button one time.

It is not too difficult to streamline the applescript part.

My focus was and still is to start with Xcode and find out how it is working.
I agree 100% that this is quick and dirty programming :slight_smile:

And for me it is much more fun if I can realize some good looking nice application which can be used every day while I am playing music on my mac.

What have you changed and what is better now ?

best regards
pppfff

OK,

quick tutorial

  1. Download Growl SDK1.2 from here

  2. Mount the .dmg and move the folder ./Growl 1.2 SDK/Frameworks/Growl.framework into your project folder

  3. In Xcode highlight Frameworks/Other Frameworks

  4. From the Action menu choose Add > existing frameworks

  5. in the dialog box goto your project folder and select Growl.framework

  6. Click Add (twice)

  7. From the Action menu choose Add > New Build Phase > New Copy Files Build Phase

  8. In the Dialog Box choose Frameworks from the popup menu

  9. Close the Dialog Box

  10. in the sidebar open the triangles of Targets and [NameOfYourApp]. You will see a rectangle “Copy Files”

  11. Drag the icon of Growl.framework (in Frameworks/Other Frameworks) onto “Copy Files”. After success you will see “Copy Files (1)”

  12. Highlight the top element in the side bar

  13. From the Action menu choose Add > New Group

  14. Type Classes and return

  15. Highlight the Classes group folder

  16. Choose Menu File > New File

  17. select Cocoa > Objective-C class, click Next

  18. Type GrowlNotify, click Finish

  19. Replace the contents of GrowlNotify.h with

[code]#import <Cocoa/Cocoa.h>
#import <Growl/Growl.h>

@interface GrowlNotify : NSObject {
}

  • (id)sharedInstance;
  • (NSDictionary *) registrationDictionaryForGrowl;
  • (BOOL)growlIsInstalled;
  • (void)growlNotify:(NSString *)msg title:(NSString *)title;

@end[/code]
19) Replace the contents of GrowlNotify.m with

[code]#import “GrowlNotify.h”

@implementation GrowlNotify

  • (id)sharedInstance
    {
    static id sharedTask = nil;
    if(sharedTask == nil) {
    sharedTask = [[self alloc] init];
    }
    return sharedTask;
    }
  • (id)init
    {
    [GrowlApplicationBridge setGrowlDelegate:self];
    self = [super init];
    return self;
    }

  • (BOOL) growlIsInstalled
    {
    return [GrowlApplicationBridge isGrowlInstalled];
    }

  • (NSDictionary *) registrationDictionaryForGrowl
    {
    // NSLog(@“Register Growl”);
    NSArray *notifications;
    notifications = [NSArray arrayWithObject:@“Song Notification”];

    NSDictionary *dict;
    dict = [NSDictionary dictionaryWithObjectsAndKeys:
    notifications, GROWL_NOTIFICATIONS_ALL,
    notifications, GROWL_NOTIFICATIONS_DEFAULT, nil];

    return dict;
    }

  • (void)growlNotify:(NSString *)msg title:(NSString *)title
    {
    // NSLog(@“growlNotify”);
    [GrowlApplicationBridge notifyWithTitle:title
    description:msg
    notificationName:@“Song Notification”
    iconData:nil
    priority:0
    isSticky:NO
    clickContext:nil];
    }

@end[/code]
20) in the AppleScript part, you need these elements


property GrowlInstance : missing value
property GrowlIsInstalled : false

on awake from nib theObject
    set GrowlInstance to call method "sharedInstance" of class "GrowlNotify"
    set GrowlIsInstalled to (call method "growlIsInstalled" of GrowlInstance) as boolean
    if GrowlIsInstalled then
        call method "growlNotify:title:" of GrowlInstance with parameters {"Now Playing . . .", "my Favourite Song"}
    end if
end awake from nib

on will quit theObject
    call method "release" of GrowlInstance
end will quit

You can download a sample project here

Wow, I am impressed !
These are more than just a few words. It is enough work for a long weekend.
:slight_smile:
pppfff

PS: And you helped me to to enter a link in the right way. Thank you!

Das Wetter ist eh schlecht am Wochenende, sogar im Breisgau :wink:

in english:
(the weather will be dirty anyway, even in Breisgau [which is the area in Germany with the most friendly weather])

Sorry what subject is this about, your app, me, my app?

sorry for interfering :wink:

Hi Richard,
I have understood, that you have modified my app.
Reduced the lines and make it simpler.
Now I am curious to know what you have changed and how it looks like.

best regards
pppfff

Oh I did try fixing it before I realised the amount the app was involved. That’s all.

Btw I have a ridiculous amount of time on my hands, if you ever have ‘silly’ question e.g. why is setStringValue(“utujgu”) not working, or anything small, well anything I call ‘not forum worthy’ (that was a simple example) email me imadrichard@me.com :slight_smile:

I might be a bit off topic but I tried the GrowlAppleScript example from Stefan and when I change the active configuration to “Release” instead of “Debug” Xcode refuses to compile. I tried it in another project with the same result. (Mac OS X 10.5.8, Xcode 3.1.3).

The error:

BTW, is there any real difference in setting the active configuration to release instead of debug? (in ASS or ObjC)

For Leopard compatibility use version 1.1.4 of Growl.framework

Can I ask where to get that? I only see links for 1.2.

I have 1.2 installed on my Mac and I’d think the framework would be supported from 10.3.9 → 10.6 and that only the version of Growl itself (not the framework) would matter.

Edit: Nevermind, it’s a bug in Growl.