shell-ahk
Version:
`Lodash`/`jQuery` for `AHK`.
107 lines (86 loc) • 3.2 kB
text/coffeescript
# -check
import $noop from './noop'
class WindowShell
###* import('../type/windowShell').Constructor ###
constructor: (exe) ->
###* import('../type/windowShell').WindowShell['exe'] ###
= "ahk_exe #{exe}"
###* import('../type/windowShell').WindowShell['blur'] ###
blur: ->
name = 'ahk_class Shell_TrayWnd'
$noop name
Native 'WinActivate, % name'
return
###* import('../type/windowShell').WindowShell['close'] ###
close: ->
unless then return
Native 'WinClose, % this.exe'
return
###* import('../type/windowShell').WindowShell['focus'] ###
focus: ->
unless then return
Native 'WinActivate, % this.exe'
return
###* import('../type/windowShell').WindowShell['getBounds'] ###
getBounds: ->
[$x, $y, $w, $h] = [0, 0, 0, 0]
unless then return {x: $x, y: $y, width: $w, height: $h}
Native 'WinGetPos, $x, $y, $w, $h, % this.exe'
return {x: $x, y: $y, width: $w, height: $h}
###* import('../type/windowShell').WindowShell['hide'] ###
hide: ->
unless then return
Native 'WinHide, % this.exe'
return
###* import('../type/windowShell').WindowShell['isActive'] ###
isActive: -> WinActive
###* import('../type/windowShell').WindowShell['isExists'] ###
isExists: -> WinExist
###* import('../type/windowShell').WindowShell['isFullScreen'] ###
isFullScreen: ->
unless then return false
{x, y, width, height} =
return x == 0 and y == 0 and width == A_ScreenWidth and height == A_ScreenHeight
###* import('../type/windowShell').WindowShell['kill'] ###
kill: ->
unless then return
Native 'WinKill, % this.exe'
return
###* import('../type/windowShell').WindowShell['maximize'] ###
maximize: ->
unless then return
Native 'WinMaximize, % this.exe'
return
###* import('../type/windowShell').WindowShell['minimize'] ###
minimize: ->
unless then return
Native 'WinMinimize, % this.exe'
return
###* import('../type/windowShell').WindowShell['restore'] ###
restore: ->
unless then return
Native 'WinRestore, % this.exe'
return
###* import('../type/windowShell').WindowShell['setPriority'] ###
setPriority: (level) ->
unless then return
$noop level
Native 'Process, Priority, % this.exe, % level'
return
###* import('../type/windowShell').WindowShell['setStyle'] ###
setStyle: (style) ->
unless then return
$noop style
Native 'WinSet, Style, % style, % this.exe'
return
###* import('../type/windowShell').WindowShell['show'] ###
show: ->
unless then return
Native 'WinShow, % this.exe'
return
###* import('../type/windowShell').WindowShell['wait'] ###
wait: (callback) ->
Native 'WinWait, % this.exe'
if callback then callback()
return
$noop WindowShell