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
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
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
-
Download Growl SDK1.2 from here
-
Mount the .dmg and move the folder ./Growl 1.2 SDK/Frameworks/Growl.framework into your project folder
-
In Xcode highlight Frameworks/Other Frameworks
-
From the Action menu choose Add > existing frameworks
-
in the dialog box goto your project folder and select Growl.framework
-
Click Add (twice)
-
From the Action menu choose Add > New Build Phase > New Copy Files Build Phase
-
In the Dialog Box choose Frameworks from the popup menu
-
Close the Dialog Box
-
in the sidebar open the triangles of Targets and [NameOfYourApp]. You will see a rectangle “Copy Files”
-
Drag the icon of Growl.framework (in Frameworks/Other Frameworks) onto “Copy Files”. After success you will see “Copy Files (1)”
-
Highlight the top element in the side bar
-
From the Action menu choose Add > New Group
-
Type Classes and return
-
Highlight the Classes group folder
-
Choose Menu File > New File
-
select Cocoa > Objective-C class, click Next
-
Type GrowlNotify, click Finish
-
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.
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
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
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
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:
Copying Frameworks/Growl.framework (1 error)
strip: for architecture x86_64 object: /TestExample with Growl/Frameworks/Growl.framework/Versions/A/Growl malformed object (unknown load command 5)
pbxcp: warning: couldn’t strip: /TestExample with Growl/build/Release/TestExample.app/Contents/Frameworks/Growl.framework/Versions/A/Growl: No such file or directory
BTW, is there any real difference in setting the active configuration to release instead of debug? (in ASS or ObjC)
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).
For Leopard compatibility use version 1.1.4 of Growl.framework
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.