 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Mr Speaker Guest
|
Posted: Sat Nov 21, 2009 4:54 am Post subject: Problems with hotkeys in script |
|
|
Hi,
I'm fairly new to AutoHotkey and need some assistance with this script.
| Code: | HotKey, LWin & RCtrl, ResizeOn
return
HotKey, LWin & LCtrl, ResizeOff
return
ResizeOn:
{
WinWait, ahk_class GHOST_WindowClass
IfWinExist
{
WinMove, , , 0, 0, 2048, 768 ; move the window to 0,0 and reize it to 2048x768
WinSet, Style, -0xC00000 ; remove the titlebar and border(s)
}
}
return
ResizeOff:
{
WinWait, ahk_class GHOST_WindowClass
IfWinExist
{
WinMove, , , 0, 0, 1024, 768 ; move the window to 0,0 and reize it to 1024x768
WinSet, Style, +0xC00000 ; Adds the titlebar and border(s)
}
}
return
#NoTrayIcon
|
The script is supposed to make a specified application fullscreen for a dual monitor set up and remove the windows bar on hitting one key combination then return to normal size and replace the bar when the second key combination is used. When I press the key combination go make it full screen it works fine however when I hit the combination to return to a regular screen size it doesn't have any affect.
Any suggestions are much appreciated.
Regards,
Mr Speaker |
|
| Back to top |
|
 |
entropic
Joined: 21 Dec 2008 Posts: 161
|
Posted: Sat Nov 21, 2009 4:59 am Post subject: |
|
|
Give this a try. I made some changes to the code, changed the dynamic hotkeys to regular ones (the ones using the Hotkey command), removed braces in the ResizeOn and ResizeOff labels (they're only necessary for functions), and replaced the IfWinExist commands with checking ErrorLevel, it will be 0 if the window comes into existence, 1 if it does not, and I added a 5 second timeout to it so it doesn't wait indefinitely.
| Code: |
LWin & RCtrl::
GoSub, ResizeOn
return
LWin & LCtrl::
GoSub, ResizeOff
return
ResizeOn:
WinWait, ahk_class GHOST_WindowClass,, 5
If (ErrorLevel = 0)
{
WinMove, , , 0, 0, 2048, 768 ; move the window to 0,0 and reize it to 2048x768
WinSet, Style, -0xC00000 ; remove the titlebar and border(s)
}
return
ResizeOff:
WinWait, ahk_class GHOST_WindowClass,, 5
If (ErrorLevel = 0)
{
WinMove, , , 0, 0, 1024, 768 ; move the window to 0,0 and reize it to 1024x768
WinSet, Style, +0xC00000 ; Adds the titlebar and border(s)
}
return
#NoTrayIcon
|
|
|
| Back to top |
|
 |
Mr Speaker Guest
|
Posted: Sat Nov 21, 2009 5:24 am Post subject: |
|
|
Hi entropic,
Thanks it works perfectly, just what I needed.
Thanks again,
Mr Speaker |
|
| Back to top |
|
 |
entropic
Joined: 21 Dec 2008 Posts: 161
|
Posted: Sat Nov 21, 2009 5:26 am Post subject: |
|
|
Glad I could help  |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|