Continuing the discussion from Editing Bar and URL field:
I am wondering if there is a way (perhaps a control key or an option) to change the behavior of the url bar?
I would like it to behave like the omnibar in chrome at least as far as letting me edit the URL.
Currently when I click it, the url is then opened in another application like Safari.
No need to do the fancy stuff Google does with their omnibar (calculations, search, etc.) but I would like to be able to change the url by typing or copy/pasting.
Is there a method I can use?
The only possibility right now is to script this, e.g. have a look at Scripts > Tabs… for similar scripts. E.g. here’s a basic example:
tell application id "DNtp"
set theURL to display name editor "Change Location" info "URL:" default answer "https://"
if theURL is not "" and theURL is not "https://" then set URL of current tab of think window 1 to theURL
Would you be willing to consider the idea of simply being able to click, type, and hit enter as useful?
We consider most ideas but no promises.
No worries. I have a solution now.
Keyboard Maestro(KM) allows me to create mouse gestures and keyboard shortcuts.
I wanted a back button. So I gave my mouses (two computers so the device names are slightly different and both are assigned to this macro which syncs between the computers) the following ability:
I wanted to have a way to change and open the URL, so I did this, which allowed me to add some automation as well for whatever my current task is. This example takes the current url and opens a dialog that lets me type a new url or change the exiting and then runs an applescript (your applescript in fact) that causes this to open as a new tab. I suppose, I could also close the old tab first with cmd+W and that will give the same effect as editing the url.
Also playing with this because I was getting rate limited on nitter and needing to refresh. Going up and clicking the tiny reload button next to the url or even right-clicking and selecting reload are a pain, so I changed it to a ctrl+right-click and that seems to work nice. I will play-test this more and perhaps switch it to F5 like Chrome or something or use both. Not sure yet…
Thanks for sharing these macros! Isn’t the macro to open the URL in a new tab basically identical to Scripts > Tabs > Open Location…? A simple revision of the script could also use the current URL:
-- Import helper library
tell application "Finder" to set pathToAdditions to ((path to application id "DNtp" as string) & "Contents:Resources:Template Script Additions.scpt") as alias
set helperLibrary to load script pathToAdditions
tell application id "DNtp"
set theURL to ""
if exists think window 1 then set theURL to URL of think window 1
if theURL is missing value or theURL is "" then set theURL to "https://"
set theURL to display name editor "Open Location" info "URL:" default answer theURL
if theURL is not "" and theURL does not end with "://" then
-- Open URL in a new tab
my helperLibrary's openURLInTab(theURL)
on error error_message number error_number
if the error_number is not -128 then display alert "DEVONthink" message error_message as warning
I guess I find Keyboard Maestro easier to understand and manage.
I always preferred to use visual languages instead of typing code.
When I asked above if we could just make DT3’s url bar editable, I was thinking that would be nice, but because KM gives me this nice dialog that works pretty well for me:
Devonthink has the same result - I just needed to give it a hotkey I suppose.
KM lets me populate it with the existing URL or do substitutions to save myself some time.
For example like this:
But you are right, it’s basically the same thing and you probably noticed the applescript used is your code (still has your name on it).