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

3-pane applescript actions that accept files #1023

Closed
daniels220 opened this issue Jul 29, 2012 · 9 comments
Closed

3-pane applescript actions that accept files #1023

daniels220 opened this issue Jul 29, 2012 · 9 comments

Comments

@daniels220
Copy link

So a while back I wrote #947, and holy crap is it too long. Sorry. I figured I'd try again with something more specific.

Is there any chance of an AppleScript actions API that allows a file to be selected in pane 1 for a 3-pane action? Right now, you can make a 3 pane action with get argument count/process text (1st pane text, 3rd pane text or file-passed-as-path), but even though on open theFiles with iObject compiles, QS throws an error in the console saying Perform AppleScript Action Error: "NSAppleScriptErrorMessage" = "The iText parameter is missing for open."; when you try to run that action.

I would also like, if possible, the ability to specify what type of file I want, and whether I can accept text—basically the full range of restrictions that Obj-C actions can evidently place (like New Folder..., Move To..., etc).

@pjrobertson
Copy link
Member

This will be fixed when #1048 gets merged. Hopefully one of the next two releases of QS

@daniels220
Copy link
Author

That looks nice, thank you very much.

Any chance of implementing it as "on [open file/process text] dObj with [text/file] iObj"—i.e. allowing the action-writer to force the type of the 3rd pane as well? Ultimately it would be awesome if it were "on process <> dObject with <> iObject", such that you could specify "email", or "folder", or "URL", arbitrarily in either field. That, I'm sure, is a lot more work, and would best be implemented after cleaning up the Actions preferences to more clearly handle types, which I think I remember as being on the "sometime, maybe, when we're done putting out fires and adding easier features" list.

I look forward to seeing what good stuff you come up with—in a relatively short time QS has already gone from "well, when it works it does a couple things that no other software does, so I'm stuck with it" to every bit as good as it ever was and faster to boot.

@pjrobertson
Copy link
Member

The way it stands at the moment, you can use:

on process text someText with someText/aFile

and

on open files aFile with someText/aFile

so you can use text or a file in the iObj, you just need to use on open
files or on process text depending on what types of items (text or files)
you want the action to appear for.

On 16 August 2012 23:26, daniels220 notifications@github.com wrote:

That looks nice, thank you very much.

Any chance of implementing it as "on [open file/process text] dObj with
[text/file] iObj"—i.e. allowing the action-writer to force the type of the
3rd pane as well? Ultimately it would be awesome if it were "on process <>
dObject with <> iObject", such that you could specify "email", or "folder",
or "URL", arbitrarily in either field. That, I'm sure, is a lot more work,
and would best be implemented after cleaning up the Actions preferences to
more clearly handle types, which I think I remember as being on the
"sometime, maybe, when we're done putting out fires and adding easier
features" list.

I look forward to seeing what good stuff you come up with—in a relatively
short time QS has already gone from "well, when it works it does a couple
things that no other software does, so I'm stuck with it" to every bit as
good as it ever was and faster to boot.


Reply to this email directly or view it on GitHubhttps://github.com//issues/1023#issuecomment-7801642.

@daniels220
Copy link
Author

Yeah, sure, that's a 90% solution and it's fine for now. It'd be nice if (95%) I could say, this action needs a file, not text, in pane 3.

Later I think one possible 99.9% solution is what I outlined above—a large, possibly extensible, list of types accessible to AppleScript, and a format something like "on process <> dObject with <> iObject". Not sure if AppleScript makes this easy—looking at the code, it's obviously not a totally simple conversion.

Actually, another way to do it would be to have another function, "get argument types", that would return {dType,iType} (and automatically set argument count if it returns 2 things). Then the current APIs are fine.

@pjrobertson
Copy link
Member

Yeah, sure, that's a 90% solution and it's fine for now. It'd be nice if
(95%) I could say, this action needs a file, not text, in pane 3.
*
*
Maybe I didn't explain it properly. Even if you accept a file in pane 1 you
CAN accept text in pane 3 (it's universal). Or if you need text in pane 1
you CAN accept text in pane 3

Later I think one possible 99.9% solution is what I outlined above—a
large, possibly extensible, list of types accessible to AppleScript

You're probably right, that would be the end goal. At the moment, the
script will accept almost anything in pane 3 and convert it to text. You
can see that the 'text' of an object looks like by pressing '.' when you
have the object visible.
E.g. you could accept an email address, contact's name, an email from Mail
(gives the title) etc.

On 17 August 2012 00:45, daniels220 notifications@github.com wrote:

Yeah, sure, that's a 90% solution and it's fine for now. It'd be nice if
(95%) I could say, this action needs a file, not text, in pane 3.

Later I think one possible 99.9% solution is what I outlined above—a
large, possibly extensible, list of types accessible to AppleScript, and a
format something like "on process <> dObject with <> iObject". Not sure if
AppleScript makes this easy—looking at the code, it's obviously not a
totally simple conversion.

Actually, another way to do it would be to have another function, "get
argument types", that would return {dType,iType} (and automatically set
argument count if it returns 2 things). Then the current APIs are fine.


Reply to this email directly or view it on GitHubhttps://github.com//issues/1023#issuecomment-7803167.

@daniels220
Copy link
Author

Actually I think I didn't.

What I meant was, I want to be able to specify which —text, file, and later folder, URL, email, application, etc.—I want, and not the others. I want to be able to force Pane 3 into text mode, or disable it (force it to stay in file-search mode). I want to have the catalog-search performed there search only folders, only apps, contacts, bookmarks, whatever. At the moment any action I want to write, I probably can—but I have to do all sorts of type checking, if I want it to be safe. Also, the "and converts it to text" bit is kinda a problem, at least for anything more complicated than a file. And every line of AppleScript code is slower than the same thing in Objective-C, and it has to be duplicated between similar actions.

I realize, though, that as I said—any action I want to write, I probably can, it's just a matter of telling people what will break it. So for now it's fine. Thanks again for all the great work.

@pjrobertson
Copy link
Member

OK, I understand. Yes, that would be nice to get AppleScripts to have all
the flexibility that built in actions have. Maybe one day... :)

On 17 August 2012 07:33, daniels220 notifications@github.com wrote:

Actually I think I didn't.

What I meant was, I want to be able to specify which—text, file, and
later folder, URL, email, application, etc.—I want, and _not the others._I want to be able to force Pane 3 into text mode, or disable it (force it
to stay in file-search mode). I want to have the catalog-search performed
there search only folders, only apps, contacts, bookmarks, whatever. At the
moment any action I want to write, I probably can—but I have to do all
sorts of type checking, if I want it to be safe. Also, the "and converts it
to text" bit is kinda a problem, at least for anything more complicated
than a file. And every line of AppleScript code is slower than the same
thing in Objective-C, and it has to be duplicated between similar actions.

I realize, though, that as I said—any action I want to write, I probably *
can,* it's just a matter of telling people what will break it. So for now
it's fine. Thanks again for all the great work.


Reply to this email directly or view it on GitHubhttps://github.com//issues/1023#issuecomment-7810853.

@skurfer
Copy link
Member

skurfer commented Aug 17, 2012

Heh. OK, at a certain point, you just need to use Objective-C. ;-) This is all possible today.

@daniels220
Copy link
Author

Hey, thanks for the link. I don't know Obj-C at the moment—it's on the list of "things I want to learn Someday Maybe"—but QS will be one of the first things I look at once I'm comfortable, if/when I do learn.

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

No branches or pull requests

3 participants