Jump to content

Converting AutoHotKey to AutoIt3


Recommended Posts

I have an old AutoHotKey script I'm trying to figure out how to convert to AutoIt3. A couple of the functions seem easy enough to copy over, but others, such as the Dll ones, I have no clue how to make work in AutoIt3.

#SingleInstance force

GroupAdd, Excludes, Windows Task-Manager ahk_class #32770 
GroupAdd, Excludes, ahk_class _As12__TaskSwitchXP_TaskSwitchWnd_ 
GroupAdd, Excludes, ahk_class Progman 
GroupAdd, Excludes, ahk_class Shell_TrayWnd 

#IfWinNotActive, ahk_group Excludes 

^F11:: 
Critical 
hWnd := WinActive("A") 
ToggleFullScreen(hWnd) 
Return 

ToggleFullScreen(ByRef hWnd) 
{ 
  ;IniFile := A_ScriptName ".tmp" 
  ;IniRead, Array, %IniFile%, Handles, %hWnd%, Empty 
  If 1 ;(Array="Empty") 
    { 
      hMenu := DllCall("GetMenu", "UInt", hWnd) 
      WinGet, Maximized, MinMax 
      DllCall("SetMenu", "UInt", hWnd, "UInt", 0)  
      WinSet, Style, -0xC00000 
      WinSet, Style, -0x800000
      WinSet, Style, -0x40000
      WinMaximize
      WinMove, , , 0, 0, 1680, 1038
      ; (1 680 - 24) / 1 047 = 1.58166189
      ;IniWrite, %hMenu%`,%Maximized%, %IniFile%, Handles, %hWnd% 
    } 
  ;Else
    ;{ 
      ;StringSplit, Array, Array, `, 
      ;hMenu := Array1 
      ;Maximized := Array2 
      ;DllCall("SetMenu", "UInt", hWnd, "UInt", hMenu) 
      ;WinSet, Style, +0xC00000
      ;WinSet, Style, +0x800000
      ;WinSet, Style, +0x40000
      ;If !(Maximized) 
      ;  { 
      ;    WinRestore 
      ;  }
      ;IniDelete, %IniFile%, Handles, %hWnd% 
    ;} 
}

Just in case you're curious why I'm trying to do this, it's because I have some other code in AutoIt3, and I want to merge them.

Any help you can provide is greatly appreciated :3

Edited by MaXiMiUS
Link to comment
Share on other sites

Seems like the function changes the window style, moves and maximizes it (and vice versa).

Use WinMove() and WinSetState() for the last two operations, for the first operation look up

_WinAPI_GetWindowLong()

_WinAPI_SetWindowLong()

in the UDF help-file, no need to make the dll calls yourself. Maybe the style $WS_POPUP will look good for fullscreen, but chose yourself (or look up the win styles used in WindowsConstants.au3).

Edited by KaFu
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...