FireFox Posted September 26, 2009 Share Posted September 26, 2009 (edited) @Mat Can you make a screenshot, then I will be able to know what it excatly does... I'm using autoit v3.3.0.0, and it does not work with both examples Cheers, FireFox. Edited September 26, 2009 by FireFox Link to comment Share on other sites More sharing options...
wraithdu Posted September 26, 2009 Share Posted September 26, 2009 (edited) Again, nice updates. I think I might handle the new OnShow option a little differently, so that it supports both global and menu specific OnShow functions. change the __PopUpMenuStart() function: Func __PopupMenuStart() Local $x = __PopUpMenuGetIndexFromHotkey(@HotKeyPressed) If $x = -1 Then Return SetError(1, 0, 0) Local $temp, $sTemp ; global OnShow function If $POPUP_MENU_ONSHOW[0] <> "" Then If Not StringInStr($POPUP_MENU_ONSHOW[0], $POPUP_MENU_DATASEPERATOR) Then Call($POPUP_MENU_ONSHOW[0]) Else $temp = StringSplit($POPUP_MENU_ONSHOW[0], $POPUP_MENU_DATASEPERATOR) $sTemp = $temp[1] $temp = __ArrayDelete($temp, 1) $temp[0] = "CallArgArray" Call($sTemp, $temp) EndIf EndIf ; menu specific OnShow function If $POPUP_MENU_ONSHOW[$x] <> "" Then If Not StringInStr($POPUP_MENU_ONSHOW[$x], $POPUP_MENU_DATASEPERATOR) Then Call($POPUP_MENU_ONSHOW[0]) Else $temp = StringSplit($POPUP_MENU_ONSHOW[$x], $POPUP_MENU_DATASEPERATOR) $sTemp = $temp[1] $temp = __ArrayDelete($temp, 1) $temp[0] = "CallArgArray" Call($sTemp, $temp) EndIf EndIf DllCall("user32.dll", "int", "SetForegroundWindow", "hwnd", $POPUP_MENU_INFO[0][1]) DllCall("user32.dll", "ptr", "SendMessage", _ "hwnd", ControlGetHandle($POPUP_MENU_INFO[0][1], _ "", $POPUP_MENU_INFO[$x][1]), _ "int", 0x007B, _ "int", $POPUP_MENU_INFO[$x][1], _ "int", 0) EndFunc ;==>__PopupMenuStart Gives the user more flexibility. Edited September 26, 2009 by wraithdu Link to comment Share on other sites More sharing options...
wraithdu Posted September 26, 2009 Share Posted September 26, 2009 (edited) @FireFox Currently both example work for me as posted in Win7, AutoIt 3.3.1.1. Edited September 26, 2009 by wraithdu Link to comment Share on other sites More sharing options...
Mat Posted September 26, 2009 Author Share Posted September 26, 2009 (edited) If You run example 2 and click Alt-4, what happens? It should bring up a context menu at the mouse position. If you click something it will bring up a msgbox. If the menu is not appearing then I don't have a clue how to solve it, as its probably a problem with the message i'm sending to trigger the menu... But thats got to be right... doesn't it? Mat edit: AH!! I was going to run both global and menu onshows, but it seems the keyboard is twisting my input and putting an ElseIf in there! It shall be done! Thanks Wraithdu! Edited September 26, 2009 by Mat AutoIt Project Listing Link to comment Share on other sites More sharing options...
wraithdu Posted September 26, 2009 Share Posted September 26, 2009 Cool. And yeah, I'd start versioning this UDF at this point. Lots of updates and added functionality, it'll make it easier to track. Link to comment Share on other sites More sharing options...
Mat Posted September 26, 2009 Author Share Posted September 26, 2009 I was thinking that before I put on the second update, but decided against it for some obscure reason (probably too much work to edit one line every time I do an update ) I have almost finished the second example, which is actually a very useful script for setting windows on top status through a small menu. It uses the OnShow option to update the menu, and is a good example of using OnEvent mode with a parameter. Mat AutoIt Project Listing Link to comment Share on other sites More sharing options...
FireFox Posted September 26, 2009 Share Posted September 26, 2009 @Mat It does not work with autoit v3.3.1.1 too I have also tried again both examples... Cheers, FireFox. Link to comment Share on other sites More sharing options...
Mat Posted September 26, 2009 Author Share Posted September 26, 2009 Grrr... Try running this script, it might show where the problem is... #include "PopUpMenu.au3" _PopUpMenuSetOption ("OnEventMode", 1) $hMenu2 = _PopUpMenuCreate ("!5") $hExit2 = _PopUpMenuCreateMenuItem ("Exit", $hMenu2) _PopUpMenuItemSetOnEvent (-1, "MyFunc", "You Sent|Exit. Goodbye!") _Custom_Starter_Test () While 1 Sleep (5000) WEnd Func MyFunc ($sArg, $sParam) MsgBox (0, $sArg, $sParam) If $sParam = "Exit. Goodbye!" Then Exit EndFunc ; ==> MyFunc Func _Custom_starter_Test () Local $x = 1 DllCall("user32.dll", "int", "SetForegroundWindow", "hwnd", $POPUP_MENU_INFO[0][1]) DllCall("user32.dll", "ptr", "SendMessage", _ "hwnd", ControlGetHandle($POPUP_MENU_INFO[0][1], _ "", $POPUP_MENU_INFO[$x][1]), _ "int", 0x007B, _ "int", $POPUP_MENU_INFO[$x][1], _ "int", 0) EndFunc ; ==> _Custom_Starter_Test You should not need to do anything, the menu SHOULD popup straight away... All You'll see is a context menu saying "Exit". Mat AutoIt Project Listing Link to comment Share on other sites More sharing options...
MrCreatoR Posted September 26, 2009 Share Posted September 26, 2009 Few more sugesstions/remarks: 1) When you keep holding the hotkeys to call the menu, firstly it's not dissapeared on click in other place (only after selecting an item), and the menu is keep showing that much times as user holded the hotkey. The fix is simple: Add this to __PopupMenuStart() (after «If $x = -1 Then» line): HotKeySet(@HotKeyPressed) and this to the end of that function: HotKeySet(@HotKeyPressed, "__PopupMenuStart") 2) Can you please pack all the files together in one archive (including the example)? this will make it easy for other users to download and use this UDF. Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
FireFox Posted September 26, 2009 Share Posted September 26, 2009 Grrr... Try running this script, it might show where the problem is... #include "PopUpMenu.au3" _PopUpMenuSetOption ("OnEventMode", 1) $hMenu2 = _PopUpMenuCreate ("!5") $hExit2 = _PopUpMenuCreateMenuItem ("Exit", $hMenu2) _PopUpMenuItemSetOnEvent (-1, "MyFunc", "You Sent|Exit. Goodbye!") _Custom_Starter_Test () While 1 Sleep (5000) WEnd Func MyFunc ($sArg, $sParam) MsgBox (0, $sArg, $sParam) If $sParam = "Exit. Goodbye!" Then Exit EndFunc ; ==> MyFunc Func _Custom_starter_Test () Local $x = 1 DllCall("user32.dll", "int", "SetForegroundWindow", "hwnd", $POPUP_MENU_INFO[0][1]) DllCall("user32.dll", "ptr", "SendMessage", _ "hwnd", ControlGetHandle($POPUP_MENU_INFO[0][1], _ "", $POPUP_MENU_INFO[$x][1]), _ "int", 0x007B, _ "int", $POPUP_MENU_INFO[$x][1], _ "int", 0) EndFunc ; ==> _Custom_Starter_Test You should not need to do anything, the menu SHOULD popup straight away... All You'll see is a context menu saying "Exit". Mat Okay, it works And then ? Cheers, FireFox. Link to comment Share on other sites More sharing options...
Mat Posted September 26, 2009 Author Share Posted September 26, 2009 Well... That proves that it works!! Now you are confusing me as I can see absolutely nothing that can possibly be wrong!! Can you please retry the examples? Make sure you press the right hotkey etc... Beyond that, I have absolutely no idea whats wrong. MrCreator, I had not noticed that, and I hadn't tried! But I'll add that in to the next update! I will have a look at packing them up and how best to do that, unfortunately my current file hosting service is experiancing technical difficulties, and I am running out of memory space on the forums!! Mat AutoIt Project Listing Link to comment Share on other sites More sharing options...
Mat Posted September 26, 2009 Author Share Posted September 26, 2009 All files are now on google code, I added MrCreators fix, and released the example showing onShow functionality. It is a simple menu that sets a windows OnTop state. It updates the window list every time the menu is opened. See first post for a link to the google code project Mat AutoIt Project Listing Link to comment Share on other sites More sharing options...
MrCreatoR Posted September 26, 2009 Share Posted September 26, 2009 unfortunately my current file hosting service is experiancing technical difficulties, and I am running out of memory space on the forums!!There is free service for autoit community: http://trashbin.nfshost.comOr use the downloads.P.SAbout the space on the forum - don't post big files here, and always pack them. Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
Mat Posted September 26, 2009 Author Share Posted September 26, 2009 The problem is... Most of that space is actually images, screenshots etc. not really big files, but quite a few of them! Google code is a good piece of kit, and I kinda like it. I have never heard of that "trashbin" hosting, but that looks pretty cool! When I'm not making 3 updates in a day I will put it in the downloads section. Mat AutoIt Project Listing Link to comment Share on other sites More sharing options...
MrCreatoR Posted September 26, 2009 Share Posted September 26, 2009 Most of that space is actually imagesI put the images to ipicture.ru (it's russian service), but you can use http://www.tinypic.com/, or http://funkyimg.com/, or http://www.imageshack.us/ Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
Mat Posted September 27, 2009 Author Share Posted September 27, 2009 wow, thanks MrCreator, thats an impressive list! I will have to llok at those some time! Is example 2 working for everyone now? Mat AutoIt Project Listing 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