guiAI
Members-
Posts
13 -
Joined
-
Last visited
guiAI's Achievements
Seeker (1/7)
0
Reputation
-
Check toolbar button programmatically
guiAI replied to guiAI's topic in AutoIt General Help and Support
Here's the modified code: #include <GuiToolbar.au3> #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <Constants.au3> ;~ Opt('MustDeclareVars', 1) Opt('GuiOnEventMode', 1) Global $hGUI, $hToolbar Global Enum $idNew = 1000, $idOpen, $idSave, $idHelp Global $iItem ; Create GUI $hGUI = GUICreate("Toolbar", 400, 300) GUISetOnEvent($GUI_EVENT_CLOSE, "_Close") $hToolbar = _GUICtrlToolbar_Create($hGUI) $Click = GUICtrlCreateButton("Click", 100, 150, 75) GUISetState() ; Add standard system bitmaps _GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR) ; Add buttons _GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW) _GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN) _GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE) _GUICtrlToolbar_AddButtonSep($hToolbar) _GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP, 0, $BTNS_CHECK) GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY") ; Loop until user exits Global $iTimer = TimerInit() While 1 Sleep(10) ; Click a random button every 5sec If TimerDiff($iTimer) >= 5000 Then _GUICtrlToolbar_ClickButton($hToolbar, Random(1000, 1003, 1), "left", True) $iTimer = TimerInit() EndIf WEnd ; WM_NOTIFY event handler Func _WM_NOTIFY($hWndGUI, $MsgID, $wParam, $lParam) #forceref $hWndGUI, $MsgID, $wParam Local $tNMHDR, $event, $hwndFrom, $code, $i_idNew, $dwFlags, $lResult, $idFrom, $i_idOld Local $tNMTOOLBAR, $tNMTBHOTITEM $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hwndFrom = DllStructGetData($tNMHDR, "hWndFrom") $idFrom = DllStructGetData($tNMHDR, "IDFrom") $code = DllStructGetData($tNMHDR, "Code") Switch $hwndFrom Case $hToolbar Switch $code Case $NM_LDOWN ConsoleWrite("_WM_NOTIFY(): code = $NM_LDOWN; Clicked Item: " & $iItem & " at index: " & _GUICtrlToolbar_CommandToIndex($hToolbar, $iItem) & @LF) Case $TBN_HOTITEMCHANGE $tNMTBHOTITEM = DllStructCreate($tagNMTBHOTITEM, $lParam) $i_idOld = DllStructGetData($tNMTBHOTITEM, "idOld") $i_idNew = DllStructGetData($tNMTBHOTITEM, "idNew") $iItem = $i_idNew ; Save new hotitem ID to global $dwFlags = DllStructGetData($tNMTBHOTITEM, "dwFlags") If BitAND($dwFlags, $HICF_LEAVING) = $HICF_LEAVING Then ConsoleWrite("_WM_NOTIFY(): $HICF_LEAVING = " & $i_idOld & @LF) Else Switch $i_idNew Case $idNew ConsoleWrite("_WM_NOTIFY(): $TBN_HOTITEMCHANGE; $idNew = " & $idNew & @LF) Case $idOpen ConsoleWrite("_WM_NOTIFY(): $TBN_HOTITEMCHANGE; $idOpen = " & $idOpen & @LF) Case $idSave ConsoleWrite("_WM_NOTIFY(): $TBN_HOTITEMCHANGE; $idSave = " & $idSave & @LF) Case $idHelp ConsoleWrite("_WM_NOTIFY(): $TBN_HOTITEMCHANGE; $idHelp = " & $idHelp & @LF) EndSwitch EndIf EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>_WM_NOTIFY Func _Close() Exit EndFunc ;==>_CloseNow the question is how to change the state of dual state control $idHelp clicking the $Click button. -
Check toolbar button programmatically
guiAI replied to guiAI's topic in AutoIt General Help and Support
Hi PsaltyDS, I'm trying to produce (programmaticaly) a click on a dual state button ($BTNS_CHECK), get the relative message, then start an appropriate function in response. -
_GUICtrlToolbar_CheckButton() does the job, but: WM_COMMAND($hWnd, $Msg, $wParam, $lParam)receives no signal.Furthermore, using: _SendMessage($hMain, $WM_COMMAND, $iCmd)WM_COMMAND receives the signal, but the button remains unchecked.Is there any other chance besides combining the two commands? Thanks
-
#include <Excel.au3> $oExcel = _ExcelBookNew(0) _ExcelWriteCell($oExcel, "Some text", 3, 2) _ExcelBookSaveAs($oExcel, @DesktopDir & "\Test", "xls", 0, 1) _ExcelBookClose($oExcel) $oExcel = "" MsgBox(0, "Before exiting...", "Please, check process excel.exe in Task Manager") SOLVED. Thanks Juvigy.
-
Unfortunately your suggestion does not work for me (Excel 2007). Trying: #include <Excel.au3> $oExcel = _ExcelBookNew(0) _ExcelWriteCell($oExcel, "Some text", 3, 2) _ExcelBookSaveAs($oExcel, @DesktopDir & "\Test", "xls", 0, 1) _ExcelBookClose($oExcel) $oExcel.Quit MsgBox(0, "Before exiting...", "Please, check process excel.exe in Task Manager") process EXCEL.EXE is still running when MsgBox appears.
-
This does not work for me: process EXCEL.EXE still running when MsgBox appears.
-
A little example: #include <Excel.au3> $oExcel = _ExcelBookNew(0) _ExcelWriteCell($oExcel, "Some text", 3, 2) _ExcelBookSaveAs($oExcel, @DesktopDir & "\Test.xls", "xls", 0, 1) _ExcelBookClose($oExcel) MsgBox(0, "Before exiting...", "Please, check process excel.exe in Task Manager") Until the Exit, process is hanging.
-
Can't find any effective solution in the forum, except: ProcessClose("excel.exe") Any idea? Thanks.
-
Trojan-Downloader.Win32.Agent.chqc
guiAI replied to guiAI's topic in AutoIt General Help and Support
It's hourly updated. -
Today Kaspersky has quarantined AutoIt3.exe on my pc. Trojan-Downloader.Win32.Agent.chqc (High risk) is the reason. Tried to reinstall, but the problem persists with the new (clean) file. Any suggestion?
-
Thanks!
-
Can anyone explain why _GUICtrlListView_GetItemText() returns nothing? #include <GUIConstantsEx.au3> #include <ListViewConstants.au3> #include <GuiListView.au3> #include <WindowsConstants.au3> GUICreate("listview items", 225, 200) $listview = GUICtrlCreateListView("col1|col2|col3", 10, 10, 200, 150) GUICtrlSendMsg(-1, 0x101E, 0, 50) GUICtrlSendMsg(-1, 0x101E, 1, 50) GUICtrlSendMsg(-1, 0x101E, 2, 50) $listview_0 = GUICtrlCreateListViewItem("item1|col12|col13", $listview) $listview_1 = GUICtrlCreateListViewItem("item2|col22|col23", $listview) $listview_2 = GUICtrlCreateListViewItem("item3|col32|col33", $listview) $listviewcontext = GUICtrlCreateContextMenu($listview) $MenuItem1 = GUICtrlCreateMenuItem("ContextItem1", $listviewcontext) GUISetState() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $MenuItem1 $ind = _GUICtrlListView_GetSelectedIndices($listview) $item = _GUICtrlListView_GetItemText($listview, $ind) MsgBox(0, "Listview item", "Index: " & $ind & @CRLF & "Item: " & $item) EndSwitch WEnd