Search the Community
Showing results for tags 'faststone'.
-
Included is a working piece of code to enlarge the handy Move / Copy dialog windows in FastStone Image Viewer, and default to the Favorites tab I am usually using a main program with hotkeys. Therefore the While 1 ... WEnd loop. I only recently made the beginning of a TrayMenu, but I have not come across how to ideally incorporate this with the While 1 ... loop yet... If I only include _exampleTrayMenu() in the loop, that works. If I only include the FastStone test without _exampleTrayMenu(), that works. If I include both in the loop, like in the example, the FastStone code doesn't enlarge the window and the TrayMenu often jumps into Pause / flashing. 1) Where to put _exampleTrayMenu() code so all combines...? 2) How to most efficiently combine multiple window detection cases in the future? 3) ...or can you run more than one AutoIt .exe and would you advise that? For me too, it would be clearer if I had all window detection code and small stuff in a 2nd .exe. #include <MsgBoxConstants.au3> #include <TrayConstants.au3> Opt("WinTitleMatchMode", 2) ; MAIN program loop While 1 If WinActive("[CLASS:TCopyMoveFolder]") Then _FastStoneImgViewer() Else _exampleTrayMenu() Sleep(100) EndIf WEnd ; Detect opening of both Copy & Move windows in Faststone viewer, enlarge them and click 'Favorites' tab Func _FastStoneImgViewer() ; if WinActive(" to Folder") (when Copy or Move window appears) If WinActive( "[CLASS:TCopyMoveFolder]" ) Then Local $hWnd = WinGetHandle("[CLASS:TCopyMoveFolder]") ; click once on tab 'Favorites' ControlClick( $hWnd, "", "[CLASS:TbsSkinPageControl; INSTANCE:1]", "left", 1, 70, 10 ) ; enlarge window WinMove($hWnd, "", Default, 60, 900, 1060) ; move buttons down ; BUTTON Clear History List ControlMove($hWnd, "", "[CLASS:TbsSkinButton; INSTANCE:1]", Default, 990) ; BUTTON ControlMove($hWnd, "", "[CLASS:TbsSkinButton; INSTANCE:2]", Default, 990) ; BUTTON ControlMove($hWnd, "", "[CLASS:TbsSkinButton; INSTANCE:3]", Default, 990) ; BUTTON ControlMove($hWnd, "", "[CLASS:TbsSkinButton; INSTANCE:4]", Default, 990) ; ENLARGE the Inside Window ControlMove($hWnd, "", "[CLASS:TbsSkinPageControl; INSTANCE:1]", Default, Default, 862, 910) ; ensure focus is back to inside window and previously selected item (so 'select by keypress' will work) ControlFocus( $hWnd, "", "[CLASS:TListView; INSTANCE:1]" ) WinWaitNotActive($hWnd) EndIf EndFunc ; traymenu example from manual Func _exampleTrayMenu() Local $iSettings = TrayCreateMenu("Settings") ; Create a tray menu sub menu with two sub items. Local $iDisplay = TrayCreateItem("Display", $iSettings) Local $iPrinter = TrayCreateItem("Printer", $iSettings) TrayCreateItem("") ; Create a separator line. Local $idAbout = TrayCreateItem("About") TrayCreateItem("") ; Create a separator line. Local $idExit = TrayCreateItem("Exit") TraySetState($TRAY_ICONSTATE_SHOW) ; Show the tray menu. While 1 Switch TrayGetMsg() Case $idAbout ; Display a message box about the AutoIt version and installation path of the AutoIt executable. MsgBox($MB_SYSTEMMODAL, "", "AutoIt tray menu example." & @CRLF & @CRLF & _ "Version: " & @AutoItVersion & @CRLF & _ "Install Path: " & StringLeft(@AutoItExe, StringInStr(@AutoItExe, "\", 0, -1) - 1)) ; Find the folder of a full path. Case $iDisplay, $iPrinter MsgBox($MB_SYSTEMMODAL, "", "A sub menu item was selected from the tray menu.") Case $idExit ; Exit the loop. ExitLoop EndSwitch WEnd EndFunc