How Do I Use Current Browser URL and Title To Create a WebLoc file? and How Do I Rename Forklift Files?

Hi Chris, the first macro works perfectly apart it will only execute when I hit the Run command in the Editor. Hitting F1 (or any other hotkey I try) seems not to execute it at all. Newbie time I guess. What am I missing?

Hey Daron,

As for ForkLift...

It has only the most rudimentary AppleScript dictionary, so you basically can't do jack with it.

However – Keyboard Maestro can often make the impossible possible on a Mac.

Quick Select works quite well in ForkLift and supports regular expressions.

⌘S

Quick Open give access to various commands, saved rename specifications, and suchlike.

Escape

You can also assign a keyboard shortcut to 'Copy Path to Clipboard', copy the paths of the selection, and then use AppleScript to operate on those files in the Finder.

So you can make ForkLift behave more the way you want it to.

-Chris

Grr.

You probably need to toggle Keyboard Maestro accessibility permissions. See this:

Let me know if that fails to solve the issue.

-Chris

1 Like

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Hi dbrewood, welcome to Keyboard Maestro (KM) and its Forum.
KM is one of the best Mac automation tools available, its Forum is one of the best and friendliest forums on the Internet. Whenever you reach a tough stumbling block trying to use KM, please feel free to post your question/problem here for help.

You will also find this helpful:
Tip: How Do I Get The Best Answer in the Shortest Time?

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In the future, please post each question as a separate topic, with a Topic Title that reflects the nature of the question.
This time I have changed your Topic Title to reflect both questions.

Hi Chris, alas no difference at all. I can have Brave fronted and with the Editor open hit 'Run' and it works perfectly. If I hit the F18 I selected to run the macro nothing at all. Interestingly enough if I change the hotkey to a KBM key I already have assigned instead of getting the choice popup it just executes the original macro I assigned.
Thought - to import the macro I just double clicked on it, should I have done it some other way? Also if I click on 'Enabled Macros' it is not in the list, but as far as I can see it looks to be enabled? Or again I'm missing the obvious.

[quote="JMichaelTX, post:8, topic:20322"]
You will also find this helpful:
Tip: How Do I Get The Best Answer in the Shortest Time? [/quote]

Thanks duly noted :slight_smile:

Again my thanks, newbieness will wear off :slight_smile:

I fixed it, I created a new group 'My Macros' and dragged it into there and it now works :slight_smile:
Thanks muchly!

Hmm...

I suspect when the macro imported the Macro Group 'Test Group.ccstone' was not enabled. That's a safety feature in Keyboard Maestro.

Look in the View menu for 'Enable Macro Group'/'Disable Macro Group'

You'll probably want to make a Brave Browser specific Macro Group, so your related macros are only available in the app – otherwise they'll be global.

-Chris

Hi Chris, correct that was what the issue was :slight_smile:
I have now set up a Brave group as you recommended. :slight_smile:

The only 'slight' issue that I have, which I don't think can be fixed, is that of the '.webloc' extension being on the file created. I I dragged a URL onto the desktop the shortcut created does not have the '.webloc' on it at all so looks much neater. I can live with it of course and I'm not complaining at all. Just it'd be neater not to have it visible.
It's weird as if I look at both types of shortcut in Finder they both look the same and both show the extension, just the ones dragged there do not show '.webloc'. Macs are weird!

:sunglasses:

Is this setting on or off on your system? It's in the Finder Preferences – ⌘, in the Finder.

image

-Chris

It is indeed:
image

The three top ones are created with the macro, the bottom two dragged and dropped. Oh macro modified to save to desktop...

image

Okay, in that case we can fix it.

Try this updated version.

-Chris


Create WebLoc File in Finder from Brave Browser v2.00.kmmacros (7.3 KB)

1 Like

Many, many thanks Chris, that works absolutely perfectly! Made my morning that has!

1 Like

@ccstone an interesting one to note this morning. I've modified the macro to work with Vivaldi (same issue applies in Brave though) and for some pages like this one, the webloc shortcut is created, but when looking to click on the desktop to open it Safari executes and fails to load the page. Other YouTube videos seem fine.....
I've experimented with using the same Macro in Brave and Vivaldi and both exhibit the same issue. Weird. Anyway I thought it worth feeding back...

Hey Daron,

Hmm...

After doing some detective work it seems that Apple's .webloc files prefer that HTML entities be encoded.

In the case of your YouTube video:

https://www.youtube.com/watch?v=uuHVrtRqbrQ&feature=youtu.be

Needed to be converted to:

https://www.youtube.com/watch?v=uuHVrtRqbrQ&feature=youtu.be

I've fixed this in the macro by adding the appropriate Filter action for the URL.

I've also made the macro browser-agnostic (to a point) – it now supports Safari and all Google Chrome variants that Keyboard Maestro's FrontBrowser token supports.

-Chris


Create WebLoc File in Finder from Front Browser v3.00.kmmacros (8.4 KB)

2 Likes

@ccstone

Chris you are a complete and utter star!

I didn't think a fix would be possible, but to achieve that and also to make it browser agnostic is awesome!

Thanks very much!

1 Like

Hi Chris, it's been a while...

Is there any easy way of updating the macro so that is creates an HTML shortcut on the desktop instead of a webloc file?

I'm asking as with Ventura 13.1 Apple are at the moment forcing any links saved on the desktop to be opened in Safari and this can't be changed. The only work around is to 'right click and select open with' which is rather a pain to work with.

If the shortcuts were HTML links then it truly makes them browser agnostic.

Any thoughts would be appreciated.

Hey Daron,

Do you have a working example of one of these HTML link files?

I'm not familiar with them.

I’m still running macOS 10.14.6 Mojave, so if it's anything to do with the new Shortcuts App I can't help.

Strange that Apple would enforce .webloc files opening in Safari. Microsoft got in quite hot water over similar highhandedness a number of years ago.

It might be better to work with standard .webloc files, since that's what is formed by drag and drop.

See if this works to open the selected .webloc file in Google Chrome:

--------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2022/12/16 05:23
# dMod: 2022/12/16 05:23 
# Appl: Finder
# Task: Open Selected WebLoc File in the Given Web Browser.
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @Finder, @Open, @Selected, @WebLoc, @Web, @Browser
--------------------------------------------------------
# Safari's ID ⇢ com.apple.Safari
--------------------------------------------------------
property browserAppIDStr : "com.google.Chrome"

try
   
   tell application "Finder"
      set finderSelectionList to selection as alias list
      if length of finderSelectionList = 0 then error "No files were selected in the Finder!"
      set weblocFileAlias to item 1 of finderSelectionList
      
      if class of (file weblocFileAlias) = internet location file then
         
         set appRef to application file id browserAppIDStr
         open weblocFileAlias using appRef
         
      else
         
         error "The Selected File Was NOT a WebLoc File!"
         
      end if
      
   end tell
   
on error errMsg number errNum
   set errMsg to errMsg & linefeed & linefeed & "Num: " & errNum
   if errNum ≠ -128 then
      try
         tell application (path to frontmost application as text) ¬
            to set ddButton to button returned of ¬
            (display dialog errMsg with title ¬
               "ERROR!" buttons {"Copy Error Message", "Cancel", "OK"} ¬
               default button "OK" giving up after 30)
         if ddButton = "Copy Error Message" then set the clipboard to errMsg
      end try
   end if
end try

--------------------------------------------------------

-Chris

Hi Chris,

Attached should be a zip file containing a HTML file.

On the script file you've provided how would I change it to see if it worked with Brave? (I don't / won't ) have Chrome on my machines :slight_smile: I assume it's an AppleScript file?

There are a lot of folks complaining about this issue here.


How Do I Use Current Browser URL and Title To Create a WebLoc file and How Do I Rename Forklift Files Questions Suggestions Keyboard Maestro Discourse.html.zip (1.3 KB)

Brave's ID:

com.brave.Browser