Hello,
I often consult special apps like dictionaries and other references while I am working.
I am able to create a macro to activate (display) the app (or websites converted to apps with Fluid), and another one to hide it (activate app followed by Cmd-H). Please note that the solution is not to simply type Cmd-H because I am usually not in the app itself when I want to hide it.
I would like to avoid having to create 2 macros: one to activate and one to hide.
Is there any way to toggle the app activation: ie the macro activates it if it is not being displayed and hides it if it is being displayed?
thanks very much in advance for your time and help
Hey @ronald
Give this a try.
The same thing can be done with Keyboard Maestro actions.
- If (application condition)
- Hide specific application.
- Show specific application.
- Activate a specific application.
I'm not sure how Fluid distinguishes between the apps it creates, but there's probably a way to work with them. Todd is pretty bright.
-Chris
Toggle Visibility of a Running Application (activate if not running).kmmacros (2.7 KB)
works perfectly: thank you so much !
it works fine, except for one dictionary app called dict.cc created with Fluid. I deleted and re-created the app, giving the name dictcc (without the '.') but for some crazy reason, if it is not named properly dict.cc, it will not run.
I created â deleted â re-created it 10 times to confirm this.
I created the macro below which works.
Your macro above will not run if I replace textedit with dict.cc, probably because the '.' is a reserved symbol.
Is there a work around you could think of ?
thanks very much
If KM actions work where the AppleScript doesn't, recreating the script's logic in KM would seem to be the way to go:
Dict.cc app.kmmacros (5.8 KB)
Hey @ronald,
I did mention there might be an issue with Fluid appsâŚ
Make sure your dict.cc app is running and then run this from the Script Editor.app:
tell application "System Events"
return name of application processes whose background only is false
end tell
See what the system thinks the name of your app is.
How to approach the problem depends upon the answer.
-Chris
Hello CC,
Sorry for the delay.
I would like to apologize. I very much appreciated your script, and I gave the impression I was sidelining it.
You are right: you did mention that there may be an issue with Fluid.
I did not mention that based on your email, I tried your script with other Fluid created apps and they worked. I concluded that somehow the apple script does not tolerate a â.â in the app name, hence my response above.
I did not have the problem with GGllickâs macro.
This is the result of your test with script editor.app and dict.cc active:
{âFinderâ, âPath Finderâ, âCarbon Copy Clonerâ, âKeyboard Maestroâ, âMoomâ, âScanSnap Managerâ, âLaunchBarâ, âMessagesâ, âapp_mode_loaderâ, âVivaldiâ, âGoogle Chromeâ, âEvernoteâ, âPrint Selectionâ, âCloudPullâ, âSystem Preferencesâ, âP-touch Editorâ, âMailâ, âPrinterProxyâ, âToucheĚâ, âSnagit 2018â, âNotesâ, âNumbersâ, âPrinterProxyâ, âhandyPrintProâ, âPreviewâ, âPDF Expertâ, âPagesâ, âFluidAppâ, âTextEditâ, âFluidâ, âActivity Monitorâ, âFluidAppâ, âScrivenerâ, âSimpleMindâ, âOmniOutlinerâ, âfirefoxâ, âBetterTouchToolâ, âScript Editorâ}
thanks again very much CC
Hey @ronald,
That ought not to be an issue.
Hmm⌠I donât see a âdict.ccâ listed there â only FluidApp and FluidApp.
What happens when you run this?
tell application "dict.cc"
activate
end tell
-Chris
Hello Chris,
Thank you for thinking about it.
I repeated both tests just to be sure. In both cases, my screenshot includes the dict.cc floating window.
Just in case this is relevant: I use Fluid to create URL apps mostly because @Tom brought to my attention the fact that Fluid allows for the create of apps with floating windows which is extremely useful for web sites used as a technical reference.
Hey @ronald,
I downloaded Fluid, made a couple of apps, and ran some tests.
There definitely are oddities when you have more than one Fluid app running at once.
Iâve filed a bug with Todd Ditchendorf, and weâll see what he does about it.
-Chris
You are fantastic. I am speechless!!