#133 Basic 'AutoIt v3' module support

None
closed
None
5
2014-08-28
2013-01-01
Gilles Remy
No

Hello dear,

Great tool, very impressive, thank you very much.

Just a tiny request: it would be useful to have basic 'AutoIt v3' module support (handling of dedicated 'AutoIt v3' window classes).

With that, it will be very easy to create 'AutoIt v3' modules with quite simple functions.

Best regards

P.S.: I have made this quick test and it works quite well:

I have only modified the 'ModuleRoutines.c' as this:

...
// Find the module with classname
if(((modHWnd = vwFindWindow(s1,NULL,0)) == NULL) && ((modHWnd = vwFindWindow(_T("AutoIt v3"),s1,0)) == NULL) && ((modHWnd = vwFindWindow(_T("AutoIt v3 GUI"),s1,0)) == NULL))
{
Sleep(500) ;
rv2 = WaitForInputIdle(pi.hProcess,10000) ;
if(((modHWnd = vwFindWindow(s1,NULL,1)) == NULL) && ((modHWnd = vwFindWindow(_T("AutoIt v3"),s1,1)) == NULL) && ((modHWnd = vwFindWindow(_T("AutoIt v3 GUI"),s1,1)) == NULL))
{
_stprintf(buff,_T("Failed to load module '%s' - maybe wrong class or file name? (Err %d, %d, %d)"),moduleList[moduleIdx].description,rv1,rv2,(int) GetLastError());
MessageBox(hWnd,buff,vwVIRTUAWIN_NAME _T(" Error"),MB_ICONWARNING);
}
}
...

With this code, you can then create for example the simple following 'AutoIt v3' script:

Opt("MustDeclareVars", 1)
Opt("TrayIconDebug", 0)
Opt("TrayMenuMode", 1)
Opt("WinTitleMatchMode", 3)

#Include <WindowsConstants.au3>

Global $guiWndHdl, $scriptShortName, $trayTipTimeout, $trayTipTimestamp, $MOD_CHANGEDESK, $MOD_QUIT

Main()

Func Initialize()
If (WinExists(@ScriptName)) Then Exit

$scriptShortName = StringTrimRight(@ScriptName, 4)

AutoItWinSetTitle($scriptShortName)

TraySetToolTip($scriptShortName)

$MOD_CHANGEDESK = $WM_USER + 30
$MOD_QUIT = $WM_USER + 36
EndFunc

Func Main()
Initialize()

HookGuiWndMsg()

While (True)
If (($trayTipTimeout > 0) And (TimerDiff($trayTipTimestamp) > $trayTipTimeout)) Then ShowTrayTip("", 0)

Sleep(100)
WEnd
EndFunc

Func GuiWndProc_MOD_CHANGEDESK($hWnd, $Msg, $wParam, $lParam)
ShowTrayTip(("Desktop " & int($lParam)), 1)
EndFunc

Func GuiWndProc_MOD_QUIT($hWnd, $Msg, $wParam, $lParam)
GUIDelete($guiWndHdl)

Exit
EndFunc

Func HookGuiWndMsg()
$guiWndHdl = GUICreate(@ScriptName)

If ($guiWndHdl = 0) Then Exit

GUIRegisterMsg($MOD_CHANGEDESK, "GuiWndProc_MOD_CHANGEDESK")
GUIRegisterMsg($MOD_QUIT, "GuiWndProc_MOD_QUIT")
EndFunc

Func ShowTrayTip($title, $timeout)
TraySetState(2)

TraySetState(1)

If ($title = "") Then
TrayTip($title, $title, $timeout)
Else
TrayTip($title, $scriptShortName, $timeout)
EndIf

$trayTipTimeout = $timeout * 1000

$trayTipTimestamp = TimerInit()
EndFunc

Discussion

  • Gilles Remy
    Gilles Remy
    2013-01-01

    Sample

     
    Attachments
  • I'm not sure what the AutoIt script does, but this seems to me to be the wrong way round - your AutoIt script should be looking for the main VirtuaWin window rather than VirtuaWin looking for AutoIt (which we would not add to the core). For example, in the following AutoHotkey script gets VW to change to the next desktop when WIN+N is pressed:

    N::

    IfWinExist, VirtuaWin
    PostMessage,1034,1026,0,,
    Else
    MsgBox Failed to find VituaWin window

    This is so simple I can't believe AutoIt can't do the same so why complicate everything by creating another module etc??

    Steve

     
    • assigned_to: Steven Phillips
    • Group: --> Next Release (example)
     
  • No response - closing

     
    • status: open --> closed