i have an IBAction that executes an Apple Script, flashes the screen and plays a sound, but there is often a lag between the Apple Script and the cocoa functions. if i continuously repeat this method, it eventually becomes in sync... is there anyway to make it always in sync?
here is apart of the IBAction:
i think i would be able to make it always in sync if i could combine the FlashMenuBar(0) and maybe the sound effect with the Apple Script, i can't seem to find any information on how to use Apple Script to perform cocoa's FlashMenuBar(0); function... or maybe there is a better way of doing this that i don't know about?
thoughts?
here is apart of the IBAction:
Code:
NSString *myStringScript = [NSString stringWithFormat:
@"\
set LIGHTdesktop to POSIX file \"%@\"\n\
tell application \"Finder\"\n\
set desktop picture to alias LIGHTdesktop\n\
end tell", usedPath];
NSDictionary* errorDict;
NSAppleEventDescriptor* returnDescriptor = NULL;
NSAppleScript* scriptObject = [[NSAppleScript alloc] initWithSource:myStringScript];
returnDescriptor = [scriptObject executeAndReturnError: &errorDict];
if ([[soundRadioGroup cellWithTag:1] state] == NSOnState)
{
NSSound *desktopSound = [NSSound soundNamed:@"Desktop.aif"];
[desktopSound play];
}
FlashMenuBar(0);
FlashMenuBar(0);
[NSAppleScript release];
i think i would be able to make it always in sync if i could combine the FlashMenuBar(0) and maybe the sound effect with the Apple Script, i can't seem to find any information on how to use Apple Script to perform cocoa's FlashMenuBar(0); function... or maybe there is a better way of doing this that i don't know about?
thoughts?