gandalfsaxe Posted June 13, 2020 Share Posted June 13, 2020 https://github.com/AndrewC-B/alfred-open-in-chrome/issues/1 Gave this a shot, but Apple Script is too damn obscure. The author seems too busy to fix it, and I gave it a few hours myself. It's basically just a workflow that opens a browser tap in another browser. The problem is, if the user doesn't have the exact list browsers installed, that is supported in the workflow, a dialog box always comes up when invoking the workflow. If anyone here is proficient in AppleScript expert you could probably fix it in a couple of minutes PS: If anyone could also add an optional "close tab in old browser", that's be awesome. Link to comment
deanishe Posted June 13, 2020 Share Posted June 13, 2020 IIRC, you only need to write application "Blah Blah" in a script and AppleScript will try to run the application (i.e. it doesn't matter if your code even takes that branch—AppleScript will still "connect" to the app). And you’ll get the “Where is Blah Blah?” dialog if it isn’t installed. I believe the best solution is to rewrite in JXA, where you can use Application(variable), so you are only creating application instances for the apps you actually want to use. AppleScript doesn’t let you pass a variable to tell application. Link to comment
deanishe Posted June 13, 2020 Share Posted June 13, 2020 Also, you can largely forget about Firefox because it doesn't support AppleScript. You can grab a URL from Safari or Chrome and open that in Firefox easily enough, but getting a URL from Firefox is either complicated (querying my Firefox Assistant workflow) or unreliable (firing simulated keypresses at it). Link to comment
gandalfsaxe Posted June 13, 2020 Author Share Posted June 13, 2020 2 hours ago, deanishe said: IIRC, you only need to write application "Blah Blah" in a script and AppleScript will try to run the application (i.e. it doesn't matter if your code even takes that branch—AppleScript will still "connect" to the app). And you’ll get the “Where is Blah Blah?” dialog if it isn’t installed. I believe the best solution is to rewrite in JXA, where you can use Application(variable), so you are only creating application instances for the apps you actually want to use. AppleScript doesn’t let you pass a variable to tell application. So no easy solution in AppleScript? It would be easiest if there was a solution here because the whole workflow is already in AppleScript. The guy did mention in the issue conversion that Firefox doesn't support Apple Script but apparently he found a solution and added a bunch of other browsers when he was at it. Link to comment
deanishe Posted June 13, 2020 Share Posted June 13, 2020 1 hour ago, gandalfsaxe said: So no easy solution in AppleScript? There’s a “semi-workaround” with using terms from, as you can see in Vítor's script for getting browsers' URLs. So you can get away with not having Chrome Canary installed, but you must still have the "parent" browser Chrome installed or you'll get the "Where's Blah?" dialog. 58 minutes ago, gandalfsaxe said: The guy did mention in the issue conversion that Firefox doesn't support Apple Script but apparently he found a solution and added a bunch of other browsers when he was at it. Well, yeah. You can theoretically get the URL out of almost any browser by firing simulated keypresses at it to select the address bar and copy the URL. But it’s not reliable because there’s no way of knowing if it has worked. Personally, I've found Firefox works very unreliably with the clipboard, to boot. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now