Skip to content
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

Merged
merged 3 commits into from Sep 15, 2014
Merged

Conversation

pjrobertson
Copy link
Member

@pjrobertson pjrobertson commented Apr 17, 2014

Fixes #1825

}
NSString *s = [object componentsJoinedByString:@"\n"];
return [QSObject objectWithString:s];
} else if ([object isKindOfClass:[NSURL class]]) {
return [QSObject fileObjectWithPath:[(NSURL *)object path]];
Copy link
Member

@skurfer skurfer Apr 18, 2014

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?

Copy link
Member Author

@pjrobertson pjrobertson Sep 12, 2014

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 :)

@skurfer
Copy link
Member

@skurfer skurfer commented Apr 18, 2014

Anyone have a script I can test this with?

@HenningJ
Copy link
Contributor

@HenningJ HenningJ commented Jul 30, 2014

ok to test

skurfer referenced this issue Sep 11, 2014
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
@pjrobertson
Copy link
Member Author

@pjrobertson pjrobertson commented Sep 12, 2014

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 xxx line to whatever you want, e.g.

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"]];
Copy link
Member

@skurfer skurfer Sep 14, 2014

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.

Copy link
Member Author

@pjrobertson pjrobertson Sep 14, 2014

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

Copy link
Member

@skurfer skurfer Sep 14, 2014

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
skurfer added a commit that referenced this issue Sep 15, 2014
Better management of returned arrays from AS actions.
@skurfer skurfer merged commit b3006ba into master Sep 15, 2014
1 check was pending
@skurfer skurfer deleted the ASreturn branch Sep 15, 2014
@pjrobertson
Copy link
Member Author

@pjrobertson pjrobertson commented Sep 15, 2014

Cool, I 2nd your last commit ;-)

skurfer added a commit that referenced this issue Sep 15, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants