-
Notifications
You must be signed in to change notification settings - Fork 286
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
AppleScript action improvements. Fixes #1023 #1048
Conversation
Any update on if/when this will be merged? I'd very much appreciate this feature. |
@daniels220 - we're at the mercy of the other Quicksilver developers (most likely @skurfer ;-) ) on getting this merged. |
Careful what you wish for. I don't care if AppleScript works or not, so I'm as likely to merge it unseen as anything. ;-) Seriously, I wonder if @ddlsmurf has time to look it over. He'd be much more qualified to render an opinion. |
Does this mean Update: The console shows
|
Trying to move a file to the Desktop using your example script, I get:
|
Hmm... I'll take a look. Thanks! :D |
OK I've added a new commit that fixes the problem. It must have slipped through at some point. Also note that the AS in the initial comment will give an NSLog when run, since it doesn't return anything. Adding using terms from application "Quicksilver"
on get argument count
return 2 -- if you want the third pane to be filled, otherwise return 1 (or leave this handler out)
end get argument count
on open files dObject with iObject
tell application "Finder" to move file dObject to folder iObject
return missing value
end open files
end using terms from |
OK, that seems to work (if you build QS with the changes, recompile the script, then relaunch QS). It should probably return the file in its new location (if such a thing is possible), but that's obviously an issue with this particular script. I still can't use an old script that starts with
|
Yep, good catch on that one, thanks.
Yeah you'd just need to do something like (untested) return (Posix path of THEFILE) as alias |
OK, the old scripts work now, but the example you gave fails. :-/ I saw this when testing the other day, but wanted to be sure Launch Services forgot about any old versions so I waited a while. It crashes with this:
|
This is pretty close, right? 1.0? |
uuuuh, yes OK :D On 31 January 2013 20:18, Rob McBroom notifications@github.com wrote:
|
Will it include #1264 also? |
We'll see how it goes, but thanks for reminding me. We're working to a pretty tight schedule over the next few days ;-) On 31 January 2013 22:52, David Rees notifications@github.com wrote:
|
OK, all outstanding problems should be fixed. I've actually tested it this time :) ... and I just couldn't stay away, once I'd got 'comfortable' with the scripting definitions. I've added two new handlers which can be used in AppleScripts:
You use them to specify the valid direct types the action will display for, and the files that appear in the 3rd pane for the action, respectively. An example: Take either of the 'shorten URL' AppleScripts from http://qsapp.com/wiki/Shorten_URL_(AppleScript) and save them in the Actions folder (~/Lib/App support/QS/Actions) Restart QS to add the action, and you'll notice that you can find the action for any text that's in the 1st pane. But preferably, you only want the action to display for URL types. Go ahead and add this to the script (on the 2nd line): using terms from... (1st line. Add the text below:)
on get direct types
return {"Apple URL pasteboard type"}
end get indirect types Now, the action will only display for URLs. The types are listed here: http://qsapp.com/wiki/AppleScript_Types (messy atm, I'll tidy it up) (Note to devs: since this then just uses |
@studgeek and @philostein I've added lots of documentation to the wiki on how to use these new handlers. See We would greatly appreciate it if you could both build Quicksilver with these changes and test them out. We're running a tight schedule at the moment (you'll see why soon!) so any second you could spare would be really helpful to us |
Will somebody please stop me before this gets out of hand ;-) I've now added the option for the 3rd pane to be optional. on get argument count
return 3
end on get argument count |
Rebased against master.
I quite like this though because: a) it fixes the bug mentioned above, b) it makes the 'optional' factor even more obvious, c) cool that QS reveals and hides the pane. Kinda seems to me like 'peeking' round a corner, d) you can still see the iObject selected in the interface's 'description' label (depends on the interface - but works in Nostromo) For @philostein, @studgeek (and potentially @daniels220) I've built a copy of this app, which you can test if you download it from here |
Only show it if the user explicitly tabs over to it
…in AppleScripts (and iObjects)
Also, fix the setting of the actionDict's Action Handler to ensure the action displays for the correct dObjects (validates objects correctly) Set file iObjects as pathDescriptors in AppleScript
Allows you to return a list of valid iObject/dObject types for the script
Plus: Comments, tidy-up and DRY
As I look at the closing of #947, I thought i would point out one other plugin vs AppleScript gap to consider for the future which is adding items to catalog. For example, you could use a script to add to the catalog specific URLs, including different URLs schemes like youtube, itunes, messages, and custom ones (Apple URL Schemes). So there would be a handler called "on get catalog type" that would return a type string and "on get catalog items" that would return an array of object strings. Those strings would then be objects that the scripts could indicate they support using "get direct/indirect types". More generically, I could see cases where you want to introduce a whole new types like "monitor" or "USB Device" so you can write applescripts for that type. So you could actually introduce a new type and a whole set of actions for it with just a little applescript coding. You could also use the new types as indirect items that are appropriate for the script. For example you could add a "monitor" type, then have a "move to monitor" action that takes the indirect monitor name. The script's "on get catalog items" would scan and return the list of monitors. Just a thought for the future... |
Great, I'm glad it's useful! And thanks for making edits to the wiki. I agree with you on everything you've done. Much clearer :) I've edited it a little further:
Yes, which makes me realise that
Strings or files at the moment. Quicksilver will test to see if the objects are files. If they are it'll send file objects to the script, otherwise a 'string representation' of the object. (this can be misleading as it varies from object to object - to see the string representation of an object select it in the 1st pane, close QS, open QS then press '.' to enter text mode)
Correct, I'd planned on adding some more to the list, but if you're happy to do so, here's the best way:
data = {
"Apple URL pasteboard type" = "sftp://qs:PasswordInKeychain@qsapp.com/home/qs/public_html";
"QSTransmitSiteType" = "7E78BA8C-8EAD-4D42-85DA-12C7A2654AE3";
};
Yes :)
A good idea, I mentioned it in my comment on #947 that it's something to add in the future. Perhaps we should open another 'AppleScript specific' feature request issue. Just to make sure - are you testing the version of Quicksilver I uploaded, and more importantly... is it working?! Thanks for your help! |
And even more importantly, does this mean I don't have to test it? ;-) (I will. Grumble grumble.) |
Looks good. Old scripts work, and the example you posted to move files works. I still see the console message from #783 though. That's not going to hold this up, but I thought I'd mention that it's not fixed. |
:( Still seeing those error messages? What's the script? On 2 February 2013 01:24, Rob McBroom notifications@github.com wrote:
|
using terms from application "Quicksilver"
on process text theText
set logEntry to the quoted form of theText
do shell script "/Users/rob/bin/tlog " & logEntry
end process text
end using terms from You obviously won't have |
Tried these changes, and I can set the object types for pane 1 and 3, but only if I compile the script so:
The The I don't have any other QSes on my system now, 'ghost' or otherwise. :) FYI: AS QS crashes 5 or 6 times on launch, but eventually it stays open and is generally fine until the next relaunch. |
@philostein - thanks for trying this out. The errors you have are most definitely related to the AppleScript editor picking up the wrong QS. If you go to AppleScript Editor → File → Open Dictionary, how many 'Quicksilvers' are in the list? Thanks for trying this out - so do the scripts work (when compiled as you say), and any suggestions/problems? :) |
You guys are amazing, thank you so much. Looking forward to the final release of these changes. |
There's only 1 QS in the dictionaries list, and the new handlers are there, but… relaunching ASE did the trick! Must have a dictionary cache or some such. Annoying. These changes work great! I was able to define different object types for the scripts to be valid for. They don't appear for other object types. The I'm not sure about the I'll update some of my scripts to use the object types and open files handlers, and then post back here. One idea: object types for specific objects such as Sparrow.app or Todo.txt - then custom actions could be dragged to the top of Actions preferences and appear first for only those objects. I realise though that you're extending how QS handles generic object types, so I understand if my idea is impractical. :) |
So everyone good with this? |
I have been traveling and have not had a chance to test it, but am very excited for it none the less. I can create a separate issue for the "adding to the catalog/types" idea I listed above. |
AppleScript action improvements. Fixes #1023
Might need some help with the release notes on this one. All I have for the moment is:
|
I'd like to make a command that goes like this: [email address]>[action]>[file]
This would be useful to get an email address from Contacts as a recipient for an attachment in pane 3. The other way round works well ([file]>[action]>[typed email address]. Just sent the crash report in QS. |
Fixed it, used This is really useful. :) |
Glad it's fixed. QS still probably shouldn't crash, can you post the full Ta On 10 February 2013 12:58, philostein notifications@github.com wrote:
|
Sure:
|
@pjrobertson I'm interested in getting the object types again Is there a way to get it in a beta/release build. Failing that, how do I create a debug build? I can follow http://qsapp.com/wiki/Building_Quicksilver, but what else do I need to do to get the object types in the log. I'll add I agree with #1817 that it would be very handy to just add an action for this (maybe one that is off by default). |
Hmmm... the only way that I know of is to use a debug build. The debug build adds an option in the mneu bar icon called 'log object to console'. That will show all the types that exist for a single object (that's selected in QS' first pane) |
I don’t suppose you figured out how to sign the app for Gatekeeper with Xcode 6. 😃 Yes, they changed it again, and I can’t even get it to sign on my wife’s machine with Xcode 5. |
hmm.... nope not really :( |
Actually, I think you can use Developer.xcconfig for that. Bonus points if you can manage to make a nice section :
Commit the file with those change for the posterity, and then make git ignore subsequent changes for this file — I know there's a way to exclude a file while having it still checked out. |
I thought the env variable was |
The
The app appears to run, so I guess we don’t need those files. Can we change the framework build process so they don’t get created in the first place? I have some documentation open for that, but haven’t had a chance to read it. |
FYI, I documented the current instructions for looking up other object types in http://qsapp.com/wiki/AppleScript_Types#Other_Quicksilver_Object_Types (along with basic UTI stuff). |
Hey, sweet, exactly what I was looking for! Thanks! |
This adds an
open files
method to Quicksilver's scripting library, for dealing with files.At the moment, you can send a file from the dSelector to an AppleScript by writing in the AppleScript:
on open myDObject
This is somewhat misleading though, as this just uses the AppleScript standard
open
action with things piped from Quicksilver, meaning that doingon open myDObject with myIObject
builds fine in the AppleScript Editor, but it doesn't run.Adding a new
open files
method means that you now useon open files myDObject with myIObject
in AppleScript (the on open myDObject method still works for backwards compatibility), meaning there's much less ambiguity, sinceopen files
is defined by QS and will validate the AppleScript.Along with this, I've fixed a small bug whereby if an AppleScript contained something like
tell Application SomeApp to open
, Quicksilver would think it was a file AppleScript, even if it started withon process text
An example of how to use this action: