Leaderboard
Popular Content
Showing content with the highest reputation on 12/10/2014 in all areas
-
Form Builder beta
mLipok reacted to BuckMaster for a topic
Update v1.0.6 Major script overhaul, I literally started over from scratch only adding parts of code from the old script that were solid. I don’t have a help file made as of now so I am going to explain all of the functionality in this post - Form Builder is no longer bi-directional, you now toggle between script mode and GUI mode using a button in the top right or F4 - The script no longer recompiles on every change but instead inserts changes into the script - Form Builder no longer cares about Event mode or GuiGetMsg mode - No more .gui files, you now edit .au3 scripts directly - Script edit is now a SciLexer control, includes syntax highlighting, folding, call tips, keywords, and inline error annotations. - Script output console is now at the bottom in script mode - Main GUI menu redone, most functions from SciTe have been added along with their hotkeys - All restrictions to editing the script have been removed - GDI+ and Graphic editors removed - Cleanup of script, stability greatly increased - Hotkeys no longer use _IsPressed they now use GUIAccelerator keys (with exception to a few) - Multiple scripts can be open - Form Builder buffers the open scripts and adds an asterisk * to scripts that have been modified - Rich Edit, GUIScrollbars, Dummy, and Updown are disabled for now until I can add them - GUI Menu controls cannot be created as of now but will be rendered in the editor - Undo and Redo actions in script mode and GUI mode added, the GUI undo and redo buffer is cleared switching between modes - The Undo and Redo buffers do not have a limit but are cleared when switching between modes or scripts - Undo and Redo actions do not work for controls that have no control handle - The Treeview now works as a Go to function for controls and functions in script mode - Form Builder now tries to preserve as much of the original content as possible, it will save whitespace in-between parameters and comments on controls - Treeview context menu reworked, much more responsive - Unicode support added File -> Encoding -> UTF-8 - Language support added, I added a couple of language files and used Google translate just so I could size my GUI's for different languages, I do not support what those language files say - Selecting a GUI in the Treeview in GUI mode will allow you to change the GUI's Handle, Position, Background Color, State, Cursor, Font, Font Size and Font Attributes - Auto Declare is no longer hiding in the settings, it is now on the top right and is a toggle between Off, Global and Local - Help File Lookup added (Ctrl + H), allows you to search selected text in the help file, Any variable will be searched and the first result will be displayed, any string will be searched as a keyword in the index - Added current script line, column, and selection length in the bottom left - Standard undeclared style constants are checked before script execution and the script will prompt if an undefined style constant is found - You can now toggle script whitespace, EOL characters, line numbers, margins and output in the View menu - View -> Toggle All Folds works as it does in SciTe, only base level folds are changed and the first fold found determines whether to expand or contract - Form Builder Settings redone - Bugs with submitting data and control selection have been fixed - Fixed problems with frequently called repetitive functions causing issues with large scripts - Fixed bugs with B, I, U and S font attribute buttons getting stuck and called when enter was pressed Update v1.0.7 - Help File Look-up hotkey changed to Ctrl+B - Replace hotkey changed to Ctrl+H - Changes to $SCN_MODIFIED so only text events are notified - Bookmarks added, Ctrl+M to add or delete a Bookmark from the current line - Edit -> Bookmarks -> Set Bookmark changes the currently selected Bookmark - Edit -> Clear Current Bookmarks deletes only the currently selected Bookmark - Allows you to change foreground and background colors of Bookmarks - Added F2 hotkey for Next Bookmark - Added Shift+F2 hotkey for Previous Bookmark - Fixed a bug that made it so script annotation did not show up for some people - Script errors and warnings now add a Bookmark on each line - Ctrl+E hotkey added to clear all Bookmarks and Annotations - Minor GUI tweaks - Fixed a bug with the GUI Style undo action - Undo and Redo actions for GUI windows will now update the window properties if the GUI is selected - F4 Hotkey no longer switches modes, switching modes is now F10 - F4 is to toggle next error or warning message, works like it does in SciTe, bookmarks the line and highlights the error in the console - Shift+F4 Hotkey added to toggle previous error or warning message - Shift+F5 Hotkey added to clear script output - Ctrl+F5 Hotkey added as SyntaxCheck Prod - Form Builder now performs a SyntaxCheck before entering GUI Mode and prompts on Error or Warning - Language Select Menu Added Settings -> Lanugage - Icons added to main menu - Languages added to all new menu items and msgbox's - Language Files updated for new data - Language Support added for Arabic, Chinese, Dutch, French, German, Hebrew, Japanese, Swedish, Thai, and Vietnamese [ Google Translate ] - Fixed bug with updating a language that made it look like ANSI and UTF-8 were both selected - Added redo button next to undo button - Font attribute buttons Bold, Italic, Underline and Strike-Out changed to labels Update v1.0.8 - Somehow a main function got deleted causing the script to crash on some changes - Fixed some issues with updating Languages Hotkeys Ctrl + N - New Blank Script Ctrl + G - New GUI Script Ctrl + O - Open Script Ctrl + Shift + S - Save As Ctrl + S - Save Esc - Close Open Script Alt + F4 - Exit Ctrl + Z - Undo Ctrl + Y - Redo Ctrl + X - Cut Ctrl + C - Copy Ctrl + V - Paste Ctrl + A - Select All Ctrl + W - Clear inline script annotation Ctrl + E - Clear inline script annotation and bookmarks Ctrl + F - Find Ctrl + F3 - Find Next Shift + F3 - Find Previous (doesn’t work yet) Ctrl + B - Help File Lookup F5 - Go Alt + F5 - Beta Run F7 - Build Ctrl + F7 - Compile F11 - Full screen F8 - Toggle Show/Hide Script Output Ctrl + I - Open Include Ctrl + H - Replace F1 - AutoIt Help File Ctrl + D - Duplicate Control Delete - Delete Control Ctrl + Shift + 8 - Toggle Show/Hide Script Whitespace Ctrl + Shift + 9 - Toggle Show/Hide Script EOL characters Ctrl - GUI Mode multicontrol selection F10 - Switch Modes F4 - Next Message Shift+F4 - Previous Message Shift+F5 - Clear Output Ctrl+M - Add Bookmark F2 - Next Bookmark Shift+F2 - Previous Bookmark Basic GUI Mode How To Create a Control - click a control on the left - click in the GUI you wish to add the control Left Click: Click and drag to auto resize the control Right Click: Creates the control at a standard size Select a Control - click inside the control or select it in the treeview Change a controls Data - First select the control - modify the controls data on the right, press enter to submit changes state, cursor, font and resizing update when you change the data - when modifying the data parameter the script recognizes if there is a variable in the data and will add quotes accordingly ex. data parameter = $data, End result in script: GUICtrlCreateButton($data, 50, 50, 100, 20) ex. data parameter = data, End result in script: GUICtrlCreateButton("data", 50, 50, 100, 20) ex. data parameter = "data"&$data, End result in script: GUICtrlCreateButton("data"&$data, 50, 50, 100, 20) Applying an Image to a control - select a control - control styles must be applied to some controls before adding an image - click the ... button next to the Image input in the Control Properties area in the bottom right - select the image you want to display, allows jpg, bmp, gif, ico and dll files - selecting a dll will open another prompt to choose which resource to display Control Grouping - multiple controls must be selected - press the group controls button - control grouping allows you to resize and move multiple controls at the same time, as of now groups are deleted when leaving GUI mode I only have a couple odds and ends to finish up before everything should be complete, I need to add Undo and Redo actions for copying and duplicating controls and a couple other minor things, eventually I want to try to add all of the UDF controls as well. If people are willing to translate the language file I would be very grateful, the ones I have right now are from Google translate, I only used them for testing and have no idea what they say. I want to thank Kip, Prog@ndy, Isi360 and all of the other contributors on this forum, without you guys i don't think i could have written this script. Please post any comments, problems or suggestions, BuckMaster * I only used one "magic number" on my main close case statement, only for faster locating, and i don't care. Form Builder Source.zip Form Builder.zip1 point -
Have setup few autoit scripts on a machine for performing certain routine tasks. This machine is intended only for this purpose (i.e) it doesn't require any human intervention. So we are not allocating a monitor to this CPU. There's just the CPU on LAN and anytime anything has to be done on the PC it is taken via RDP. Autoit script was coded via RDP :-) So would like to know if the autoit functions like MouseGetPos etc would work without an active monitor attached to the CPU. This might have been asked before but unfortunately I have not stumbled across an answer in my searches so far. So please bear with me and answer or redirect me to any other info links. Thanks in Advance.1 point
-
Make sure there are no spaces or new lines in the file. That might be causing some issues. Maybe try Global $server = StringStripWS(FileReadLine( "servervar.txt" ), 8)1 point
-
Does mouse pointer location based function require a monitor attached?
Xandy reacted to JLogan3o13 for a topic
Um, have you tried it? Write a small script get moves the mouse to a certain position and then writes MouseGetPos to a file. Run it with a monitor attached, and then unplug the monitor and run again. You'll have your answer1 point -
maybe you're looking for >this. Saludos1 point
-
Need easy help to retrieve proxies
Sodori reacted to computergroove for a topic
#include <array.au3> #include <File.au3> #include <String.au3> #include <IE.au3> Local $oIE = _IECreate("http://proxyipchecker.com/") WinWait("Online Proxy Checker - IP Checker - Check Proxy - Internet Explorer") Local $HTML = _IEDocReadHTML($oIE);Gets all HTML Local $LeftCount = StringInStr($HTML,'<ul class="freshproxies">');find the count of characters that come before the first string you want to find Local $temp = StringTrimLeft($HTML,$LeftCount + 25);removes all characters before the first ipaddress Local $RightLocation = StringInStr($temp,"</li></ul>");position of the end of the ip address section in the html Local $RawData = StringMid($temp,1,$RightLocation - 1);unedited datablock of ip address information Local $SplitRaw = StringSplit($RawData,'</li>',1) Local $TempArray[0][3] For $i = 1 To Ubound($SplitRaw) - 1 Local $M = StringReplace($SplitRaw[$i],'<li class="',"");remove leading text Local $N = StringReplace($M,'">',";");remove unwanted characters Local $O = StringReplace($N,":",";") _ArrayAdd($TempArray,$O,0,";") Next _ArrayDisplay($TempArray) This just needs the description removed and it is ready to use. Edit - For anyone who wants to chime in on this one there is a description that becomes part of the string behind the port number that sometimes does not show up at all (it's optional when entering the data in the website). I cannot figure out how to trim the description from my array.1 point -
@StefanoVR Do you have any new observations or modifications to my revised version of this UDF ?1 point
-
ASM_ButtonHover.zip ASM_ButtonHover.au3 #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #include <SendMessage.au3> Global $PointerSize = DllStructGetSize(DllStructCreate("PTR")) ,$ControlThread = DllStructCreate("INT TA;INT TB;INT TC") Global $User32Dll = _WinAPI_LoadLibrary("User32.dll"),$AsmVar = DllStructCreate("INT LOOP;PTR PtrAtPos;HWND CurrentHwnd") Global $StructButtonHover =0 ,$StructBHover =DllStructCreate("INT COUNT;PTR BHOVER") , $StructBHSize = DllStructGetSize _ ( DllStructCreate( "HWND HWNDA; HWND HWNDB; INT TPRESS; INT THOVER;PTR NORMAL;PTR OVER;PTR PRESS;INT MSGLOG" )) Global $Kernel32dll = _WinAPI_LoadLibrary( "Kernel32.dll" ) , $StructBHoverPtr = DllStructGetPtr( $StructBHover ) Global $_GtPt=_WinAPI_GetProcAddress($User32Dll,"GetParent"),$_WnFPos=_WinAPI_GetProcAddress($User32Dll,"WindowFromPoint") Global $SdMsg =_WinAPI_GetProcAddress($User32Dll,"SendMessageW"),$RiWin =_WinAPI_GetProcAddress($User32Dll,"RedrawWindow") Global $G_CP =_WinAPI_GetProcAddress($User32Dll,"GetCursorPos"),$GKYState=_WinAPI_GetProcAddress($User32Dll,"GetKeyState") Global $Sleep =_WinAPI_GetProcAddress($Kernel32dll,"Sleep") ,$PositionsSt = DllStructCreate("INT POS[2]") , $ThreadPtr = 0 Global $NewStructButtonHover= 0,$PositionsStPtr= DllStructGetPtr($PositionsSt),$IsPss = LIsPress(),$IsNPss = LIsNotPress() Global $IsPssPtr = DllStructGetPtr($IsPss) , $IsNPssPtr = DllStructGetPtr($IsNPss),$MHover = LMHover(),$MNHover=LMNHover() Global $MHoverPtr = DllStructGetPtr( $MHover ) , $MNHoverPtr = DllStructGetPtr( $MNHover ) , $ThreadAdd = LoadThread( ) Func CreateButtonHover($Text,$L,$T,$W,$H,$NORMAL_hBMP,$PRESS_hBMP,$OVER_hBMP,$TEXTCOLOOR = 0,$Font = True) Local $tagButtonHover = "HWND HWNDA;HWND HWNDB;INT TPRESS;INT THOVER;PTR NORMAL;PTR OVER;PTR PRESS;INT MSGLOG" Local $STM_SETIMAGE_HOVER = 0x0172 , $SS_BITMAP_HOVER = 0x0000000E _ , $SS_REALSIZECONTROL_HOVER = 0x00000040 , $STN_CLICKED = 0 $controlID1 = GUICtrlCreateLabel("",$L,$T,$W,$H,BitOR($SS_REALSIZECONTROL_HOVER,$SS_BITMAP_HOVER)) if @error Then Return SetError(1,0,0) GUICtrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT) $hWndA = GUICtrlGetHandle($controlID1) $controlID2 = GUICtrlCreateLabel($Text,$L,$T,$W,$H,BitOR($SS_CENTERIMAGE,$SS_CENTER)) if @error Then GUICtrlDelete($controlID1) Return SetError(2,0,0) EndIf $hWndB = GUICtrlGetHandle($controlID2) $MSGLOG = _WinAPI_MakeLong($controlID2,$STN_CLICKED) GUICtrlSetBkColor ( -1 , $GUI_BKCOLOR_TRANSPARENT) if ($TEXTCOLOOR) Then GUICtrlSetColor(-1,$TEXTCOLOOR) if ($Font) Then GUICtrlSetFont(-1,(($H) / 2) - 1,600,0,"Arial") if Not(DllStructGetData($StructBHover,"COUNT")) Then $StructButtonHover = DllStructCreate($tagButtonHover) DllStructSetData($StructButtonHover,"NORMAL",$NORMAL_hBMP) DllStructSetData($StructButtonHover , "OVER" , $OVER_hBMP) DllStructSetData($StructButtonHover ,"PRESS", $PRESS_hBMP) DllStructSetData($StructButtonHover , "HWNDA" , $hWndA) DllStructSetData($StructButtonHover , "HWNDB" , $hWndB) DllStructSetData($StructButtonHover , "MSGLOG" , $MSGLOG) $ButtonHoverPtr = DllStructGetPtr( $StructButtonHover ) DllStructSetData($StructBHover,"BHOVER",$ButtonHoverPtr) DllStructSetData($StructBHover,"COUNT",1) Else ControlThread(1,True,True) $COUNT = DllStructGetData($StructBHover,"COUNT") $NewtagButtonHover = "BYTE [" & ($COUNT * $StructBHSize) & "];" & $tagButtonHover $NewStructButtonHover = DllStructCreate($NewtagButtonHover) $NewStructButtonHoverPtr = DllStructGetPtr( $NewStructButtonHover ) DllCall("kernel32.dll","none","RtlMoveMemory","ptr", $NewStructButtonHoverPtr, _ "ptr",DllStructGetPtr($StructButtonHover),"ulong_ptr",($COUNT * $StructBHSize)) DllStructSetData($NewStructButtonHover,"NORMAL",$NORMAL_hBMP) DllStructSetData($NewStructButtonHover , "OVER" , $OVER_hBMP) DllStructSetData($NewStructButtonHover ,"PRESS", $PRESS_hBMP) DllStructSetData($NewStructButtonHover , "HWNDA" , $hWndA) DllStructSetData($NewStructButtonHover , "HWNDB" , $hWndB) DllStructSetData($NewStructButtonHover , "MSGLOG" , $MSGLOG) DllStructSetData($StructBHover,"BHOVER",$NewStructButtonHoverPtr) DllStructSetData($StructBHover,"COUNT",$COUNT + 1) $StructButtonHover = $NewStructButtonHover $NewStructButtonHover = 0 ControlThread(1,False) EndIf _SendMessage($hWndA,$STM_SETIMAGE_HOVER,0,$NORMAL_hBMP) if Not($ThreadPtr) Then $ThreadPtr = DllStructGetPtr($ThreadAdd) CreateThread($ThreadPtr,0) EndIf Return SetError (0,$controlID1,$controlID2) EndFunc Func LoadThread() Local $IntSize = DllStructGetSize(DllStructCreate("INT")) ,$JZEnd , $JZTA ,$CThread Local $OffSelpParameter = $PointerSize,$LOOPA,$End,$TA,$OffSetHwndA = 0,$TB,$JMPEND Local $JZEnd , $JMPTB , $LOOPB , $AsmVarPtr = DllStructGetPtr($AsmVar) , $JZCThread For $i = 1 To 2 $_ASMCode = "0x" $LOOPA = BinaryLen($_ASMCode) $_ASMCode &= "B8" & HexBinary(3) ;mov eax,3 // 3 Milliseconds $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary($Sleep) ;mov eax,$Sleep $_ASMCode &= "FFD0" ;call eax $_ASMCode &= "BF" & HexBinary($AsmVarPtr) ;mov edi,$AsmVarPtr $_ASMCode &= "BB" & HexBinary($StructBHoverPtr) ;mov ebx,$StructBHoverPtr $_ASMCode &= "8B13" ;mov edx,[ebx] $_ASMCode &= "8917" ;mov [edi],edx $_ASMCode &= "8B5B" & Hex($IntSize,2) ;mov ebx,[ebx + $IntSize] $_ASMCode &= "895F" & Hex($IntSize,2) ;mov [edi + $IntSize],ebx $_ASMCode &= "B8" & HexBinary($PositionsStPtr) ;mov eax,$PositionsStPtr $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary($G_CP) ;mov eax,GetCursorPos $_ASMCode &= "FFD0" ;call eax $_ASMCode &= "B8" & HexBinary($PositionsStPtr) ;mov eax,$PositionsStPtr $_ASMCode &= "FF70" & Hex($IntSize,2) ;push [eax + $IntSize] $_ASMCode &= "FF30" ;push [eax] $_ASMCode &= "B8" & HexBinary($_WnFPos) ;mov eax,WindowFromPoint $_ASMCode &= "FFD0" ;call eax $_ASMCode &= "8947" & Hex(($IntSize + $PointerSize),2) ;mov [edi + ($IntSize + $PointerSize)],eax $LOOPB = BinaryLen($_ASMCode) $_ASMCode &= "B8" & HexBinary($AsmVarPtr) ;mov eax,$AsmVarPtr $_ASMCode &= "8038" & Hex(0,2) ;CMP [eax],0 $_ASMCode &= "74" & Hex(($End - $JZEnd),2) ;JZ $End; $JZEnd = BinaryLen($_ASMCode) $_ASMCode &= "B8" & HexBinary($AsmVarPtr) ;mov eax,$AsmVarPtr $_ASMCode &= "8B58" & Hex($IntSize,2) ;mov ebx,[eax + $IntSize] $_ASMCode &= "8B3B" ;mov edi,[ebx] ; // Get HWNDA $_ASMCode &= "8B40" & Hex(($IntSize + $PointerSize),2) ;mov eax,[eax + ($IntSize + $PointerSize)] // Get CurrentHwnd $_ASMCode &= "3BF8" ;CMP edi,eax $_ASMCode &= "74" & Hex(($TA - $JZTA),2) ;JZ $JZTA; $JZTA = BinaryLen($_ASMCode) $_ASMCode &= "B8" & HexBinary($AsmVarPtr) ;mov eax,$AsmVarPtr $_ASMCode &= "8B58" & Hex($IntSize,2) ;mov ebx,[eax + $IntSize] $_ASMCode &= "53" ;push ebx $_ASMCode &= "B8" & HexBinary($MNHoverPtr) ;mov eax,$MNHoverPtr $_ASMCode &= "FFD0" ;call eax $_ASMCode &= "EB" & Hex(($TB - $JMPTB),2) ;JMP $TB $JMPTB = BinaryLen($_ASMCode) $TA = BinaryLen($_ASMCode) $_ASMCode &= "B8" & HexBinary($AsmVarPtr) ;mov eax,$AsmVarPtr $_ASMCode &= "8B58" & Hex($IntSize,2) ;mov ebx,[eax + $IntSize] $_ASMCode &= "53" ;push ebx $_ASMCode &= "B8" & HexBinary($MHoverPtr) ;mov eax,$MHoverPtr $_ASMCode &= "FFD0" ;call eax $TB = BinaryLen($_ASMCode) $_ASMCode &= "B8" & HexBinary($AsmVarPtr) ;mov eax,$AsmVarPtr $_ASMCode &= "8028" & Hex(1,2) ;sub [eax],1 $_ASMCode &= "8B58" & Hex($IntSize,2) ;mov ebx,[eax + $IntSize] $_ASMCode &= "83C3" & Hex($StructBHSize,2) ;add ebx,$StructBHSize $_ASMCode &= "8958" & Hex($IntSize,2) ;mov [eax + $IntSize],ebx $JMPLOOPB = BinaryLen($_ASMCode) $_ASMCode &= "E9" & HexBinary(-(($JMPLOOPB - $LOOPB) + 5)) ;JMP $LOOPB $End = BinaryLen($_ASMCode) $_ASMCode &= "B8" & HexBinary(DllStructGetPtr($ControlThread)) ;mov eax,$ControlThread $_ASMCode &= "8038" & Hex(1,2) ;CMP [eax],1 $_ASMCode &= "74" & Hex(($CThread - $JZCThread),2) ;JZ $CThread $JZCThread = BinaryLen($_ASMCode) $JMPLOOPA = BinaryLen($_ASMCode) $_ASMCode &= "E9" & HexBinary(-(($JMPLOOPA - $LOOPA) + 5)) ;JMP LOOPA $CThread = BinaryLen($_ASMCode) $_ASMCode &= "C640" & Hex($IntSize,2) & Hex(1,2) ;mov [eax + $IntSize],1 $_ASMCode &= "B8" & HexBinary(3) ;mov eax,3 // 3 Milliseconds $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary($Sleep) ;mov eax,$Sleep $_ASMCode &= "FFD0" ;call eax $JMPEND = BinaryLen($_ASMCode) $_ASMCode &= "E9" & HexBinary(-(($JMPEND - $End) + 5)) ;JMP End $_ASMCode &= "C2" & Hex($PointerSize,2) & Hex(0,2) ;ret ($PointerSize) & "00" // Args Size Next $Address = DllStructCreate("byte[" & BinaryLen($_ASMCode) & "]") DllStructSetData($Address,1,$_ASMCode) Return $Address EndFunc Func LMHover() ;Mouse Hover Local $OffSetTpress = DllStructGetSize( DllStructCreate( "HWND HWNDA;HWND HWNDB" )) Local $TA , $JZTA , $TB , $JMPTB , $OffSetStructBHoverPtr = $PointerSize For $i = 1 To 2 $_ASMCode = "0x" $_ASMCode &= "B8" & HexBinary(0x01) ;mov eax,$VK_LBUTTON $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary($GKYState) ;mov eax,GetKeyState $_ASMCode &= "FFD0" ;call eax $_ASMCode &= "25" & HexBinary(0x8000) ; and eax,0x8000 // bitwise AND // eax = BitAND(eax,0x8000) $_ASMCode &= "83F8" & Hex(0,2) ;CMP eax,0 $_ASMCode &= "74" & Hex(($TA - $JZTA),2) ;JZ $JZTA; $JZTA = BinaryLen($_ASMCode) $_ASMCode &= "FF7424" & Hex($OffSetStructBHoverPtr,2) ;push [esp + $OffSetStructBHoverPtr] $_ASMCode &= "B8" & HexBinary($IsPssPtr) ;mov eax,$IsPssPtr $_ASMCode &= "FFD0" ;call eax $_ASMCode &= "EB" & Hex(($TB - $JMPTB),2) ;JMP $JMPTD $JMPTB = BinaryLen($_ASMCode) $TA = BinaryLen($_ASMCode) $_ASMCode &= "FF7424" & Hex($OffSetStructBHoverPtr,2) ;push [esp + $OffSetStructBHoverPtr] $_ASMCode &= "B8" & HexBinary($IsNPssPtr) ;mov eax,$IsNPssPtr $_ASMCode &= "FFD0" ;call eax $TB = BinaryLen($_ASMCode) ;------------------------------// Return 0 //----------------------------------------------------------- $_ASMCode &= "B8" & HexBinary(0) ;mov eax,0 $_ASMCode &= "C2" & Hex($PointerSize,2) & Hex(0,2) ;ret ($PointerSize) & "00" // Args Size ;------------------------------// Return 0 //-------------------------------------------------------- Next $Address = DllStructCreate("byte[" & BinaryLen($_ASMCode) & "]") DllStructSetData($Address,1,$_ASMCode) Return $Address EndFunc Func LIsPress() Local $OffSetPBmp = DllStructGetSize(DllStructCreate( "HWND HWNDA;HWND HWNDB;INT TPRESS;INT THOVER;PTR NORMAL;PTR OVER")) Local $OffSetTpress = DllStructGetSize( DllStructCreate("HWND HWNDA;HWND HWNDB" )) , $OffSetStructBHoverPtr = $PointerSize Local $STM_SETIMAGE_HOVER = 0x0172 , $OffSetThover = DllStructGetSize( DllStructCreate( "HWND HWNDA;HWND HWNDB;INT TPRESS")) Local $OffSetHwndA=0,$OffSetHBmp=DllStructGetSize(DllStructCreate("HWND HWNDA;HWND HWNDB;INT TPRESS;INT THOVER;PTR NORMAL")) Local $TA , $JZTA , $TB , $JZTB , $JMPTC1 , $TC , $JMPTC2 ,$TC,$OffSetHwndB = DllStructGetSize(DllStructCreate("HWND HWNDA")) For $i = 1 To 2 $_ASMCode = "0x" $_ASMCode &= "8B5C24" & Hex($OffSetStructBHoverPtr,2) ;mov ebx,[esp + $OffSetStructBHoverPtr] $_ASMCode &= "8B43" & Hex($OffSetTpress,2) ;mov eax,[ebx + $OffSetTpress] $_ASMCode &= "83F8" & Hex(0,2) ;CMP eax,0 $_ASMCode &= "74" & Hex(($TA - $JZTA),2) ;JZ $JZTA; $JZTA = BinaryLen($_ASMCode) $_ASMCode &= "8B43" & Hex($OffSetThover,2) ;mov eax,[ebx + $OffSetThover] $_ASMCode &= "83F8" & Hex(0,2) ;CMP eax,0 $_ASMCode &= "74" & Hex(($TB - $JZTB),2) ;JZ $JZTB; $JZTB = BinaryLen($_ASMCode) $_ASMCode &= "EB" & Hex(($TC - $JMPTC1),2) ;JMP $JMPTC1 $JMPTC1 = BinaryLen($_ASMCode) $TB = BinaryLen($_ASMCode) $_ASMCode &= "8B43" & Hex($OffSetHBmp,2) ;mov eax,[ebx + $OffSetHBmp] $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary(0) ;mov eax,0 $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary($STM_SETIMAGE_HOVER) ;mov eax,$STM_SETIMAGE_HOVER $_ASMCode &= "50" ;push eax $_ASMCode &= "8B43" & Hex($OffSetHwndA,2) ;mov eax,[ebx + $OffSetHwndA] $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary($SdMsg) ;mov eax,SendMessageW $_ASMCode &= "FFD0" ;call eax $_ASMCode &= "B8" & HexBinary(BitOR($RDW_INVALIDATE,$RDW_UPDATENOW)) ;mov eax,BitOR($RDW_INVALIDATE,$RDW_UPDATENOW) $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary(0) ;mov eax,0 $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary(0) ;mov eax,0 $_ASMCode &= "50" ;push eax $_ASMCode &= "8B43" & Hex($OffSetHwndB,2) ;mov eax,[ebx + $OffSetHwndB] $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary($RiWin) ;mov eax,RedrawWindow $_ASMCode &= "FFD0" ;call eax $_ASMCode &= "C643" & Hex($OffSetThover,2) & Hex(1,2) ;mov [ebx + $OffSetThover],1 $_ASMCode &= "EB" & Hex(($TC - $JMPTC2),2) ;JMP $JMPTC2 $JMPTC2 = BinaryLen($_ASMCode) $TA = BinaryLen($_ASMCode) $_ASMCode &= "8B43" & Hex($OffSetPBmp,2) ;mov eax,[ebx + $OffSetPBmp] $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary(0) ;mov eax,0 $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary($STM_SETIMAGE_HOVER) ;mov eax,$STM_SETIMAGE_HOVER $_ASMCode &= "50" ;push eax $_ASMCode &= "8B43" & Hex($OffSetHwndA,2) ;mov eax,[ebx + $OffSetHwndA] $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary($SdMsg) ;mov eax,SendMessageW $_ASMCode &= "FFD0" ;call eax $_ASMCode &= "B8" & HexBinary(BitOR($RDW_INVALIDATE,$RDW_UPDATENOW)) ;mov eax,BitOR($RDW_INVALIDATE,$RDW_UPDATENOW) $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary(0) ;mov eax,0 $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary(0) ;mov eax,0 $_ASMCode &= "50" ;push eax $_ASMCode &= "8B43" & Hex($OffSetHwndB,2) ;mov eax,[ebx + $OffSetHwndB] $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary($RiWin) ;mov eax,RedrawWindow $_ASMCode &= "FFD0" ;call eax $_ASMCode &= "C643" & Hex($OffSetTpress,2) & Hex(1,2) ;mov [ebx + $OffSetTpress],1 $TC = BinaryLen($_ASMCode) ;------------------------------// Return 0 //----------------------------------------------------------- $_ASMCode &= "B8" & HexBinary(0) ;mov eax,0 $_ASMCode &= "C2" & Hex($PointerSize,2) & Hex(0,2) ;ret ($PointerSize) & "00" // Args Size ;------------------------------// Return 0 //----------------------------------------------------------- Next $Address = DllStructCreate("byte[" & BinaryLen($_ASMCode) & "]") DllStructSetData($Address,1,$_ASMCode) Return $Address EndFunc Func LIsNotPress() Local $OffSetPBmp = DllStructGetSize(DllStructCreate( "HWND HWNDA;HWND HWNDB;INT TPRESS;INT THOVER;PTR NORMAL;PTR OVER")) Local $OffSetTpress = DllStructGetSize( DllStructCreate("HWND HWNDA;HWND HWNDB" ) ) , $OffSetStructBHoverPtr = $PointerSize Local $STM_SETIMAGE_HOVER=0x0172,$OffSetThover=DllStructGetSize(DllStructCreate("HWND HWNDA;HWND HWNDB;INT TPRESS")),$SSenMsg Local $OffSetHwndB=DllStructGetSize(DllStructCreate("HWND HWNDA")),$OffSetHBmp =DllStructGetSize(DllStructCreate("HWND HWNDA" & _ ";HWND HWNDB;INT TPRESS;INT THOVER;PTR NORMAL")),$OffsetMsgLog = DllStructGetSize(DllStructCreate("HWND HWNDA;HWND HWNDB;INT" & _ " TPRESS;INT THOVER;PTR NORMAL;PTR OVER;PTR PRESS")),$OffSetHwndA = 0 ,$TA,$JZTA,$JMPTB,$TB,$JZTC,$TC,$TD,$JZTD,$JZStopSendMsg Local $IntSize = DllStructGetSize(DllStructCreate("INT")) For $i = 1 To 2 $_ASMCode = "0x" $_ASMCode &= "8B5C24" & Hex($OffSetStructBHoverPtr,2) ;mov ebx,[esp + $OffSetStructBHoverPtr] $_ASMCode &= "8B43" & Hex($OffSetTpress,2) ;mov eax,[ebx + $OffSetTpress] $_ASMCode &= "83F8" & Hex(1,2) ;CMP eax,1 $_ASMCode &= "74" & Hex(($TA - $JZTA),2) ;JZ $JZTA; $JZTA = BinaryLen($_ASMCode) $_ASMCode &= "EB" & Hex(($TB - $JMPTB),2) ;JMP $JMPTB $JMPTB = BinaryLen($_ASMCode) $TA = BinaryLen($_ASMCode) $_ASMCode &= "B8" & HexBinary(DllStructGetPtr($ControlThread)) ;mov eax,$ControlThread $_ASMCode &= "8078" & Hex(($IntSize * 2),2) & Hex(1,2) ;CMP [eax + ($IntSize * 2)],1 $_ASMCode &= "74" & Hex(($SSenMsg - $JZStopSendMsg),2) ;JZ $StopSendMsg $JZStopSendMsg = BinaryLen($_ASMCode) $_ASMCode &= "8B43" & Hex($OffSetHwndB,2) ;mov eax,[ebx + $OffSetHwndB] $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary($_GtPt) ;mov eax,GetParent $_ASMCode &= "FFD0" ;call eax $_ASMCode &= "8BF8" ;mov edi,eax $_ASMCode &= "8B43" & Hex($OffSetHwndB,2) ;mov eax,[ebx + $OffSetHwndB] $_ASMCode &= "50" ;push eax $_ASMCode &= "8B43" & Hex($OffsetMsgLog,2) ;mov eax,[ebx + $OffsetMsgLog] $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary($WM_COMMAND) ;mov eax,$WM_COMMAND $_ASMCode &= "50" ;push eax $_ASMCode &= "57" ;push edi $_ASMCode &= "B8" & HexBinary($SdMsg) ;mov eax,SendMessageW $_ASMCode &= "FFD0" ;call eax $SSenMsg = BinaryLen($_ASMCode) ; StopSendMsg $_ASMCode &= "C643" & Hex($OffSetThover,2) & Hex(0,2) ;mov [ebx + $OffSetThover],0 $_ASMCode &= "C643" & Hex($OffSetTpress,2) & Hex(0,2) ;mov [ebx + $OffSetTpress],0 $TB = BinaryLen($_ASMCode) $_ASMCode &= "8B43" & Hex($OffSetThover,2) ;mov eax,[ebx + $OffSetThover] $_ASMCode &= "83F8" & Hex(1,2) ;CMP eax,1 $_ASMCode &= "74" & Hex(($TC - $JZTC),2) ;JZ $JZTC; $JZTC = BinaryLen($_ASMCode) $_ASMCode &= "C643" & Hex($OffSetThover,2) & Hex(1,2) ;mov [ebx + $OffSetThover],1 $_ASMCode &= "8B43" & Hex($OffSetHBmp,2) ;mov eax,[ebx + $OffSetHBmp] $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary(0) ;mov eax,0 $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary($STM_SETIMAGE_HOVER) ;mov eax,$STM_SETIMAGE_HOVER $_ASMCode &= "50" ;push eax $_ASMCode &= "8B43" & Hex($OffSetHwndA,2) ;mov eax,[ebx + $OffSetHwndA] $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary($SdMsg) ;mov eax,SendMessageW $_ASMCode &= "FFD0" ;call eax $_ASMCode &= "B8" & HexBinary(BitOR($RDW_INVALIDATE,$RDW_UPDATENOW)) ;mov eax,BitOR($RDW_INVALIDATE,$RDW_UPDATENOW) $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary(0) ;mov eax,0 $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary(0) ;mov eax,0 $_ASMCode &= "50" ;push eax $_ASMCode &= "8B43" & Hex($OffSetHwndB,2) ;mov eax,[ebx + $OffSetHwndB] $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary($RiWin) ;mov eax,RedrawWindow $_ASMCode &= "FFD0" ;call eax $TC = BinaryLen($_ASMCode) $_ASMCode &= "8B43" & Hex($OffSetTpress,2) ;mov eax,[ebx + $OffSetTpress] $_ASMCode &= "83F8" & Hex(3,2) ;CMP eax,3 $_ASMCode &= "74" & Hex(($TD - $JZTD),2) ;JZ $JZTD; $JZTD = BinaryLen($_ASMCode) ;------------------------------// Return 0 //----------------------------------------------------------- $_ASMCode &= "B8" & HexBinary(0) ;mov eax,0 $_ASMCode &= "C2" & Hex($PointerSize,2) & Hex(0,2) ;ret ($PointerSize) & "00" // Args Size ;------------------------------// Return 0 //----------------------------------------------------------- $TD = BinaryLen($_ASMCode) $_ASMCode &= "C643" & Hex($OffSetTpress,2) & Hex(0,2) ;mov [ebx + $OffSetTpress],0 ;------------------------------// Return 0 //----------------------------------------------------------- $_ASMCode &= "B8" & HexBinary(0) ;mov eax,0 $_ASMCode &= "C2" & Hex($PointerSize,2) & Hex(0,2) ;ret ($PointerSize) & "00" // Args Size ;------------------------------// Return 0 //----------------------------------------------------------- Next $Address = DllStructCreate("byte[" & BinaryLen($_ASMCode) & "]") DllStructSetData($Address,1,$_ASMCode) Return $Address EndFunc Func LMNHover() ;Mouse Not Hover Local $OffSetNBmp = DllStructGetSize( DllStructCreate( "HWND HWNDA;HWND HWNDB;INT TPRESS;INT THOVER" )) Local $OffSetThover = DllStructGetSize( DllStructCreate("HWND HWNDA;HWND HWNDB;INT TPRESS")) , $OffSetHwndA = 0 Local $OffSetTpress = DllStructGetSize(DllStructCreate("HWND HWNDA;HWND HWNDB")) , $STM_SETIMAGE_HOVER = 0x0172 Local $OffSetStructBHoverPtr = $PointerSize , $TA , $JZTA , $TB , $JZTB , $TC , $JMPTC Local $OffSetHwndB = DllStructGetSize(DllStructCreate("HWND HWNDA")) For $i = 1 To 2 $_ASMCode = "0x" $_ASMCode &= "8B5C24" & Hex($OffSetStructBHoverPtr,2) ;mov ebx,[esp + $OffSetStructBHoverPtr] $_ASMCode &= "8B43" & Hex($OffSetThover,2) ;mov eax,[ebx + $OffSetThover] $_ASMCode &= "83F8" & Hex(0,2) ;CMP eax,0 $_ASMCode &= "74" & Hex(($TA - $JZTA),2) ;JZ $JZTA; $JZTA = BinaryLen($_ASMCode) $_ASMCode &= "8B43" & Hex($OffSetNBmp,2) ;mov eax,[ebx + $OffSetNBmp] $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary(0) ;mov eax,0 $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary($STM_SETIMAGE_HOVER) ;mov eax,$STM_SETIMAGE_HOVER $_ASMCode &= "50" ;push eax $_ASMCode &= "8B43" & Hex($OffSetHwndA,2) ;mov eax,[ebx + $OffSetHwndA] $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary($SdMsg) ;mov eax,SendMessageW $_ASMCode &= "FFD0" ;call eax $_ASMCode &= "B8" & HexBinary(BitOR($RDW_INVALIDATE,$RDW_UPDATENOW)) ;mov eax,BitOR($RDW_INVALIDATE,$RDW_UPDATENOW) $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary(0) ;mov eax,0 $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary(0) ;mov eax,0 $_ASMCode &= "50" ;push eax $_ASMCode &= "8B43" & Hex($OffSetHwndB,2) ;mov eax,[ebx + $OffSetHwndB] $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary($RiWin) ;mov eax,RedrawWindow $_ASMCode &= "FFD0" ;call eax $_ASMCode &= "C643" & Hex($OffSetThover,2) & Hex(0,2) ;mov [ebx + $OffSetThover],0 $TA = BinaryLen($_ASMCode) $_ASMCode &= "B8" & HexBinary(0x01) ;mov eax,$VK_LBUTTON $_ASMCode &= "50" ;push eax $_ASMCode &= "B8" & HexBinary($GKYState) ;mov eax,GetKeyState $_ASMCode &= "FFD0" ;call eax $_ASMCode &= "25" & HexBinary(0x8000) ; and eax,0x8000 // bitwise AND // eax = BitAND(eax,0x8000) $_ASMCode &= "83F8" & Hex(0,2) ;CMP eax,0 $_ASMCode &= "74" & Hex(($TB - $JZTB),2) ;JZ $JZTB; $JZTB = BinaryLen($_ASMCode) $_ASMCode &= "C643" & Hex($OffSetTpress,2) & Hex(3,2) ;mov [ebx + $OffSetTpress],3 ;------------------------------// Return 0 //----------------------------------------------------------- $_ASMCode &= "B8" & HexBinary(0) ;mov eax,0 $_ASMCode &= "C2" & Hex($PointerSize,2) & Hex(0,2) ;ret ($PointerSize) & "00" // Args Size ;------------------------------// Return 0 //----------------------------------------------------------- $TB = BinaryLen($_ASMCode) $_ASMCode &= "C643" & Hex($OffSetTpress,2) & Hex(0,2) ;mov [ebx + $OffSetTpress],0 ;------------------------------// Return 0 //----------------------------------------------------------- $_ASMCode &= "B8" & HexBinary(0) ;mov eax,0 $_ASMCode &= "C2" & Hex($PointerSize,2) & Hex(0,2) ;ret ($PointerSize) & "00" // Args Size ;------------------------------// Return 0 //----------------------------------------------------------- Next $Address = DllStructCreate("byte[" & BinaryLen($_ASMCode) & "]") DllStructSetData($Address,1,$_ASMCode) Return $Address EndFunc Func ControlThread($Flag = 1,$BOOL = True , $Wait = False) ; $Flag = 1 Continue Thread Loop // $BOOL = True Or $BOOL = False ; $Flag = 2 Stop Msg Send // // $BOOL = True Or $BOOL = False ; $Wait True Or False Wait Start Continue Of Thread Loop Switch $Flag Case 1 DllStructSetData($ControlThread, "TA" , 0 ) DllStructSetData($ControlThread, "TB" , 0 ) if ($BOOL) Then DllStructSetData($ControlThread, "TA" , 1 ) if ($Wait) Then While DllStructGetData($ControlThread,"TB") == 0 WEnd Return True Else Return True EndIf Else DllStructSetData($ControlThread, "TA" , 0 ) DllStructSetData($ControlThread, "TB" , 0 ) Return True EndIf Case 2 if ($BOOL) Then DllStructSetData($ControlThread, "TC" , 1 ) Else DllStructSetData($ControlThread, "TC" , 0 ) EndIf Return True Case Else Return False EndSwitch EndFunc Func HexBinary($Value) Return Hex(Binary($Value)) EndFunc Func CreateThread($lpStartAddress,$lpParameter) Local $HANDLE = DllCall("Kernel32.dll","ptr","CreateThread","ptr",0,"int",0,"ptr", _ $lpStartAddress,"ptr",$lpParameter,"DWORD",0,"DWORD*",0) if @error Or $HANDLE[0] = 0 Then Return SetError(1,0,0) Return SetError(0,0,$HANDLE[0]) EndFunc Func LoadBitmap_FromFile($sFileName) Return _WinAPI_LoadImage(_WinAPI_GetModuleHandle(0),$sFileName,0 ,0,0,0x0010) EndFunc Func LoadBitmap_FromResources($resource_Name) Return _WinAPI_LoadBitmap(_WinAPI_GetModuleHandle(0), $resource_Name) EndFunc ButtonHover_Example1.au3 #include <ASM_ButtonHover.au3> $NORMAL_hBMP = LoadBitmap_FromFile("NORMAL1.bmp") $PRESS_hBMP = LoadBitmap_FromFile("PRESS1.bmp") $OVER_hBMP = LoadBitmap_FromFile("OVER1.bmp") $TEXTCOLOOR = 0xFFFFFF $GUI = GUICreate("ASM_ButtonHover") $Button_SM = CreateButtonHover ("Small", 180, 80, 70, 15,$NORMAL_hBMP,$PRESS_hBMP,$OVER_hBMP,$TEXTCOLOOR) GUICtrlSetFont(-1, 8, 800, 0, "Arial") $Button_ME = CreateButtonHover ("Medium", 180, 120, 90, 30,$NORMAL_hBMP,$PRESS_hBMP,$OVER_hBMP,$TEXTCOLOOR) GUICtrlSetFont(-1, 12, 800, 0, "Arial") $Button_LO = CreateButtonHover ("Long", 180, 180, 190, 30,$NORMAL_hBMP,$PRESS_hBMP,$OVER_hBMP,$TEXTCOLOOR) GUICtrlSetFont(-1, 16, 800, 0, "Arial") $Button_LA = CreateButtonHover ("Large", 180, 240, 190, 60, $NORMAL_hBMP,$PRESS_hBMP,$OVER_hBMP,$TEXTCOLOOR) GUICtrlSetFont(-1, 20, 800, 0, "Arial") GUISetState(@SW_SHOW) While 1 $MSG = GUIGetMsg() StopSendMsg(True) Switch $MSG Case $GUI_EVENT_CLOSE Exit Case $Button_SM MsgBox(0,"MSG","Small Button") Case $Button_ME MsgBox(0,"MSG","Medium Button") Case $Button_LO MsgBox(0,"MSG","Long Button") Case $Button_LA MsgBox(0,"MSG","Large Button") EndSwitch StopSendMsg(False) WEnd Func StopSendMsg($BOOL) ControlThread(2,$BOOL) EndFunc ButtonHover_Example2.au3 #include <ASM_ButtonHover.au3> $NORMAL_hBMP = LoadBitmap_FromFile("NORMAL1.bmp") $PRESS_hBMP = LoadBitmap_FromFile("PRESS1.bmp") $OVER_hBMP = LoadBitmap_FromFile("OVER1.bmp") $TEXTCOLOOR = 0xFFFFFF $GUI = GUICreate("ASM_ButtonHover") $Button_SM = CreateButtonHover ("Small", 180, 80, 70, 15,$NORMAL_hBMP,$PRESS_hBMP,$OVER_hBMP,$TEXTCOLOOR) GUICtrlSetFont(-1, 8, 800, 0, "Arial") $Button_ME = CreateButtonHover ("Medium", 180, 120, 90, 30,$NORMAL_hBMP,$PRESS_hBMP,$OVER_hBMP,$TEXTCOLOOR) GUICtrlSetFont(-1, 12, 800, 0, "Arial") $Button_LO = CreateButtonHover ("Long", 180, 180, 190, 30,$NORMAL_hBMP,$PRESS_hBMP,$OVER_hBMP,$TEXTCOLOOR) GUICtrlSetFont(-1, 16, 800, 0, "Arial") $Button_LA = CreateButtonHover ("Large", 180, 240, 190, 60, $NORMAL_hBMP,$PRESS_hBMP,$OVER_hBMP,$TEXTCOLOOR) GUICtrlSetFont(-1, 20, 800, 0, "Arial") GUISetState(@SW_SHOW) While 1 $MSG = GUIGetMsg() Switch $MSG Case $GUI_EVENT_CLOSE Exit Case $Button_SM MsgBox(0,"MSG","Small Button") Case $Button_ME MsgBox(0,"MSG","Medium Button") Case $Button_LO MsgBox(0,"MSG","Long Button") Case $Button_LA MsgBox(0,"MSG","Large Button") EndSwitch WEnd1 point
-
Hidix17, How about this: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $hGUI_Outer = GUICreate("Outer", 500, 500, Default, Default, $WS_POPUP) GUISetBkColor(0xAAAAFF) GUISetState() $hGUI_Inner = GUICreate("Inner", 480, 480, 12, 12, $WS_POPUP, $WS_EX_MDICHILD, $hGUI_Outer) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd M231 point
-
Ever had the need to pick a hex value for a color for a GUI or a control? Ever tried to figure out how to get those numbers into your script once you've picked the perfect color? I have come up with an extremely small script, that when compiled and placed in a folder inside the SciTE folder will allow you to quickly select the color you want using the _ChooseColor dialog. It will then paste this color code into your script where you cursor is currently placed. It works with Scite only for now, mainly because it uses ControlSend to paste the value into SciTE's editor window, but can easily be modified to work with any editor by changing the window title and control ID it's sending to. This code will work when compiled and placed into the "Autoit3\Scite\ColorChooser" folder, or wherever you have your installation of SciTE, but has to be in the folder named ColorChooser for the tool code to work, or you'll have to change that yourself. Here's the code for the colorchooser: #AutoIt3Wrapper_UseUpx=n #AutoIt3Wrapper_Run_Tidy=y #Tidy_Parameters=/rel #AutoIt3Wrapper_Run_Obfuscator=y #Obfuscator_Parameters=/so #endregion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <Misc.au3> #include <SendMessage.au3> Opt("WinTitleMatchMode", 2) Global $sDefaultColor = 0 Global $iMode = 1 Global Const $WM_COPYDATA = 0x004A If $cmdline[0] > 0 Then $sDefaultColor = $cmdline[1] EndIf If StringLeft($sDefaultColor, 2) <> "0x" Then $iMode = 0 $sDefaultColor = "0x" & $sDefaultColor EndIf $sReturn = _ChooseColor(2, $sDefaultColor, 2) If $sReturn = -1 Then Exit (1) If Not $iMode Then $sReturn = StringMid($sReturn, 3) EndIf _SciTE_InsertText($sReturn) Func _SciTE_InsertText($sString) Return _SciTE_Send_Command(0, WinGetHandle("DirectorExtension"), "insert:" & $sString) EndFunc ;==>_SciTE_InsertText Func _SciTE_Send_Command($hHandle, $hSciTE, $sString) Local $ilParam, $tData If StringStripWS($sString, 8) = "" Then Return SetError(2, 0, 0) ; String is blank. EndIf $sString = ":" & Dec(StringTrimLeft($hHandle, 2)) & ":" & $sString $tData = DllStructCreate("char[" & StringLen($sString) + 1 & "]") ; wchar DllStructSetData($tData, 1, $sString) $ilParam = DllStructCreate("ptr;dword;ptr") ; ulong_ptr;dword;ptr DllStructSetData($ilParam, 1, 1) ; $ilParam, 1, 1 DllStructSetData($ilParam, 2, DllStructGetSize($tData)) DllStructSetData($ilParam, 3, DllStructGetPtr($tData)) _SendMessage($hSciTE, $WM_COPYDATA, $hHandle, DllStructGetPtr($ilParam)) Return Number(Not @error) EndFunc ;==>_SciTE_Send_Command As you can see, there's not a whole lot to it. It just pops open the color chooser dialog, copies the results to the clipboard and then pastes it into SciTE using the ControlSend command. You will also notice, that if you don't choose a color, by hitting cancel in the Color Chooser dialog, it will also exit without pasting anything, so you shouldn't need to worry about pasting something you don't want in your scripts. This code should be added to your SciTEUser.properties file so that you can call it from within SciTE by hitting Ctrl-Alt-C, this can be changed if you already have a hot key set to that combination. # 43 Color Chooser command.name.43.*=Color Chooser command.43.*="$(SciteDefaultHome)\ColorChooser\ColorChooser.exe" $(CurrentSelection) command.shortcut.43.*=Ctrl+Alt+C That's all there is to it, enjoy. EDIT: I have updated the script and the SciTEUser.properties code so that if you have a color code that's currently selected when this is called, it will send that to the _ChooseColor dialog now as the starting color. UPDATED: 31-May-12 I've updated the script so that it now uses the "DirectorExtension" as suggested by guinness instead of copying the data to the clipboard and pasting it into SciTE, which might cause problems with what you have on the clipboard currently. I have also updated it so that if you send the script a color in the format "FFFFFF" without the preceeding "0x", it will return the color code in the same format. This is useful if, for example, you're changing a color in one of SciTE's properties files, which don't start with "0x". I've also changed the command.43.* line, I've moved the quote from the end of the line to the end of the command because I've noticed that a lot of times it causes issues if the color code is inside the quotes.1 point