remin Posted October 15, 2013 Share Posted October 15, 2013 (edited) This is my script to move a window to the left or right side of my screen: expandcollapse popupHotKeySet("^3", "movemenu") While 1 Sleep(10000) WEnd Func movemenu() $Form1 = '' #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Local $ActiefVenster = WinGetTitle("[ACTIVE]", "") $Form1 = GUICreate("Form1", 125, 100, 265, 142) $Left = GUICtrlCreateButton("Left", 16, 8, 89, 25) $Right = GUICtrlCreateButton("Right", 16, 32, 89, 25) $LeftBig = GUICtrlCreateButton("LeftBig", 16, 64, 89, 25) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE GuiDelete($Form1) Return Case $Left WinMove($ActiefVenster, "",0,0,@DesktopWidth/2,@DesktopHeight-41) Case $Right WinMove($ActiefVenster, "",@DesktopWidth/2,0,@DesktopWidth/2,@DesktopHeight-41) Case $LeftBig WinMove($ActiefVenster, "",0,0,@DesktopWidth*0.65,@DesktopHeight-41) EndSwitch WEnd EndFunc However.. When I use the shortcut, close the GUI and reuse the shortcut for another window movement it gives an error: File "C:\Program Files (x86)\AutoIt3\Include\ButtonConstants.au3"): Global Const $BS_GROUPBOX = 0x0007 Global Const ^ ERROR Error: Can not redeclare a constant ------------------------------------ How can I resolve this error? Whats wrong in my script? Edited October 15, 2013 by remin Link to comment Share on other sites More sharing options...
water Posted October 15, 2013 Share Posted October 15, 2013 Move the #include directives to the top of your script. They shouldn't be placed in a function! My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
remin Posted October 15, 2013 Author Share Posted October 15, 2013 Oh.. thank you very much. Hope you don't mind if I ask you a few more questions... (or if you prefer that I open new topics please tell it to me) I'm converting my scripts from autohotkey to autoit. I noted a few problems. 1) Does autotit has this menu feature ? http://www.autohotkey.com/docs/commands/Menu.htm 2) WinGetClientSize gives the size of the client area. I need the size of the entire active window. Is there no keyword in autoit to do this? Link to comment Share on other sites More sharing options...
Solution water Posted October 15, 2013 Solution Share Posted October 15, 2013 (edited) Autoit offers a few commands to work with menus. The function to use depends on what you want to do (tray menu etc.) WinGetPos returns the position, with and height of a window Edited October 15, 2013 by water My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
remin Posted October 15, 2013 Author Share Posted October 15, 2013 Thank you very much Link to comment Share on other sites More sharing options...
water Posted October 15, 2013 Share Posted October 15, 2013 My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
remin Posted October 15, 2013 Author Share Posted October 15, 2013 Autoit offers a few commands to work with menus. The function to use depends on what you want to do (tray menu etc.) A little update: Please see attachment what I wanted to create in autoit (not a right click menu but a menu like this one which pop-up (where the mouse is) after using a hotkey) Link to comment Share on other sites More sharing options...
water Posted October 15, 2013 Share Posted October 15, 2013 Is this a menu you want to "attach" to an application? If yes, which application? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
remin Posted October 15, 2013 Author Share Posted October 15, 2013 Is this a menu you want to "attach" to an application? If yes, which application? No, it is not attched to an application. I created this menu in autohotkey. Its activated by an hotkey. The hotkey pops-up this menu. I click on it to change case of text. After clicking on an item, the menu is deleted. Link to comment Share on other sites More sharing options...
water Posted October 15, 2013 Share Posted October 15, 2013 Can you post the AHK code? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
remin Posted October 15, 2013 Author Share Posted October 15, 2013 Sure expandcollapse popup^8:: ;; Convert Case MENU KeyWait, Ctrl Menu,convert2,Add Menu,convert2,Delete menu,convert2,Add,&Upper Case,dcUpper menu,convert2,Add,&Lower Case,dcLower menu,convert2,Add,&Title Case,dcTitle menu,convert2,Add,&Title Case >1,dcTitle>1 menu,convert2,Add,&Sentence Case,dcSentence Menu,convert2,Show Return ;--------------------- dcStart: ;SUB Start Send, ^x KeyWait, Ctrl ClipWait Return ;--------------------- dcEnd: ;SUB End Sleep, 200 Send, ^v KeyWait, Ctrl sleep, 200 Return ;--------------------- dcUpper: GoSub, dcStart StringUpper, Clipboard, Clipboard GoSub, dcEnd return dcLower: GoSub, dcStart StringLower, Clipboard, Clipboard GoSub, dcEnd return dcTitle: GoSub, dcStart StringLower, Clipboard, Clipboard Clipboard := RegExReplace(Clipboard, "(^|\s|\n^)(\w)", "$1$U2") GoSub, dcEnd return dcTitle>1: GoSub, dcStart StringLower, Clipboard, Clipboard Clipboard := RegExReplace(Clipboard, "(^|\s|\n^)(\w)(\w+)", "$1$U2$3") GoSub, dcEnd return dcSentence: GoSub, dcStart StringLower, Clipboard, Clipboard Clipboard := RegExReplace(Clipboard, "(((^|([.!?]+\s+))[a-z])| i | i')", "$u1") GoSub, dcEnd return 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