AutoHotkey Community

It is currently May 27th, 2012, 1:32 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: November 21st, 2009, 5:54 am 
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


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 21st, 2009, 5:59 am 
Offline

Joined: December 21st, 2008, 7:29 pm
Posts: 181
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 21st, 2009, 6:24 am 
Hi entropic,

Thanks it works perfectly, just what I needed. :D

Thanks again,
Mr Speaker


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 21st, 2009, 6:26 am 
Offline

Joined: December 21st, 2008, 7:29 pm
Posts: 181
Glad I could help :-)


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], Blackholyman, bobbysoon, iDrug, Ohnitiel, Tipsy3000, Yahoo [Bot] and 18 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group