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
Add indirectobject parameter to AppleScript action handlers #366
Add indirectobject parameter to AppleScript action handlers #366
Conversation
I wish I knew enough about the interaction with AppleScript to be more helpful, but using your example as an action, I’m getting this in the console:
|
Can you check that:
|
I almost always clean all targets and build the “Quicksilver Distribution” target.
I’ll bet this is it. I was building with the Debug configuration, which left my copy in /Applications intact. This is most likely what Script Editor was looking at for terms. I’ll give it another try. |
OK, it seems to work as advertised without affecting existing behavior. I’ll keep it active for a while to make sure I don’t run into any problems. |
I'll have a play today. |
I know @philostein has expressed his wishes for this behaviour. He might be helpful in testing this. If you (philostein) don't want to have to get all fancy with git, here's a link to a QS version compiled with these changes. For what it's worth, I've done some limited testing and it seems fine. Hopefully Phil will have plenty more ideas and tests :) |
Thanks a bunch, I'll try it out. This is great! Searching in pane 3 returns any Object. If the Object is a file/folder, would it be possible for iObject to be a path string or preferably a file Object? So the Desktop folder in pane 3 would return: I like the way pressing enter with an empty pane 3 returns a system beep error. Also pressing '.' in pane 3 allows a text Object to be typed. I was able to create a Curent Selection>[AppleScript Action]>[Type to search] Trigger, no problem. Cheers. |
I thought you'd have some ideas :)
This is a known problem, unrelated to this pull. The same thing happens if On 12 June 2011 13:35, philostein <
|
Maybe instead of a simple argument count, AppleScripts should be able to return two arrays: a list of types for the direct object and a list of types for the indirect object? Or perhaps if a user’s needs are that complex, we should say “Here’s a quarter, kid. Go and get yourself a real action.” (meaning Objective-C). :) |
Remember 'Act without doing'? I want to 'Act without learning Objective-C'. :) Is it feasible (and not too much effort) to return a file alias/path for the indirect object? Perhaps QS could also only return files/folders when searching in pane 3, which would be similar to the way the 'Copy To…' Action returns only folders. This is not a deal breaker, as the script could just handle the error if it gets another object type. |
I don't know anything about AS dictionaries, but an alternative to Skurfer's method could be to add a new path applescript action so you could do something like this:
I use I think improving support for AS is important; we'll never be able to know everything that users will want to do, and having a solid AppleScript implementation will make lives much easier for users who do want different actions |
I’m just thinking if you want something, a lot of other people probably want it too so maybe it should be part of a plug-in. AppleScript is always Plan B. (And I felt that way looong before I learned anything about implementing Plan A.) :)
If the script is in the first pane, yes. But remember that only happens for scripts that are added to the catalog, not scripts in the Actions folder (which is what this change is about). I know you’ve added |
@skurfer I see what you mean, and ideally proper plugins won't be written in AppleScript. But… because of Quicksilver's plugin architecture, almost everything is possible. Yourself and other devs are never going to get around to writing plugins for all the apps that people would like to use through QS. An example is Sparrow app. It has an AppleScript Dictionary that allows the sending of emails with attachments. An AppleScript that took an indirect file object in pane 3 could allow the user to write an email body and attach a file without leaving Quicksilver. I have a Script ready to go, it just needs an iObject file path to replace the hard-coded one. I say that's pretty useful in lieu of a dedicated plugin. A file iObject would allow a lot more useful stopgap Actions for various plugin-less apps (dictionaries permitting).
Sorry, I meant the 'on process text' handler within the script. That can only receive text, so dObject has to be text, whether the script is in pane 1 and causing the 'Process Text…' Action, or in Pane 2 as a consequence of being in QS's Actions folder. Any object apart from text in pane 1 will stop the script appearing in pane 2. Unless I'm missing something. If you're saying there's an 'on open file' handler that can take a file object and an indirect object of text or whatever, then that'd be cool. ;) |
I don’t know. The Quick Look scripts uses |
It provides a pane 3, but the script refuses to go past @ddlsmurf any more info on this? Thanks! |
I am sorry, I cannot get any mac dev work done at the moment so I can't test any of that. On the other hand I'm having a hard time parsing what you want and how it relates to this pull request ? |
Thanks @ddlsmurf, I was asking if the iObject could convert a file Object into a text string of its file path. If that's not possible, then no worries. I guess it doesn't really relate to the pull request, Patrick asked me for some ideas. ;) Cheers. |
So it sounds like nothing further is going to happen with this for now. Merge? |
(I am meaning to try and find out about the file path thing, just haven't gotten round to it yet sorry, I'd ask for some more time so we keep it under the same branch. It is possible to use a different string for the iObject, I just have to look into how to get the path - using stringValue seems insufficient) |
Try using I have no problems with this staying open until whichever of these two
On 30 June 2011 19:33, ddlsmurf <
|
Ok I'll try validPaths, thanks! I assume by the name that it handles the comma trick, in which case how would you like your paths formatted ? (I really would prefer not creating an AE list) |
I don't quite understand what you mean by 'how would you like your paths On 30 June 2011 20:35, ddlsmurf <
|
If you select multiple files in the indirect object, what should the applescript string look like ? Comma separated ? Perhaps some escaping ? |
How about '/Users/phil/Test folders/Test folder 1/File test 1.rtf:/Users/phil/Test folders/Test folder 1/File test 2.rtf' (no quotes)? The iObjects are separated by a colon, which is an illegal character for filenames. It'd probably be best to use POSIX paths as file locations are separated by colons and would be harder to delimit, and POSIX paths can be piped into a 'do shell script' command or changed to neutral file location strings:
|
… of text or text)
…plescript action handlers
Indirect object is a text or a list of texts when its paths, thx all:
(edit: formatting) |
Any word on when (or if) this is going to be pushed? I have a fighting chance of compiling the master, and then I can try this feature out. ;) |
Am I correct in thinking that until this gets pulled in to the master branch and a new version of QS is released then there is no way to access both a direct and indirect object with AS ? Even if they are just text? This seems like a very cool thing to have available. Is there any documentation or resources for it? So far this page has been the most helpful thing. |
Well, there’s a way. How comfortable are you with Git and Xcode? ;) I thought this was waiting on something additional, but perhaps not. I’ll look over the comments again and the code and see if there’s any reason not to merge it. And you’re correct that it’ll show up in the next release if I do. |
I don't think this is waiting for anything more (or I am not aware of it so please point it out - and sorry in advance) @clarkewd : Yes, this won't be in Quicksilver until this is pulled in. Also note the code sample changed during the chat . As skurfer said though, you can build your own: build procedures documented here . Though I am unaware of any issues that would prevent this being pulled in at some point down the road. |
It’ll feel good to do something, so yeah, maybe I’ll actually do what I said I’d do a month ago and see if there’s anything outstanding. :) While I don’t use the specific features introduced, I have been running with this code ever since it appeared without issue. |
…bject Add indirectobject parameter to AppleScript action handlers
In scripts in
~/Library/Application Support/Quicksilver/Actions/
, it is now possible to accept an indirect object, example: