Icarii Posted March 24, 2009 Share Posted March 24, 2009 A while back I wrote a script using Autoit Lib to right a icon in the systray (Netscreen Remote) and start a connection (it actually does a lot more but that is the part I am having problems with now). I have upgraded to the new v3.3.0.0 and now the code does not work. Here is the original code: CODE $hWnd = ControlGetHandle("classname=Shell_TrayWnd", "", "Notification Area") $iCount = _Toolbar_ButtonCount($hWnd) ;check to see what state NSR is in, dea=activate act=deactivate and activate For $iI = 1 to $iCount $iCommand = _Toolbar_IndexToCommand($hWnd, $iI) $sText = _Toolbar_GetButtonText ($hWnd, $iCommand) IF _Toolbar_GetButtonText($hWnd, $iCommand) = "NetScreen-Remote - Policy is deactivated!" Then _Toolbar_ClickButton($hWnd, $iCommand, "right") _Menu_ClickPopupAccel("t") EndIf $p = 30 ProgressSet($p, $p & " percent") IF _Toolbar_GetButtonText($hWnd, $iCommand) = "NetScreen-Remote" Then _Toolbar_ClickButton($hWnd, $iCommand, "right") _Menu_ClickPopupAccel("p") Sleep(500) _Toolbar_ClickButton($hWnd, $iCommand, "right") Sleep(500) _Menu_ClickPopupAccel("t") EndIf Next Here is the code I tried: CODE $hWnd = ControlGetHandle("classname=Shell_TrayWnd", "", "Notification Area") $iCount = _GUICtrlToolbar_ButtonCount($hWnd) ;check to see what state NSR is in, dea=activate act=deactivate and activate For $iI = 1 to $iCount $iCommand = _GUICtrlToolbar_IndexToCommand($hWnd, $iI) $sText = _GUICtrlToolbar_GetButtonText ($hWnd, $iCommand) IF _GUICtrlToolbar_GetButtonText($hWnd, $iCommand) = "NetScreen-Remote - Policy is deactivated!" Then _GUICtrlToolbar_ClickButton($hWnd, $iCommand, "right") Sleep(500) _GUICtrlToolbar_ClickAccel($hWnd,"t",True) Sleep(500) EndIf $p = 30 ProgressSet($p, $p & " percent") IF _GUICtrlToolbar_GetButtonText($hWnd, $iCommand) = "NetScreen-Remote" Then _GUICtrlToolbar_ClickButton($hWnd, $iCommand, "right") Sleep(500) _GUICtrlToolbar_ClickAccel($hWnd,"p") Sleep(500) _GUICtrlToolbar_ClickButton($hWnd, $iCommand, "right") Sleep(500) _GUICtrlToolbar_ClickAccel($hWnd,"t","left",True) sleep(500) $p = 35 ProgressSet($p, $p & " percent") EndIf Next Everything works with it excepts send the "t","p","c" clicks. It seams _GUICtrlToolbar_ClickAccell() does not work the same as _Menu_ClickPopupAccel() did. Or am I missing something. Any help would be great. Thanks. Link to comment Share on other sites More sharing options...
martin Posted March 24, 2009 Share Posted March 24, 2009 A while back I wrote a script using Autoit Lib to right a icon in the systray (Netscreen Remote) and start a connection (it actually does a lot more but that is the part I am having problems with now). I have upgraded to the new v3.3.0.0 and now the code does not work. Here is the original code:CODE$hWnd = ControlGetHandle("classname=Shell_TrayWnd", "", "Notification Area")$iCount = _Toolbar_ButtonCount($hWnd);check to see what state NSR is in, dea=activate act=deactivate and activateFor $iI = 1 to $iCount $iCommand = _Toolbar_IndexToCommand($hWnd, $iI) $sText = _Toolbar_GetButtonText ($hWnd, $iCommand) IF _Toolbar_GetButtonText($hWnd, $iCommand) = "NetScreen-Remote - Policy is deactivated!" Then _Toolbar_ClickButton($hWnd, $iCommand, "right") _Menu_ClickPopupAccel("t") EndIf $p = 30 ProgressSet($p, $p & " percent") IF _Toolbar_GetButtonText($hWnd, $iCommand) = "NetScreen-Remote" Then _Toolbar_ClickButton($hWnd, $iCommand, "right") _Menu_ClickPopupAccel("p") Sleep(500) _Toolbar_ClickButton($hWnd, $iCommand, "right") Sleep(500) _Menu_ClickPopupAccel("t") EndIfNextHere is the code I tried:CODE$hWnd = ControlGetHandle("classname=Shell_TrayWnd", "", "Notification Area")$iCount = _GUICtrlToolbar_ButtonCount($hWnd);check to see what state NSR is in, dea=activate act=deactivate and activateFor $iI = 1 to $iCount $iCommand = _GUICtrlToolbar_IndexToCommand($hWnd, $iI) $sText = _GUICtrlToolbar_GetButtonText ($hWnd, $iCommand) IF _GUICtrlToolbar_GetButtonText($hWnd, $iCommand) = "NetScreen-Remote - Policy is deactivated!" Then _GUICtrlToolbar_ClickButton($hWnd, $iCommand, "right") Sleep(500) _GUICtrlToolbar_ClickAccel($hWnd,"t",True) Sleep(500) EndIf $p = 30 ProgressSet($p, $p & " percent") IF _GUICtrlToolbar_GetButtonText($hWnd, $iCommand) = "NetScreen-Remote" Then _GUICtrlToolbar_ClickButton($hWnd, $iCommand, "right") Sleep(500) _GUICtrlToolbar_ClickAccel($hWnd,"p") Sleep(500) _GUICtrlToolbar_ClickButton($hWnd, $iCommand, "right") Sleep(500) _GUICtrlToolbar_ClickAccel($hWnd,"t","left",True) sleep(500) $p = 35 ProgressSet($p, $p & " percent") EndIfNextEverything works with it excepts send the "t","p","c" clicks. It seams _GUICtrlToolbar_ClickAccell() does not work the same as _Menu_ClickPopupAccel() did. Or am I missing something. Any help would be great. Thanks.Are you detecting the click on the button in a function registered to $WM_NOTIFY? Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Icarii Posted March 25, 2009 Author Share Posted March 25, 2009 Are you detecting the click on the button in a function registered to $WM_NOTIFY?I don't know? What is $WM_NOTIFY? I will look in the help menu.The script is send a click, just not on the right button. For some reason the new command does not like the popup menu.Any suggestion would be helpful. Link to comment Share on other sites More sharing options...
Icarii Posted March 25, 2009 Author Share Posted March 25, 2009 I still have an older version of Autoit and AutoitLib on another system. I was looking throught it's help file and it has _Menu_ClickAccel and _Menu_ClickPopupAccel. Based on the help file it looks like _Menu_ClickAccel was renamed to _GUICtrlToolbar_ClickAccell(). But I can not find where _Menu_ClickPopupAccel was renamed. Was that command dropped? Thanks for any help. Link to comment Share on other sites More sharing options...
martin Posted March 25, 2009 Share Posted March 25, 2009 I still have an older version of Autoit and AutoitLib on another system. I was looking throught it's help file and it has _Menu_ClickAccel and _Menu_ClickPopupAccel. Based on the help file it looks like _Menu_ClickAccel was renamed to _GUICtrlToolbar_ClickAccell(). But I can not find where _Menu_ClickPopupAccel was renamed. Was that command dropped?Thanks for any help.I regret I don't know about _Menu_ClickPopupAccel.To use _GUICtrlToolbar_ClickAccell() have a look in the current help for that function. In the example you will see how to register and use the $WM_NOTIFY message. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now