Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible raise single window to the front? #33

Open
calfzhou opened this issue Apr 21, 2020 · 5 comments
Open

Is it possible raise single window to the front? #33

calfzhou opened this issue Apr 21, 2020 · 5 comments

Comments

@calfzhou
Copy link

Sometimes there are several windows for one application, now it will bring every window to the front in a big stack, it would be better to be able to bring the single selected window.

Thanks for the awesome workflow!

@calfzhou
Copy link
Author

calfzhou commented Apr 21, 2020

this might work:

on alfred_script(q)

set argv to extract_argv(q, "|||||")

set proc to item 1 of argv
set tabIndex to item 2 of argv as integer
set windowName to item 3 of argv

try
	tell application "System Events"
		with timeout of 0.1 seconds
			tell process proc to perform action "AXRaise" of window windowName
			do shell script "open -a '" & (name of my application proc) & "'"
		end timeout
	end tell
end try

end alfred_script

on extract_argv(source_string, new_delimiter)
	set backup to AppleScript's text item delimiters
	set AppleScript's text item delimiters to new_delimiter
	set argv to every text item of source_string
	set AppleScript's text item delimiters to backup
	return argv
end extract_argv

@kerryj89
Copy link

@calfzhou Works for me, many thanks!

@mohok
Copy link

mohok commented Dec 25, 2020

@kerryj89 Is it still working on Big Sur?

@kerryj89
Copy link

@kerryj89 Is it still working on Big Sur?

I am not on Big Sur, sorry.

@mohok
Copy link

mohok commented Jan 4, 2021

@kerryj89 It works well on Big Sur. Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants