Leaderboard
Popular Content
Showing content with the highest reputation on 04/09/2012 in all areas
-
Special Note: This is an official beta release but it is not digitally signed. Only Jon has the certificate used for digital signatures and the last time I checked I was not Jon. 3.3.9.4 (9th April, 2012) (Beta) NOTE: Version 3.3.9.3 has been replaced with version 3.3.9.4 due to an issue where scripts with icons would not compile correctly. If you are using 3.3.9.3 please update immediately. 3.3.9.3 (8th April, 2012) (Beta) The following changes are script breaking changes: NOTE: WinAPIEx is included in this release. The files exist but there are no documentation or examples. Filenames and functions are subject to change or removal. Functions will be moved out to other files before the final release and the file WinAPIEx.au3 will likely not exist when that happens. Report issues here. Download here.3 points
-
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 -
The original resolution switcher by HTC works good on earlier Windows, but has two problems on Win8. When activated it creates a window telling the current resolution. It is given focus and thus forces Metro back to the desktop.It switches between the native 800x480 and 1024x600 which is to low to run Metro apps.To fix this I started with a simple script that switches to 1152x864 with a window that displays the resolution without grabbing focus.Later I added some extras: Option to skip the window altogetherSeparate resolution in desktop and MetroA simple installer/uninstaller for the HTC Shift (or other devices that use a synaptics touchpad in the same matter, check the code).Code moved to attachment. See next post for screenshots. ResSwitch source.rar The .au3 itselfModified (removed duplicate const's)Modified (removed duplicate const's and commented WinXP (+ earlier) code to reduce file size)ResSwitch.rar (previous downloads: 51)A compiled .exe (if you don't have AutoIt? lol).bat file calling the installer/uninstaller function (optional).ini file containing the standard settings (optional)1 point
-
I've considerably shortened up your code by eliminating numerous things that weren't really necessary, also I've eliminated the use of the File.au3 UDF as it's not needed for this script at all. You were also using FileWrite to write everything to a text file, and then you'd have to add in the @CR to every line, if you use FileWriteLine instead, you can bypass having to dothat because it adds that in for you. Plus, you were using an array in your installed software function, and redimming it constantly, but you weren't using that array for anything. ReDim can take a while to do its thing, so redimming an array you're not using is just wasting the script time. #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.6.1 Author: Sean Script Function: #ce ---------------------------------------------------------------------------- #include <Constants.au3> ;Grab Current Username Global $UserName = @UserName Global $FileName = @DesktopDir & "" & $UserName & ".txt" ; Verify $Username.txt does not exist, if it does delete it. Global $FileCHK = FileExists($FileName) If $FileCHK = 1 Then FileDelete($FileName) EndIf ; Create Fresh $Username.txt Global $FileLoc = FileOpen($FileName, 2) FileWriteLine($FileLoc, @MON & "/" & @MDAY & "/" & @YEAR & @CRLF & "Basic Computer Information:" & @CR & @CRLF) FileWriteLine($FileLoc, "Computer Name: " & @ComputerName) GetOSVersion($FileLoc) FileWriteLine($FileLoc, "OS Arch: " & @OSArch & @CRLF) FileWriteLine($FileLoc, "*****************************************************************************************************************" & @CRLF) FileWriteLine($FileLoc, "Detailed Computer Information:" & @CRLF & @CRLF) GetDetailedCompInfo($FileLoc) FileWriteLine($FileLoc, @CRLF & "*****************************************************************************************************************" & @CRLF) FileWriteLine($FileLoc, "MAC Adresses:" & @CRLF & @CRLF) GetMACAddresses($FileLoc) FileWriteLine($FileLoc, @CRLF & "*****************************************************************************************************************" & @CRLF) FileWriteLine($FileLoc, "Installed Software:" & @CRLF & @CRLF) GetInstalledSoftware($FileLoc) ;End of program EndProgram() ; ***************************************************************************************************************** ; ; ================================== ; ; Functions ; ================================== ; ; =========================================================================== ; ; This function Gets the Name of the OS Version And Prints it to a Text File ; =========================================================================== ; Func GetOSVersion($FileLoc) Local $OSSvcPack = @OSServicePack Local $objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!.rootcimv2") Local $colSettings = $objWMIService.ExecQuery("Select * from Win32_OperatingSystem") For $objOperatingSystem In $colSettings FileWriteLine($FileLoc, "OS Version: " & $objOperatingSystem.Caption & " " & $OSSvcPack) Next EndFunc ;==>GetOSVersion ; =================================================================================== ; ; This function Gets the Detailed Computer Information And Prints it to a Text File ; =================================================================================== ; Func GetDetailedCompInfo($FileLoc) Local $wbemFlagReturnImmediately = 0x10 Local $wbemFlagForwardOnly = 0x20 ;~ Local $colItems = "" Local $strComputer = "." Local $Output = "" Local $objWMIService = ObjGet("winmgmts:" & $strComputer & "rootCIMV2") Local $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystemProduct", "WQL", _ $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) Then For $objItem In $colItems FileWriteLine($FileLoc, "Caption: " & $objItem.Caption & @CRLF) FileWriteLine($FileLoc, "Description: " & $objItem.Description & @CRLF) FileWriteLine($FileLoc, "Service Tag: " & $objItem.IdentifyingNumber & @CRLF) FileWriteLine($FileLoc, "Name: " & $objItem.Name & @CRLF) FileWriteLine($FileLoc, "UUID: " & $objItem.UUID & @CRLF) FileWriteLine($FileLoc, "Vendor: " & $objItem.Vendor & @CRLF) FileWriteLine($FileLoc, "Version: " & $objItem.Version & @CRLF) Next EndIf EndFunc ;==>GetDetailedCompInfo ; ====================================================================================================== ; ; This function Gets the Mac Addresses of the Computers Network Adapters And Prints them to a Text File ; ====================================================================================================== ; Func GetMACAddresses($FileLoc) Local $objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}") Local $netAdapterSet = $objWMIService.ExecQuery("select * from Win32_NetworkAdapter") For $netAdapter In $netAdapterSet FileWriteLine($FileLoc, $netAdapter.Name & ": " & $netAdapter.MACAddress) Next EndFunc ;==>GetMACAddresses ; ==================================================================================== ; ; This Function Gets the Software installed on the computer and Prints it to the File ; ==================================================================================== ; Func GetInstalledSoftware($FileLoc) $sSoftwareName = '' $objInstaller = ObjCreate('WindowsInstaller.Installer') $Products = $objInstaller.Products For $Product In $Products If $objInstaller.ProductInfo($Product, 'ProductName') <> "" Then FileWriteLine($FileLoc, $objInstaller.ProductInfo($Product, 'ProductName') & " " & $objInstaller.ProductInfo($Product, 'VersionString')) Next EndFunc ;==>GetInstalledSoftware ; ==================================== ; ; This Function Wraps up the program ; ==================================== ; Func EndProgram() FileClose($FileLoc) EndFunc ;==>EndProgram ; ***************************************************************************************************************** ; Try this and see if it does what you're looking to do.1 point
-
send enter
holzfelix reacted to Apfelkiller for a topic
Ok I tried it myself with this: AutoItSetOption("WinTitleMatchMode", 2) Run("Rasphone.exe -d VPN-Verbindung") WinWaitActive('Verbindung mit "VPN-Verbindung" herstellen') Send("{ENTER}") I changed the ' and " in the WinWaitActive() command. the rest worked for me fine.1 point -
Include source after copmpiling
MuffinMan reacted to JLogan3o13 for a topic
Hi, LuxiVDN. This is how I do it, in case I do something stupid and delete my source (not that that ever happens) Using this method, the source file only gets put onto the machine when you want it, not every time you run the script. You can make the switch for your command line anything you would like. In this case, if you execute "MySource.exe" /Extract from the Run line, it will extract the source code and then exit without actually running through the script. If StringInStr($cmdlineRaw, "/Extract") Then FileInstall("C:MySource.au3", @TempDir & "MySource.au3", 1) Exit EndIf1 point -
AutoIT Server - TCPSend() and Payload won't run
twiztedshane reacted to qsek for a topic
There are lots of examples in the Examples Forum. A search for the terms "tcprecv server client" will get you some: I dont know why im the only one. I hope its because the other people feel that theres not much to add and that my help is sufficient for you1 point -
_arraysearch FindAll?
richietheprogrammer reacted to Melba23 for a topic
richietheprogrammer, Try changing the <<<<<<<<<<<<<<<<<<<<< line: #include <Array.au3> ; Declare an array to hold the instances Global $aListing[1][3] =[[0, 0, 0]] ; Simulate a CSV file $sCSV = "black colour,colour black,black cat,not_matched,blackbird,shoeblack" ; Define the test string to search for $sTest = "black" ; Start looking $iOffset = 1 While 1 ; Find next instance of the test string StringRegExp($sCSV, "(?i)" & $sTest, 1, $iOffset) If @error Then ExitLoop EndIf ; Note the point at which the next search should start $iOffset = @extended ; Now move back to the comma at the beginning of the word or the start of the string $iStart = $iOffset ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< While 1 $iStart -= 1 If $iStart = 0 Or StringMid($sCSV, $iStart, 1) = "," Then $iStart += 1 ExitLoop EndIf WEnd ; And now forward to the comma at the end of the word or the end of the string $iEnd = $iOffset - 1 While 1 $iEnd += 1 If $iEnd > StringLen($sCSV) Or StringMid($sCSV, $iEnd, 1) = "," Then $iEnd -= 1 ExitLoop EndIf WEnd ; Add to list $aListing[0][0] += 1 ReDim $aListing[$aListing[0][0] + 1][3] $aListing[$aListing[0][0]][0] = StringMid($sCSV, $iStart, $iEnd - $iStart + 1) $aListing[$aListing[0][0]][1] = $iStart $aListing[$aListing[0][0]][2] = $iEnd WEnd _ArrayDisplay($aListing) That works for me. M231 point -
Custom ListView - icons / checkboxes / multiline / edit in place
footswitch reacted to KaFu for a topic
I guess is a good start. Using UEZ's program you can embed more custom icons into the script.1 point -
one sqlite database to multiple autoit users
footswitch reacted to jchd for a topic
As I said, I've something much better in the works, but not yet ready for consumption. Anyway, keep in mind that reads (SELECTs) also need to read-lock the DB file: searching an index or doing a full table scan while another process is changing the DB under your feet would certainly be a very bad thing! Hence the locking semaphore file has to be used not only for writes (UPDATE, INSERT, CREATE, ALTER, REINDEX, ..., various pragmas). Note that the semaphore file is subject itself to the same locking issues than the DB, albeit at a slower pace and without the difference in locking types SQLite uses. So it isn't a perfectly failproof method either. What I and other say about all this is nonetheless overly pessimistic in many use cases. In practice, unless you're doing a heavy use of the DB from 20+ machines, you're unlikely to encounter corruption easily (modulo decent network reliability). But as the saying goes, better sad than sorry. Have a look and use this wrapper UDF to backup your DB at times. It will happily hot backup on the fly reliably (but backup restarts when a write is made, if using the default journaling mode). In any event, make good use of transactions to group statements that need to operate fast (bulk inserts) or as an atomic block (typically read-modify-write operations). Right after openning a DB connection, use _SQLite_SetTimeout with a (ms) value greater than the duration of the worst possible sequence of worst duration statements you might ever encounter. To make a long story short, don't hesitate to make it 5 or 10 minutes or much more if you need much more, meaning "wait forever, but not that much". Use BEGIN IMMEDIATE .. COMMIT transactions. With that, you are sure to never get SQLITE_BUSY nor risk a DB deadlock. This way, you don't even have to test for that. I'll do my best to come up with a better transparent and reliable LAN support but my current "half homeless" situation makes it difficult for me to work normally.1 point -
ListView row-by-row coloring (on-the-fly and with ListView UDF)
footswitch reacted to Spiff59 for a topic
I believe intercepting the WM_NOTIFY message and manipulating the ListView from that level is much easier? Maybe the following example will be of some use: #include <GuiConstants.au3> #include <GuiListView.au3> #include <WindowsConstants.au3> Global $hListView Global $Color[6][2] = [[0xFF00FF, 0xFFFFFF],[0x00FFFF, 0x808000],[0x008080, 0xFFFFFF],[0xFFFFFF, 0x000000],[0x0000FF, 0xC0C0C0]] GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") $Main_GUI = GuiCreate("", 800, 600, -1, -1) $hListView = GuiCtrlCreateListView("", 10, 10, 780, 580, -1, BitOR($LVS_EX_GRIDLINES, $LVS_EX_DOUBLEBUFFER, $LVS_EX_FULLROWSELECT)) ;$hListView = GUICtrlGetHandle($hListView) _GUICtrlListView_AddColumn($hListView, "TIME", 40) _GUICtrlListView_AddColumn($hListView, "CHART # ", 70) _GUICtrlListView_AddColumn($hListView, "PATIENT NAME ", 150) GUISetState() For $x = 0 to 4 _GUICtrlListView_AddItem($hListView, "TIME" & $x) _GUICtrlListView_AddSubItem($hListView, $x, "CHART" & $x, 1) _GUICtrlListView_AddSubItem($hListView, $x, "PATIENT" & $x, 2) Next While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ExitLoop EndSwitch Wend Exit ;------------------------------------------------------------------------------- Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $iwParam If IsHWnd($hListView) Then $hWndListView = $hListView Else $hWndListView = GUICtrlGetHandle($hListView) EndIf $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndListView Switch $iCode ; Case $LVN_ENDSCROLL ; Force redraw of gridlines lost when scrolling ; $tNMHDR = DllStructCreate("hwnd hWnd;uint cID;int code", $ilParam) ; $hLV = HWnd(DllStructGetData($tNMHDR, "hWnd")) ; _WinAPI_InvalidateRect($hLV) ; Case $NM_DBLCLK ; Process clicks ; $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam) ; $aHit = _GUICtrlListView_SubItemHitTest($hWndListView) ; $ahit[0] = row clicked, $ahit[1] = column clicked ; If $aHit[0] < 0 Then Return $GUI_RUNDEFMSG ; Switch $aHit[1] ; Case 1 ; ShellExecute($ScanPgm, Chr(34) & $PatientPath[$aHit[0]] & Chr(34)) ; EndSwitch Case $NM_CUSTOMDRAW Local $tCustDraw = DllStructCreate($tagNMLVCUSTOMDRAW, $ilParam) Local $iDrawStage = DllStructGetData($tCustDraw, "dwDrawStage") If $iDrawStage = $CDDS_PREPAINT Then Return $CDRF_NOTIFYITEMDRAW If $iDrawStage = $CDDS_ITEMPREPAINT Then Return $CDRF_NOTIFYSUBITEMDRAW Local $iItem = DllStructGetData($tCustDraw, "dwItemSpec") Local $iSubItem = DllStructGetData($tCustDraw, "iSubItem") $iColor = 0x000000 ; reset default $iColorBk = 0xFFFFFF ; reset default If $iItem = 4 Then ; row 4 $iColorBk = 0xC0C0C0 EndIf If $iSubItem = 1 Then ; column 1 $iColor = 0xFF0000 EndIf If $iSubItem = 2 Then ; column 2 $iColor = $Color[$iItem][0] $iColorBk = $Color[$iItem][1] EndIf DllStructSetData($tCustDraw, "clrTextBk", $iColorBk) DllStructSetData($tCustDraw, "clrText", $iColor) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc typos1 point