CrazyCoder / Wox.Plugin.Runner

A plugin that allows you to create simple command shortcuts in Wox.
13 stars 4 forks source link

Capture all arguments? #1

Open glenviewjeff opened 6 years ago

glenviewjeff commented 6 years ago

Hi everyone, I was able to get Serge's fork to work with individual arguments ({1}, {2}, etc.) but can't seem to figure out how to pass all/variable # of arguments (e.g. {*}). Launchy's runner plugin allows this, and I need it for commands such as sending a text message or executing commands that accept variable #'s of optional arguments, etc. Is this implemented with a secret syntax or just not implemented?

ghost commented 5 years ago

Hello All,

Was this issue ever resolved? What is the syntax for passing an unspecified number of arguments? I tried {*} and (*) and "{*}" -- none of these seems to work.

image

glenviewjeff commented 5 years ago

I don't think the developers are following the fork; they never responded. As far as I can tell, this isn't supported, which sadly keeps me from using Wox. I haven't had the time and energy to set up a development environment to learn how to build a plugin and fix this problem. Incidentally, there are a couple of other forks of this plugin but developers didn't respond there either.

ghost commented 5 years ago

Thanks for the quick response. I am starting to reconsider using Wox myself.

Another thing I'm not sure about is how to pass multiple words to arguments. Hopefully I'm just doing something wrong? For example, when Arguments is set to {0} {1} {2} and I execute it like test one two three, I get the expected result (3 arguments). But if instead I try multiple words in one parameter like this test one "more than two words" three, the result is only two arguments: one and more than respectively -- the rest is lost!

glenviewjeff commented 5 years ago

Yes, I too tried a number of workarounds, all of which fail. I tried adding way more arguments than I'd need, but the C# format method that the plugin uses requires that all of the arguments be provided or else it returns an error, which is passed back to the user in Wox. Enclosing a multi-word single argument in quotes also fails. My next thought is to look at reusing the code from the web searches plugin, which uses the "{g}" keyword to insert all entered arguments. I downloaded Visual Studio, which I've never really used, but I'll give it a shot because it seems to be an otherwise worthy upgrade of Launchy. For now, I'm running both Launchy and Wox simultaneously.

glenviewjeff commented 5 years ago

Here's the plan:

From web searches plugin code reuse this snippet:

string keyword = query.Search
searchSource.Url.Replace("{q}", Uri.EscapeDataString(keyword))

Like this inside GetProcessArguments in Runner.cs, replacing line 77 with something like:

if (c.argumentsFormat.Contains("{a}")) {
   searchSource.Url.Replace("{a}", Uri.EscapeDataString(keyword));
} else {
  argString = String.Format( c.ArgumentsFormat, arguments.ToArray() );
}

By the way I have no idea why line the Replace() method is called from a new process in the web search code, so I pulled it out. I'm not a C# developer, but this makes no sense to me. Also, I don't see where the searchSource string gets cloned, but maybe for some reason C# does this implicitly? Also makes no sense to me.

glenviewjeff commented 4 years ago

Finally got around to my yearly search for a Launchy alternative and found the damn holy grail. I'm not sure how I missed out on Keypirinha, but do yourselves a favor and check it out! Much, much better than Launchy ever was, and far better than Wox. Runner equivalent is built in, and of course properly supports arguments and so much more. Tons of configurability and extensibility.

On Wed, Oct 2, 2019 at 4:01 PM Taurusplank notifications@github.com wrote:

Thanks for the quick response. I am starting to reconsider using Wox myself.

Another thing I'm not sure about is how to pass multiple words to arguments. Hopefully I'm just doing something wrong? For example, when Arguments is set to {0} {1} {2} and I execute it like test one two three, I get the expected result (3 arguments). But if instead I try multiple words in one parameter like this test one "more than two words" three, the result is only two arguments: one and more than respectively -- the rest is lost!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/CrazyCoder/Wox.Plugin.Runner/issues/1?email_source=notifications&email_token=AACRYQVLP2YEWYOK2U7YPUTQMUDZBA5CNFSM4F7YOK3KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEAGFHSI#issuecomment-537678793, or mute the thread https://github.com/notifications/unsubscribe-auth/AACRYQTHUZUYYY5W4CGSK4LQMUDZBANCNFSM4F7YOK3A .

jjw24 commented 3 years ago

While porting and fixing the Runner plugin for Flow Launcher I can't help but notice there are some struggles with this Runner argument issue. Thought better late than never, this issue should be resolved with the Flow Launcher port if you ever want to give it a second shot.

glenviewjeff commented 3 years ago

Glad to see you coming back for this. I'm really happy with Keypirinha for what it's worth.

On Fri, Feb 12, 2021 at 5:51 AM Jeremy Wu notifications@github.com wrote:

While porting and fixing the Runner https://github.com/jjw24/Wox.Plugin.Runner plugin for Flow Launcher https://github.com/Flow-Launcher/Flow.Launcher I can't help but notice there are some struggles with this Runner argument issue. Thought better late than never, this issue should be resolved with the Flow Launcher port if you ever want to give it a second shot.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/CrazyCoder/Wox.Plugin.Runner/issues/1#issuecomment-778150040, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACRYQSOT6ULQDYU6OHPVJ3S6UI3FANCNFSM4F7YOK3A .