hyperalfred icon indicating copy to clipboard operation
hyperalfred copied to clipboard

the costum setting don't work

Open lemoxiao opened this issue 5 years ago • 1 comments

I find code can work in Alfred to open hyper from alfredforum:

on alfred_script(q)
	if (text 1 thru 2 of q) is equal to "cd" then
		do shell script "open -a Hyper " & text 4 thru -1 of q
	else
		do shell script "open -a Hyper ~"
		set appOpen to false
		set nbrOfTry to 0
		delay 0.5
		repeat
			try
				tell application "System Events"
					if exists (window 1 of process "Hyper") then
						set appOpen to true
						exit repeat
					end if
				end tell
			end try
			set nbrOfTry to nbrOfTry + 1
			if nbrOfTry = 20 then exit repeat
			delay 0.5
		end repeat
		if appOpen then tell application "System Events" to keystroke q & return
	end if
end alfred_script

lemoxiao avatar Jul 22 '19 03:07 lemoxiao

can confirm that @lemoxiao solution works good for me also. Using the recommended script in the readme makes hyper type an alfred terminal command (in a workflow) multiple times.

urre avatar Oct 16 '20 17:10 urre