Floating hotkey window can't be found by applescript
I have an Alfred workflow that runs an applescript to open the current path of Finder in iTerm in a new tab, but when the floating window is turned on, it creates a new hotkey window instead of a tab in the hotkey window.
- iTerm2 version: Build 3.3.4
- OS version: 10.14.6 (18G95)
- Attach ~/Library/Preferences/com.googlecode.iterm2.plist here (drag-drop from finder into this window) com.googlecode.iterm2.plist
Detailed steps to reproduce the problem:
- Turn on floating window for hotkey window
- Run the applescript below (taken from terminalfinder, https://github.com/LeEnno/alfred-terminalfinder)
What happened: A new hotkey window was created instead of a new tab.
What should have happened: A new tab in the hotkey window should have been created.
tell application "Finder"
set pathList to (quoted form of POSIX path of (folder of the front window as alias))
set command to "clear; cd " & pathList
end tell
tell application "System Events"
-- some versions might identify as "iTerm2" instead of "iTerm"
set isRunning to (exists (processes where name is "iTerm")) or (exists (processes where name is "iTerm2"))
end tell
tell application "iTerm"
activate
set hasNoWindows to ((count of windows) is 0)
if isRunning and hasNoWindows then
create window with default profile
end if
select first window
tell the first window
set isHotkeyWindow to ((is hotkey window) is true)
if isRunning and hasNoWindows is false and isHotkeyWindow is false then
create tab with default profile
end if
if isRunning and hasNoWindows is false and isHotkeyWindow then
create tab with profile (hotkey window profile)
end if
tell current session to write text command
end tell
end tell
Edited by Ahmet Karalar