New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better management of returned arrays from AS actions. #1826
Conversation
} | ||
NSString *s = [object componentsJoinedByString:@"\n"]; | ||
return [QSObject objectWithString:s]; | ||
} else if ([object isKindOfClass:[NSURL class]]) { | ||
return [QSObject fileObjectWithPath:[(NSURL *)object path]]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So if AppleScript returns a URL, will it only ever be a file://
URL? And why not use fileObjectWithFileURL:
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well it seems there's no such thing as a URL in AppleScript anyway, so that's dead code. I'll remove it now :)
Anyone have a script I can test this with? |
ok to test |
Previously: NSArray never has a valueForKeyPath:@path, which was causing an exception Note: although this is fixed, the behaviour may still not be as expected (e.g. if an array of NSStrings is returned) - no such QSCollectionObject for merged string objects exists
There is no such thing as an 'URL' type in AppleScript, so the removed lines would never be called
As for a script: using terms from application "Quicksilver"
on process text _text
return {"1", "2", "3"}
end process text
end using terms from change the return {"/usr/local/bin", "tmp/QS"}
-- or
return "http://some.string.that.will.be.sniffed.com" Edit: Save it as an action AppleScript, called "something", then bring up a string in the 1st pane of QS, and search for "something" in the actions pane |
id object = [desc objectValue]; | ||
if ([object isKindOfClass:[NSArray class]] && [(NSArray *)object count]) { | ||
if ([[NSFileManager defaultManager] filesExistAtPaths:object]) { | ||
return [QSObject fileObjectWithArray:[object valueForKey:@"path"]]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It kept crashing, so I caught the exception in the debugger. I think this is supposed to be fileObjectWithArray:object
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm.... I think that's the crash I saw recently, and fixed over in the tweaks branch. But of course that commit has been wiped from the face of the earth now :'( (unless you haven't force pulled yet and still have it locally?) I think I just changed it to object
like you said
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did the rebase on my local copy for testing purposes, so it’s gone here too, but before I commented, I tried changing it to object
and it seemed to work as expected.
just pass the array directly, since that’s what the method expects
Better management of returned arrays from AS actions.
Cool, I 2nd your last commit ;-) |
Fixes #1825