Jump to content

I try to make web dictionary search tool in alfred5


Recommended Posts

I've highly imspired by Browser Tabs workflow, so thank you for Emmanuel Pilande.

There is a some important problem this beta version of this workflow.

When target Dictionary is not found in Safari's tab, this workflow makes that it is not relevant current tab to use to open the web dictionary.

In this kind of case I want to make new tab for using open target web dictionary Url.

I try to solve the problem for pass out the bool value and open url and use conditional.

And I also try output value of the script by using bool value,  passing out through or url or original query, so I can use regular expression to use conditonal.

But this kind of approch not well work because Safari error says not collect url.

Also, there is another one problem is how to multiple arguement pass through javaScript is not unsure, so I hardcode in the script target web dictionary url

and to use another target url is little hassle to me. But it's not so big problem because I want a use 2 or 3 web dictionary only.

Someone help me solve this kind of problem?

I appriate you for your kindness.

 

Here is a workflow file.

https://www.dropbox.com/s/qf2w57wpn23hyde/Search Selected Word with Web Dictionary .alfredworkflow?dl=0

Here is Demo of video of useing it.

Link to comment
Posted (edited)

Oh, I forget write about why using the JavaScript.

I want to search a same dictionary in many times in study about languages.

But Hot key and Open URL Action approach that makes a lot of tab to same host URL's search result. That bother me a lot.

I want to use same Dictionary using the a same tab to show the seach result.

So, I use the script to make sure whether same host URL is already open or not

and if that is open to make sure the focus tab is same host URL.

Also I use Apple Script to relocate the URL of the focus tab.

This is needed because many blowser is not change the current tab’s url from external script for some security reason.

I usually use the Vivaldi to web browising but for this reason that I use Safari and AppleScript approch is best for what I want.

One Problem is that target host is not  found in Safari's current tabs, script use the focus tab to rerwrite the URL.

I can't make sure why script is output is only a openUrl, it works with any problem.

Although output the query and use regular expression to confidential with output with collect Url,

only pass through a OpenURL to query to open another tab make error from not collect url.

excuse me for my poor English writting skill.

Edited by tsu-na-gu
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...