Revision: 7127 http://skim-app.svn.sourceforge.net/skim-app/?rev=7127&view=rev Author: hofman Date: 2011-02-25 11:55:06 +0000 (Fri, 25 Feb 2011)
Log Message: ----------- run applescript from script menu through osascript task, because some commands like close will behave differently when called from the same process. Modified Paths: -------------- trunk/SKScriptMenu.m Modified: trunk/SKScriptMenu.m =================================================================== --- trunk/SKScriptMenu.m 2011-02-23 17:56:25 UTC (rev 7126) +++ trunk/SKScriptMenu.m 2011-02-25 11:55:06 UTC (rev 7127) @@ -251,24 +251,9 @@ NSString *theUTI = [[NSWorkspace sharedWorkspace] typeOfFile:[[scriptFilename stringByStandardizingPath] stringByResolvingSymlinksInPath] error:NULL]; if (isAppleScriptUTI(theUTI)) { - NSDictionary *errorDictionary; - NSAppleScript *script = [[[NSAppleScript alloc] initWithContentsOfURL:[NSURL fileURLWithPath:scriptFilename] error:&errorDictionary] autorelease]; - if (script == nil) { - NSLog(@"AppleScript file '%@' could not be opened: %@", scriptFilename, errorDictionary); - NSBeep(); - } else { - NSAppleEventDescriptor *result = [script executeAndReturnError:&errorDictionary]; - if (result == nil && [[errorDictionary objectForKey:NSAppleScriptErrorNumber] integerValue] != -128) { - NSLog(@"AppleScript file '%@' failed to execute: %@", scriptFilename, errorDictionary); - NSBeep(); - } - } + [NSTask launchedTaskWithLaunchPath:@"/usr/bin/osascript" arguments:[NSArray arrayWithObjects:scriptFilename, nil]]; } else if (isApplicationUTI(theUTI)) { - BOOL result = [[NSWorkspace sharedWorkspace] launchApplication:scriptFilename]; - if (result == NO) { - NSLog(@"Application '%@' could not be launched", scriptFilename); - NSBeep(); - } + [[NSWorkspace sharedWorkspace] launchApplication:scriptFilename]; } else if (isAutomatorWorkflowUTI(theUTI)) { [NSTask launchedTaskWithLaunchPath:@"/usr/bin/automator" arguments:[NSArray arrayWithObjects:scriptFilename, nil]]; } else if ([[NSFileManager defaultManager] isExecutableFileAtPath:scriptFilename]) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Free Software Download: Index, Search & Analyze Logs and other IT data in Real-Time with Splunk. Collect, index and harness all the fast moving IT data generated by your applications, servers and devices whether physical, virtual or in the cloud. Deliver compliance at lower cost and gain new business insights. http://p.sf.net/sfu/splunk-dev2dev _______________________________________________ Skim-app-commit mailing list Skim-app-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/skim-app-commit