phcyso Posted June 26, 2015 Share Posted June 26, 2015 (edited) Hi I use fluidApp( http://fluidapp.com/ ) for a whole bunch of websites and like to pin then to the task menu so they are still running but are out of sight. I have been trying to find a way to get Alfred to force them to activate but have been running into trouble with Alfred setting the focus back to the previously running app. The closest i have gotten is a workflow that Opens the app and then had a output script to send a hotkey to the system that brings the window to the front. This causes the app to pop up for a second or two before focus returns to the previous window causing the fluidapp to close. Is there a flag i can set on a workflow to disable to focus setting behaviour? Thank you the sample applescript i'm using: on is_running(appName) tell application "System Events" to (name of processes) contains appName end is_running on activate_app() tell application "System Events" keystroke "m" using {command down, shift down, option down, control down} end tell end activate_app if is_running("APPNAME") then activate_app() return "Running" else tell application "APP" to activate delay (1) activate_app() end if Edited June 26, 2015 by phcyso Link to comment
dfay Posted June 26, 2015 Share Posted June 26, 2015 I'd use bash. The built-in open command has a flag -g which opens an app without bringing it to the foreground. If you want to wrap it in Applescript, it'd look like this: do shell script "open -g /Applications/XXX.app" Link to comment
deanishe Posted June 28, 2015 Share Posted June 28, 2015 @phcyso: Your script works perfectly for me. How are you triggering the script? Link to comment
phcyso Posted June 28, 2015 Author Share Posted June 28, 2015 I'd use bash. The built-in open command has a flag -g which opens an app without bringing it to the foreground. If you want to wrap it in Applescript, it'd look like this: do shell script "open -g /Applications/XXX.app" The app already opens in the background by itself , I am trying to force it to show its window though its keyboard shortcut. @phcyso: Your script works perfectly for me. How are you triggering the script? I have been trying to use the workflow action 'run script' and run 'nsAppleScript' They work in that the window flashes up but as the app has no dock icon and is just a floating window the focus reverts to the previous window. The script works perfectly if i trigger it from the terminal manually. It does not work if i use the 'terminal command' action to run the script. Link to comment
deanishe Posted June 29, 2015 Share Posted June 29, 2015 Sorry, I wasn't clear. It doesn't matter how you run the script. How are you triggering the workflow? Keyword? Hot Key? Link to comment
phcyso Posted June 29, 2015 Author Share Posted June 29, 2015 Sorry, I wasn't clear. It doesn't matter how you run the script. How are you triggering the workflow? Keyword? Hot Key? Ah, sorry I'm triggering it by Keyword. i just tried it by hotkey as well, exactly the same thing, flashes up for a moment then disappears again. Link to comment
deanishe Posted June 29, 2015 Share Posted June 29, 2015 I'm afraid I don't know, then. I figured it may be a hotkey conflict. Like I said, your script works perfectly for me… Link to comment
dfay Posted June 29, 2015 Share Posted June 29, 2015 Have you run it with Alfred's workflow debug mode active? (Click the little bug in the upper right of the workflow editing pane). If the script is producing an error it would jump back to the app that called the script (Alfred). phcyso 1 Link to comment
phcyso Posted June 30, 2015 Author Share Posted June 30, 2015 Well i have no idea what the difference is but i tried it in debug mode and it worked, Then i tried it not in debug mode and it worked. i haven't changed anything in the script or workflow Thank you all for your help, when i was trying before it must have been some program interfering with it. 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