Leaderboard
Popular Content
Showing content with the highest reputation on 04/25/2013 in all areas
-
GUI/Tray Menu with icons and colors
abberration reacted to Holger for a topic
Hi outthere here is my script-stuff to create ownerdrawn menuitems with icons and colors. It uses GUIRegisterMsg() and WM_DRAWITEM / WM_MEASUREITEM - messages proceeding. Holger Update 06.05.2008: !!! Warning: Script breaking !!! Please change the following commands to: _TrayCreateItem(Text, ...) _TrayCreateMenu(Text , ...) - Fixed: some old values (thanks to aGorilla) - Fixed: ..SetText() functions (thanks to MrCreatoR) - Added the following commands: _SetMenuIconBkGrdColor(Color) ; set icon background gradient color _SetTrayIconBkGrdColor(Color) ; set icon background gradient color New sidebar menu commands: _CreateSideMenu(MenuID) ; returns a SideMenuID/index _DeleteSideMenu(SideMenuID) ; delete a menu sidebar _SetSideMenuText(SideMenuID, Text) ; set a text for the sidebar _SetSideMenuColor(SideMenuID, Color) ; set text color _SetSideMenuBkColor(SideMenuID, Color) ; set text background color _SetSideMenuBkGradColor(SideMenuID, Color) ; set text background gradient color _SetSideMenuImage(SideMenuID, Bitmapfile [, Resourcename/number [, Expand/Compress Bitmap]]) Just take a look into the samples how to use them! At the moment there are some known issues: - missing 64bit compatibility (already in progress, to fully work with "AutoIt3_x64.exe") - moving the mouse cursor on the sidebar menu image/text also changes the current menu item selection - for sidebar menu image only bitmaps are supported at the moment (min.8bpp) Update 23.03.2008: !!! Warning: Please update all your scripts and add after _TrayIconCreate() the command _TrayIconSetState() - otherwise you will not see any tray icons!!! Also update your icon numbers like for GUI icons - Fixed: some things (thanks to nickston) - Changed: _TrayIconCreate() do not show automatically the icon - Changed: icon behaviour now more similar to GUI icons (I hope) - Added: command.txt - Removed: unicode macro History: CODEUpdate 21.03.2008: - Changed: dynamic array sizing of the saved menu items - Added: _TrayDeleteItem(menuID), _GUICtrlODMenuItemDelete($nID) - please delete menu (items) with these commands - Added: _TrayIconSetState() modes 4 and 8 for flashing and flashstopping of tray icons - Added: _SetFlashTimeOut([timeOut]) to set the flash timeout - Added: OnEvent sample Update 23.02.2008: - Fixed: GDI object overload while using bold font Update 22.02.2008: - Added: _TrayItemSetSelIcon(ItemID, IconFile, IconID) - set the icon if the item is selected - Added: _GUICtrlODMenuItemSetIcon(ItemID, IconFile, IconID) - set the icon of the item - Added: _GUICtrlODMenuItemSetSelIcon(ItemID, IconFile, IconID) - set the icon if the item is selected - Added: "ModernMenuRaw.au3" which only includes the unknown constants, should better work with 'Au3Check' now Update 12.01.2008-2: - Fixed: Missing underscore in "CreateMenuFontByName"-function (Font fallback function) (thanks to MsCreatoR and GEOSoft). - Changed: If a menuitem is disabled then the rect only is showing around the item - Added: Underscore in menutext only showing when pressing "Alt"-key Update 12.01.2008: - Changed: 'local' Dll calls to global DllOpen to speedup (some virusscanners sometimes slowdown the process cause of opening these Dll's again and again) - Added: Using of @Tab for accelerator showing/drawing Update 07.12.2007: - Changed: all stuff in only 1 ZIP file - Fixed: now works with 3.2.10.0 and 3.2.8.1 Update 03.08.2007 - Fixed: error in _TrayIconDelete() and new creation - Added: additional parameter to _TrayIconCreate(ToolTip, IconFile, IconID, Callback, Msg, hIcon) to use existing icon handles - Added: sample_Win2Tray: 'moves' all minimized windows to the tray Update 28.07.2007 - Fixed: wrong call of function CreateFont() - Thanks to SleepyExtreme for info - Changed: included samples to demonstrate using of icon clicks Update 26.07.2007 - Fixed: missing function: LoadIcon() Update 21.07.2007 - added bold item support - limited to menuitems only, menus are not supported Update 17.07.2007: - now you can also menu icons for the tray - added commands for Tray: _TrayIconCreate() _TrayCreateMenu() _TrayCreateItem() _TrayItemSetIcon() _TrayIconSetState() _TrayTip() So you can have more than 1 tray icon for 1 Autoit3-script. Update 01.07.2007: - now works with unicode (3.2.4.9) - new command: _GUICtrlODMenuItemSetText(ControlID, NewText) Update 21.08.2006: - delete 1 line in libs to work with current release 3.2.0.X (error: cannot redeclare constant...) - Thanks to Javascript_Freek for info Update 02.02.2006: - added Checked-state for normal menu items and radio menu items - added a like ModernMenuLib-script for easier create/use these menustuff (see sample in the ModernMenuLib-folder) ModernMenuLib_with_Tray.zip1 point -
all credits to bcording '?do=embed' frameborder='0' data-embedContent>> Just a more Up-to-date version including office: ConsoleWrite("Windows Key : " & @TAB & _DecodeProductKey("Windows") & @CRLF) ConsoleWrite("Windows Key 4 : " & @TAB & _DecodeProductKey("Windows_DPid4") & @CRLF) ConsoleWrite("Windows Default : " & @TAB & _DecodeProductKey("Windows_Def") & @CRLF) ConsoleWrite("Windows Default 4 : " & @TAB & _DecodeProductKey("Windows_Def_DPid4") & @CRLF & @CRLF) ConsoleWrite("Office XP Key : " & @TAB & _DecodeProductKey("Office XP") & @CRLF) ConsoleWrite("Office 2003 Key : " & @TAB & _DecodeProductKey("Office 2003") & @CRLF) ConsoleWrite("Office 2007 Key : " & @TAB & _DecodeProductKey("Office 2007") & @CRLF) ConsoleWrite("Office 2010 x86 Key: " & @TAB & _DecodeProductKey("Office 2010 x86") & @CRLF) ConsoleWrite("Office 2010 x64 Key: " & @TAB & _DecodeProductKey("Office 2010 x64") & @CRLF) ConsoleWrite("Office 2013 x86 Key: " & @TAB & _DecodeProductKey("Office 2013 x86") & @CRLF) ConsoleWrite("Office 2013 x64 Key: " & @TAB & _DecodeProductKey("Office 2013 x64") & @CRLF) Func _DecodeProductKey($Product, $Offset = 0) Local $sKey[29], $Value = 0, $hi = 0, $n = 0, $i = 0, $dlen = 29, $slen = 15, $Result, $bKey, $iKeyOffset = 52, $RegKey Switch $Product Case "Windows" $bKey = RegRead("HKLM64\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "DigitalProductId") Case "Windows_DPid4" $bKey = RegRead("HKLM64\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "DigitalProductId4") $iKeyOffset = 0x328 Case "Windows_Def" $bKey = RegRead("HKLM64\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DefaultProductKey", "DigitalProductId") Case "Windows_Def_DPid4" $bKey = RegRead("HKLM64\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DefaultProductKey", "DigitalProductId4") $iKeyOffset = 0x328 Case "Office XP" $RegKey = 'HKLM\SOFTWARE\Microsoft\Office\10.0\Registration' If @OSArch = 'x64' Then $RegKey = 'HKLM64\SOFTWARE\Wow6432Node\Microsoft\Office\10.0\Registration' For $i = 1 To 100 $var = RegEnumKey($RegKey, $i) If @error <> 0 Then ExitLoop $bKey = RegRead($RegKey & '\' & $var, 'DigitalProductId') If Not @error Then ExitLoop Next Case "Office 2003" $RegKey = 'HKLM\SOFTWARE\Microsoft\Office\11.0\Registration' If @OSArch = 'x64' Then $RegKey = 'HKLM64\SOFTWARE\Wow6432Node\Microsoft\Office\11.0\Registration' For $i = 1 To 100 $var = RegEnumKey($RegKey, $i) If @error <> 0 Then ExitLoop $bKey = RegRead($RegKey & '\' & $var, 'DigitalProductId') If Not @error Then ExitLoop Next Case "Office 2007" $RegKey = 'HKLM\SOFTWARE\Microsoft\Office\12.0\Registration' If @OSArch = 'x64' Then $RegKey = 'HKLM64\SOFTWARE\Wow6432Node\Microsoft\Office\12.0\Registration' For $i = 1 To 100 $var = RegEnumKey($RegKey, $i) If @error <> 0 Then ExitLoop $bKey = RegRead($RegKey & '\' & $var, 'DigitalProductId') If Not @error Then ExitLoop Next Case "Office 2010 x86" $RegKey = 'HKLM\SOFTWARE\Microsoft\Office\14.0\Registration' If @OSArch = 'x64' Then $RegKey = 'HKLM64\SOFTWARE\Wow6432Node\Microsoft\Office\14.0\Registration' For $i = 1 To 100 $var = RegEnumKey($RegKey, $i) If @error <> 0 Then ExitLoop $bKey = RegRead($RegKey & '\' & $var, 'DigitalProductId') If Not @error Then ExitLoop Next $iKeyOffset = 0x328 Case "Office 2010 x64" If @OSArch <> 'x64' Then Return SetError(1, 0, "Product not found") $RegKey = 'HKLM64\SOFTWARE\Microsoft\Office\14.0\Registration' For $i = 1 To 100 $var = RegEnumKey($RegKey, $i) If @error <> 0 Then ExitLoop $bKey = RegRead($RegKey & '\' & $var, 'DigitalProductId') If Not @error Then ExitLoop Next $iKeyOffset = 0x328 Case "Office 2013 x86" $RegKey = 'HKLM\SOFTWARE\Microsoft\Office\15.0\Registration' If @OSArch = 'x64' Then $RegKey = 'HKLM64\SOFTWARE\Wow6432Node\Microsoft\Office\15.0\Registration' For $i = 1 To 1024 $var = RegEnumKey($RegKey, $i) If @error <> 0 Then ExitLoop $bKey = RegRead($RegKey & '\' & $var, 'DigitalProductId') If Not @error Then ExitLoop Next $iKeyOffset = 0x328 Case "Office 2013 x64" If @OSArch <> 'x64' Then Return SetError(1, 0, "Product not found") $RegKey = 'HKLM64\SOFTWARE\Microsoft\Office\15.0\Registration' For $i = 1 To 1024 $var = RegEnumKey($RegKey, $i) If @error <> 0 Then ExitLoop $bKey = RegRead($RegKey & '\' & $var, 'DigitalProductId') If Not @error Then ExitLoop Next $iKeyOffset = 0x328 Case Else Return SetError(1, 0, "Product not supported") EndSwitch If Not BinaryLen($bKey) Then Return "" Local $aKeys[BinaryLen($bKey)] For $i = 0 To UBound($aKeys) - 1 $aKeys[$i] = Int(BinaryMid($bKey, $i + 1, 1)) Next Local Const $isWin8 = BitAND(BitShift($aKeys[$iKeyOffset + 14], 3), 1) $aKeys[$iKeyOffset + 14] = BitOR(BitAND($aKeys[$iKeyOffset + 14], 0xF7), BitShift(BitAND($isWin8, 2), -2)) $i = 24 Local $sChars = "BCDFGHJKMPQRTVWXY2346789", $iCur, $iX, $sKeyOutput, $iLast While $i > -1 $iCur = 0 $iX = 14 While $iX > -1 $iCur = BitShift($iCur, -8) $iCur = $aKeys[$iX + $iKeyOffset] + $iCur $aKeys[$iX + $iKeyOffset] = Int($iCur / 24) $iCur = Mod($iCur, 24) $iX -= 1 WEnd $i -= 1 $sKeyOutput = StringMid($sChars, $iCur + 1, 1) & $sKeyOutput $iLast = $iCur WEnd If $isWin8 Then $sKeyOutput = StringMid($sKeyOutput, 2, $iLast) & "N" & StringTrimLeft($sKeyOutput, $iLast + 1) EndIf Return StringRegExpReplace($sKeyOutput, '(\w{5})(\w{5})(\w{5})(\w{5})(\w{5})', '\1-\2-\3-\4-\5') EndFunc ;==>_DecodeProductKey1 point
-
Here is a little tutorial I decided to make. (yes another tutorial) It is intended for people with absolutely no knowledge of programming/scripting at all. It also assumes you do not know how to use autoit3 help file. What it does assume, is that you have installed autoit3 and scite4autoit which can be found here Autoit > Scite4autoit The most important thing to know, is how to navigate and use the helpfile Please do not underestimate how valuable this resource is. By default the help file is located in your myprograms or myprogramsx86 of you OS drive in the folder AutoIt3 It looks like this with the ? on it, click it Once the helpfile loads you will see essentially two panels, the one on the left is about navigation The one on the right is about information, and for now, just focus on the index tab and click it to see something like this in the left panel Notice it says "Type in the keyword to find", this is where we can find what we are looking for. For example, if I want to find a string function, or browse all the string functions, I simply type "string" into the field below the prompt, and it navigates automatically to the items in the index, like so. If you highlight one of the items in the list and hit enter, or double click on an item, it will bring up information about that item in the right side panel, like so. Above I clicked on the String function and it shows me everything i need to know about that function. Firstly, it tells me in essence what it does. "Returns the string representation of an expression." Secondly, it shows me how to enter the function into scite editor "String ( expression )" In the scope of this post, the expession here is the paramater we pass to the function for processing. A paramater is any variable or literal we put inside the braces of a function. It also tells me the return value - "Returns a string." - a string it what is between those two quotes (text if you will) So what is a return value? Its what the function pumps out after you pass it the correct paramaters, you can test it in the example at the bottom of the right panel. But not before you take a look at another important part of the information, The remarks. "Maximum string length is 2147483647 characters (but keep in mind that no line in an AutoIt script can exceed 4095 characters.)" Here its telling us that if we put a string of over 4095 characters on one line in our script, it will fail. Never skip the remarks, it will cost you valuable time and cause you headaches. Every time you are going to use a function, you should have that function open in the helpfile and refer to it every step of the way. All the information in that panel is important, read it all, and then, notice the little button at the bottom of the example entitled "Open this Script", press that, and the script will automagically open in your scite4autoit editor, and is ready to run, by hitting the F5 key Q. What is a variable? A. $this_is_a_variable = "this is a literal string"; A variable will always have the $ at the beginning and never have a space in it (those are rules) Look at the example $var = String(10) ;$var is the string "10" ;$var is the variable here, and 10 is a literal paramater passed to the String function. Lets take the String function out of the equasion and consider this statement (in the scope of this post a statement is information you type into scite which is telling autoit3 something it needs to know) $var = 10 Here the variable $var is now equal to the literal value 10, it is named a variable because it can change its value. $var = $var + 1 $var is now equal to 11, 10 however, will always be 10. Lets have a look at another function, you remember how to find what we need in the helpfile? then find FileRead. Heres what it tells us. Read in a number of characters from a previously opened text file. This means it will read into the variable it is assigned, (think $var) the amount of individual characters we want from a file that autoit3 has already opened. FileRead ( "filehandle/filename" [, count] ) This is like a prototype of the function we will enter into our editor, notice the bracets "[" and "]" they are telling us that this paramater is optional! more below. Parameters filehandle/filename - The handle of a file, as returned by a previous call to FileOpen. Alternatively you may use a string filename as the first parameter. Forget filehandle for now, filename here is the path to the file we want to read from, for example "c:usersscriptsmyfile.txt" count - [optional] The number of characters to read. Default read the entire file. Its quite common for beginners to misunderstand these [ and ], you dont type them literally into your script, they are just to let you know that you can completely leave out that paramater if you do not need it. In this case, if you want to read the whole file into your variable ($var) you would leave out everything between and including those bracets. If you do need it you would remove the bracets and enter your paramater. Return Value Success: Returns the binary/string read. @extended is set to the number of bytes/characters returned. This tells us the function will return a string if we gave it a filename as a paramater, since we are reading the file, the string will be the contents of the file. Special: Sets @error to -1 if end-of-file is reached. @error information tells us information about why the call to a function may have failed. It is important to check the @error state after each function you use. Failure: Sets @error to 1 if file not opened in read mode or other error. Looking at the example usually shows you how to check for errors. Remarks If a filename is given rather than a file handle - the file will be opened and closed during the function call - for parsing large text files this will be much slower than using filehandles. Note: Do not mix filehandles and filenames, i.e., don't FileOpen a file and then use a filename in this function. Use either filehandles or filenames in your routines, not both! Both ANSI and UTF16/UTF8 text formats can be read - AutoIt will automatically determine the type. A file can be read as binary(byte) data by using FileOpen with the binary flag - in this case count is in bytes rather than characters. There are plenty of good tutorials on this forum created by various members, which is why it is important to know how to search the forums. But hang on, this tutorial is about how to use the helpfile, so cast your mind way back to when we learnt how to find what we need It was typing it into the index tab prompt field, so type "tutorial" into that, and you will find basic tuts in their also.1 point
-
Here is an example for you - it will work till the link is valid#include-once #include <GuiRichEdit.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Main() Func Main() Local $hGui, $hRichEdit, $iMsg $hGui = GUICreate("Example (" & StringTrimRight(@ScriptName, 4) & ")", 320, 350, -1, -1, 0, $WS_EX_COMPOSITED) $hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a a transparent Rich Edit Control." & @CRLF & _ "Press Esc To Exit", 10, 200, 300, 100, BitOR($ES_MULTILINE, $ES_AUTOVSCROLL), $WS_EX_TRANSPARENT) $File = @ScriptDir & "\cute.jpg" If Not FileExists($File) Then ToolTip("Please Wait while the Image is downloaded") InetGet("http://www.picgifs.com/graphics/c/cute/graphics-cute-920618.jpg", $File) ToolTip("") EndIf GUICtrlCreatePic($File, 0, 0, 320, 350) GUISetState() While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd _GUICtrlRichEdit_Destroy($hRichEdit) GUIDelete() EndFunc ;==>Main1 point
-
IEAction Click doesn't fire off javascript "mousedown"
phamdacloc reacted to DaleHohm for a topic
It turns out that the actual event sequesnce of a mouse click is onmousedown, onmouseup, click. I was unaware of this when I wrote the _IEAction function. You can create the full sequence with: $oElement.fireEvent("onmousedown") $oElement.fireEvent("onmouseup") _IEAction($oElement, "click") Dale1 point -
You need to forward it for TCP defined services or UDP depending on what you want to do and I am not sure of any known TCP file sending method.1 point