Leaderboard
Popular Content
Showing content with the highest reputation on 03/18/2016 in all areas
-
Version 1.6.3.0
17,288 downloads
Extensive library to control and manipulate Microsoft Active Directory. Threads: Development - General Help & Support - Example Scripts - Wiki Previous downloads: 30467 Known Bugs: (last changed: 2020-10-05) None Things to come: (last changed: 2020-07-21) None BTW: If you like this UDF please click the "I like this" button. This tells me where to next put my development effort1 point -
Chrome UDF
Velislav reacted to seangriffin for a topic
Chrome support for AutoIT is here! This UDF includes a Chrome Extension (http://developer.chrome.com/extensions/getstarted.html) and Native Messaging Host (http://developer.chrome.com/extensions/messaging.html#native-messaging-host) that integrate with a new Chrome UDF (Chrome.au3) to provide automation support for the Chrome browser. Several steps are required to install the Chrome Extension and Native Messaging Host prior to using the UDF. Please read the INSTALLATION section below. REQUIREMENTS: Windows XP 32-bit, Windows 7 32-bit or Windows 7 64-bit AutoIt3 3.2 or higher Chrome v29 or later (earlier versions are untested) AutoIT for Google Chrome (Chrome extension - see below) AutoIT Chrome Native Messaging Host (see below) INSTALLATION: STEP 1: Install the AutoIT extension into Chrome. Open the following link and download the file named AutoIT for Google Chrome.crx: https://docs.google.com/file/d/0B_6JmwNIIZ06enotRTVFNVdKOXM/edit?usp=sharing Note - you may be prompted to login with a Google account as this file is hosted on Google Drive. In your Chrome browser click on the Chrome menu, then select Tools -> Extensions. Drag the AutoIT for Google Chrome.crx file that you downloaded above, from Windows Explorer, into this page in Chrome. You should now see AutoIT for Google Chrome listed in the Extensions page in Chrome. Ensure that the Enabled checkbox next to AutoIT for Google Chrome is checked. Also make sure the Allow access to file URLs box is checked (very important to make EXAMPLE 2 work below)!! STEP 2: Install the AutoIT Chrome Native Messaging Host. Open the following link and download the file named autoit_chrome_native_messaging_host_install.exe: https://docs.google.com/file/d/0B_6JmwNIIZ06eDgxaVJPNUNxa28/edit?usp=sharing Note - you may be prompted to login with a Google account as this file is hosted on Google Drive. Run this file (autoit_chrome_native_messaging_host_install.exe). An installation window will display. Click the Install button. The window will display "Completed" and you can click the Close button. STEP 3: Install the Chrome UDF into AutoIT. Scroll to the DOWNLOAD section below, and save the Chrome.au3 file into your AutoIT Include folder (C:Program FilesAutoIt3Include). Please close your Chrome browser once you've completed these steps. LIST OF FUNCTIONS: EXAMPLE #1: This following example starts up Chrome and navigates to the URL http://www.december.com/html/demo/form.html. It then automatically completes the HTML form in this page (a series of text, radio, and checkbox input elements and select elements) and clicks the Send this survey button. The script waits for the next page to load, and retrieves the various elements from the page to the AutoIT console. chrome_example.au3 EXAMPLE #2: The following is an example of the automation of an offline HTML page (file URL). First, download the file named chrome_udf_example_2.html to your C: folder: https://docs.google.com/file/d/0B_6JmwNIIZ06SWduMjZGTVViNlU/edit?usp=sharing Then run the following AutoIT script: chrome_example_2.au3 Note that you must have checked the Allow access to file URLs box in the Chrome extension to make this work! DOWNLOAD: Latest Version - v0.5 (29/09/13) Chrome.au31 point -
Hi all, I work a lot with Opera Browser, and in some point i decided to write an UDFs Library to manipulate the most common tasks for Opera. Also because i am really tired from collecting pieces of functions/workarounds to do specific tasks. I must say that i worked on this library only one week, my knowledge of Opera Browser is very rich, i started (a couple of years ago) to learn programming (Bat, VBS, and then AutoIt) only because of my love to this Browser! The library can be downloaded from >archive on the forum. #CS Library Info/Header Name/Title: Opera.au3 / Opera Browser Automation UDF Library Description: Functions to handle some of the common routines for Opera Browser! Version: 1.07 Requirements: AutoIt 3.2.10.0 or higher. Note(s): This UDF Library tested on Opera versions: 8.54-9.5, 10.63.3516, few critical functions tested also on 11.x-12.x. Support Link: Author: Copyright © 2007 - 2013 CreatoR's Lab (G.Sandler), www.autoit-script.ru ToDo: * Add UDFs: _OperaFindHotkeyAction (search for hotkey by action) _OperaFindActionHotkey (search for action by hotkey) _OperaAddToolbarButton() _OperaRemoveToolbarButton() _OperaAddSkinIcon() -> Required 7zip/WinRar, or use system zipfolder. _OperaRemoveSkinIcon() -> Required 7zip/WinRar, or use system zipfolder. _OperaItemGetType() -> Returns IsItem, IsCommentedItem, IsSeperator, IsCommentedSeperator, IsCommentedLine History Version: v1.07 [04.Jun.2013] + Added _OperaGetDownloadsDir function. + Added _OperaGetSessionFiles function. + Added global $i_Opera_SearchAllDrives variable to allow profile dir detection on other drives. Usefull when installed more than one OS. + Added global $s_Opera_ProfileDir variable to specify custom profile dir (this variable should be empty if you need to use _OperaGetProfileDir). * Fixed few functions to work better with new Opera versions. * Fixed internal __Opera_GetOperaPageHandle function (used in public _OperaScreenCapture function). v1.06 [12.Jul.2012] * Fixed _OperaGetDir function: - To be compatible with x64 system. - Changed/expanded parameters, now used $iFlag to determine the function behavior, see function header for more details. * _OperaIsRuning function renamed to _OperaIsRunning. Old function name still supported. * Renamed internal functions to __Opera_*. v1.05 [08.Jul.2012] * Fixed _OperaGetTitle function, the title was incorrect if $sOpDir was specified and $iRet <> 2. * Fixed __Correct_Opera_Path internal function to replace back slashes (/). v1.04 [26.Jun.2011] * Fixed following functions to be more compatible with Opera 11.x: _OperaGetProfileDir _OperaMultiUserModeIsOn _OperaGetUserJSDir __Correct_Opera_Path * Fixed major bugs with recognizing Opera Dir (if $sOpDir parameter is passed as wrong Opera dir path). * Fixed _OperaGetUserJSDir function (now working better with relative pathes). * Renamed and changed _Opera_Integration_Example function. Now it's considered active function and named _Opera_Integration_Module. * Changed _OperaSelectFolder function. Added new optional parameter $hParent. * Changed _OperaAddMenuItem and _OperaRemoveMenuItem functions. Added new optional parameter $iBackup. * Fixed _OperaAddMenuItem function. Encoding issues. + Added _OperaGetCacheDir function. + Added optional $iGetLastInstallPath parameter to _OperaGetDir function. If this parameter is 1, then function will try to detect the last installed Opera path, instead of the path that Opera.exe was last time launched from. v1.03 [16.May.2011] * UDF renamed to Opera.au3. * Fixed _OperaScreenCapture function (now compatible with Opera 10.6, but still having an issue with capturing panels). * Fixed few major issues with getting preference file's pathes. * Fixed _OperaGetDir() function. * Fixed _OperaGetProfileDir() function (errors when getting profile dir on multiuser mode). * Changed _OperaFindDir function. - Now the $sInitPath parameter can accept pathes (delimited with "|"). - Now -1 as second parameter ($iRetCount) tels to the function to return all found Opera dirs. - Also the function now works faster. + Opera 10.6 support. + Added _OperaToggleMenuItemState function. + Added optional $sStandard_Name parameter to _OperaSetConfigFile function: If this parameter is a string (default is -1), then it's used as standard file name (instead of "standard_" & $sConfig_Prefix & ".ini"). v1.02 [03.Jul.2009] * Now compatible with AutoIt 3.3.0.0. + Opera 10 support. + Added _OperaGetBookmarksFile() function. + Added _OperaScreenCapture() function... ATTENTION: supported only for v3.2.10.0 or higher, due to (lack of) callback support. + Added _OperaAddMenuItem()/_OperaRemoveMenuItem() function. * Fixed few function to read relative paths in opera prefs file. v1.01 [5.Jan.2008] * Now compatible with AutoIt 3.2.10.0. * Variable names and spell corrections. + Added 2 more UDFs: _OperaRestart() _OperaMultiUserModeIsOn() v1.0 [28.Dec.2007] * First Release. Functions List: User's funcs... 1)_OperaFindDir 2)_OperaGetDir 3)_OperaGetDownloadsDir 4)_OperaGetVersion 5)_OperaGetTitle 6)_OperaGetProfileDir 7)_OperaGetMailDir 8)_OperaGetUserJSDir 9)_OperaGetPluginsDir 10)_OperaGetSessionFiles 11)_OperaGetSkinFile 12)_OperaGetLangFile 13)_OperaGetBookmarksFile 14)_OperaGetCacheDir 15)_OperaGetConfigFile 16)_OperaSetConfigFile 17)_OperaSetSkinFile 18)_OperaSetUserJSDir 19)_OperaSetLangFile 20)_OperaSelectFolder 21)_OperaAddMenuItem 22)_OperaRemoveMenuItem 23)_OperaIsRunning 24)_OperaRun 25)_OperaClose 26)_OperaKill 27)_OperaRestart 28)_OperaScreenCapture 29)_OperaMultiUserModeIsOn 30)_Opera_Integration_Example 31)_OpenGetURL 32)_OperaToggleMenuItemState internal funcs... 1)__Opera_WinGetTitleEx 2)__Opera_WinGetTitleByPID 3)__Opera_ProcessPathExists 4)__Opera_ProcessGetPath 5)__Opera_PathIsFolder 6)__Opera_PathIsOperaDir 7)__Opera_PathIsOperaProfileDir 8)__Opera_PathIsOperaConfigFile 9)__Opera_PathIsOperaLangFile 10)__Opera_PathIsOperaSkinFile 11)__Opera_PathIsOperaBookmarksFile 12)__Opera_PrefixStrIsOperaConfig 13)__Opera_ConfirmExitOperaWinExists 14)__Opera_Correct_Opera_Path 15)__Opera_GetOperaPIDs 16)__Opera_GetOperaPrefsFileName 17)__Opera_GetOperaPageHandle 18)__Opera_EnumOperaChildWindowsProc 19)__Opera_ExpandOperaMenuSectClassName 20)__Opera_Backup_Config 21)__Opera_FileNewName 22)__Opera_UTF8ToAnsi 23)__Opera_StringIsUTF8Format 24)__Opera_StringToUTF 25)__Opera_IniWriteToPos 26)__Opera_IniDeleteRegExp 27)__Opera_WinAPI_FindWindowEx 28)__Opera_WinAPI_GetClassName 29)__Opera_WinAPI_PathRemoveFileSpec 30)__Opera_WinAPI_AssocQueryString #CE P.S If this library will be usefull to many of you guys, i would like to here a feedback here, because then i will ask from Dev Team to add this library as Standard UDF Library, to be included in the AutoIt3 installset - and yes, if neccessary, i will make all needed resources as mention in the User Defined Functions Standards. Enjoy!1 point
-
I've been working on a script to upload files over HTTP, and in doing so needed a way to encode data to Base64. The following is AutoIt code ported from a VB5 program. Enjoy. Update: Thanks to gcriaco's asking, I've cleaned the code up so it should work as a standard UDF library. It's attached here as Base64.au3, and the example to show how it works is here as Base64_Example.au3. Thanks to griaco and trancexx for their help.1 point
-
Need a sample of how to find a picture and add a hypelink in a Word document.
Messy_Code_Guy reacted to water for a topic
Something like this. There is no error handling so it might crash if you do not use InlineShapes. #include <Word.au3> $oWord = _Word_Create() $oDoc = _Word_DocOpen($oWord, "C:\temp\test.docx") ; Set Picture 1 to Microsoft, Picture 2 to Google $oDoc.Hyperlinks.Add($oDoc.InlineShapes(1), "http://www.microsoft.com") $oDoc.Hyperlinks.Add($oDoc.InlineShapes(2), "http://www.google.com") ; Loop through the InlineShape collection and display the Hyperlinkfor each picture For $oShape In $oDoc.InlineShapes ConsoleWrite($oShape.Hyperlink.Address & @CRLF) Next1 point -
Hi. You can do this way. #include <IE.au3> #Region Login Youtube Local $oIE = _IECreate("https://accounts.google.com/ServiceLogin") Local $UserName = _IEGetObjById($oIE, "Email") Local $Next = _IEGetObjById($oIE, "next") _IEFormElementSetValue($UserName, "username") _IEAction($Next, "Click") Sleep(2000);just delay to wait for next fields Local $UserPass = _IEGetObjById($oIE, "Passwd") _IEFormElementSetValue($UserPass, "password") Local $signIn = _IEGetObjById($oIE, "signIn") _IEAction($signIn, "Click") _IELoadWait($oIE) _IENavigate($oIE,"http://www.youtube.com/") #EndRegion #Region Login yahoo Local $oIE = _IECreate("https://login.yahoo.com/config/login") Local $UserName = _IEGetObjById($oIE, "login-username") Local $Next = _IEGetObjById($oIE, "login-signin") _IEFormElementSetValue($UserName, "username") _IEAction($Next, "Click") Sleep(2000);just delay to wait for next fields Local $UserPass = _IEGetObjById($oIE, "login-passwd") _IEFormElementSetValue($UserPass, "password") Local $signIn = _IEGetObjById($oIE, "login-signin") _IEAction($signIn, "Click") _IELoadWait($oIE) #EndRegion Saludos1 point
-
1 point
-
Paste some code you already try and point why you think the code fail or where you think it fail. Otherwise look like you want people do the job for you and maybe nobody help you.1 point
-
Hi guys i am looking for any help with a .bat file i am working on. I am trying to extract few info from a file and dump into a text file (which i am able to do) i am stuck at the part of deleting few text from the output file. FINDSTR "\<vehicle>" c:\temp\1.xml >> result.txt which outputs the result as <vehicle>100</vehicle>. how can i delete <vehicle></vehicle> so that just 100 remains in the new file or new dump file i was trying FINDSTR /v <vehicle> c:\temp\result.txt >> fleet.txt which is not working any help will be really great full Thank you1 point
-
Image pick and place into grid
neazoi reacted to InunoTaishou for a topic
Just to add on to that. I used _GDIPlus_BitmapCloneArea($hBitmap, 0, 0, 101, 21) Because we've already drawn the string (and I drew it with a border, 101, 21). So I just copied the drawn area. You can just redraw the string each time if you want.1 point -
Image pick and place into grid
neazoi reacted to InunoTaishou for a topic
If you're wanting to draw a string Then you can use _GDIPlus_GraphicsDrawString or _GDIPlus_GraphicsDrawStringEx _GDIPlus_GraphicsDrawStringEx will draw a string to fit in a defined rectangle and only draw what will fit. I.e., if you just want the string to fit in a label that's 100px wide and 20px tall. _GDIPlus_GraphicsDrawString will draw the string until all of the letters are drawn. Here's a small snippit to get you going. I just used DrawString but you can use whichever you prefer. Also, I created my graphic a bit different in this example than the other. I created it using an HDC based off of a label I created. This lets me place all of my "stuff" only where the label is, instead of the whole GUI. I need to use this instead of CreateFromHwnd because of the input box. Since FromHwnd would have created a graphic object the size of the whole gui, whenever you draw any images it's going to cover up the input box. #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <WinAPI.au3> _GDIPlus_Startup() ; Width and Height of my work area Global const $iWidth = 380 Global Const $iHeight = 260 Global $hGUI = GUICreate("GDI+", 400, 300) Global $hInput = GUICtrlCreateInput("Custom String", 10, 10, 100, 20) Global $lblDc = GUICtrlCreateLabel("", 10, 30, $iWidth, $iHeight) Global $hDc = _WinAPI_GetWindowDC(GUICtrlGetHandle($lblDc)) Global $hGraphic = _GDIPlus_GraphicsCreateFromHDC($hDc) Global $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $hGraphic) Global $hBuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap) Global $hBitmapLabel = 0 GUIRegisterMsg($WM_COMMAND, WM_COMMAND) GUISetState(@SW_SHOW) DrawCustomLabel(GUICtrlRead($hInput)) While (True) Local $aCursorInfo Switch (GUIGetMsg()) Case $GUI_EVENT_CLOSE _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_Shutdown() GUIDelete($hGUI) Exit 0 Case $lblDc $aCursorInfo = GUIGetCursorInfo() If (Not @Error) Then If (_WinAPI_PtInRectEx($aCursorInfo[0], $aCursorInfo[1], 10, 30, 110, 130)) Then $hBitmapLabel = _GDIPlus_BitmapCloneArea($hBitmap, 0, 0, 101, 21) While ($aCursorInfo[2]) MoveLabel($aCursorInfo[0], $aCursorInfo[1], GUICtrlRead($hInput)) Sleep(100) $aCursorInfo = GUIGetCursorInfo() WEnd EndIf EndIf EndSwitch WEnd Func MoveLabel(Const ByRef $iNewX, Const ByRef $iNewY, Const ByRef $sText) DrawCustomLabel($sText) ; Draw it 10px to the left and 30px up because my work area is based off the position of the $lblDc label. Which is 10px right and 30px down. _GDIPlus_GraphicsDrawImage($hGraphic, $hBitmapLabel, $iNewX - 10, $iNewY - 30) EndFunc Func DrawCustomLabel(Const ByRef $sText) _GDIPlus_GraphicsClear($hBuffer, 0xFFF0F0F0) _GDIPlus_GraphicsDrawString($hBuffer, $sText, 0, 5) _GDIPlus_GraphicsDrawRect($hBuffer, 0, 0, 100, 20) _GDIPlus_GraphicsDrawImage($hGraphic, $hBitmap, 0, 0) EndFunc Func WM_COMMAND($hWndFrom, $iMsg, $wParam, $lParam) Local $iCode = _WinAPI_HiWord($wParam) Local $iIdFrom = _WinAPI_LoWord($wParam) Switch ($hWndFrom) Case $hGUI Switch ($iIdFrom) Case $hInput Switch ($iCode) Case $EN_CHANGE DrawCustomLabel(GUICtrlRead($hInput)) EndSwitch EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND I'm rushed for time but if you have questions post and I or someone else will answer.1 point -
Closing tabs with middle-click
masterlink950 reacted to InunoTaishou for a topic
Idk, I feel like you're making it harder than it needs to be. There's nothing wrong with checking mouse coords for something if it works! I was at work all day and came home to see a question that looked enticing I got carried away. Here's the solution to your dilemma. I even included all of the possible windows messages you can get from the Window procedure for our tab control (There are like 3 values that I got that I could not find in the WindowsConstants.au3 file, even did a global search in the #include folder and didn't find it) #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GUITab.au3> #include <WinApi.au3> #include <WinAPIGdi.au3> Global $hGUI = GUICreate("Window with Tabs", 500, 500) Global $lblId = GUICtrlCreateLabel("Hovering over tab index: N/A | N/A", 190, 4, 200, 20) GUICtrlSetFont(-1, 8, 400, "", "Segoe UI") Global $tabMainTab = GUICtrlCreateTab(10, 30, 480, 480) Global $hWndTab = GUICtrlGetHandle($tabMainTab) Global $hWndProc = DllCallbackRegister("NewWndProc", "ptr", "hwnd;uint;wparam;lparam") Global $pOldWndProc = _WinAPI_SetWindowLong($hWndTab, $GWL_WNDPROC, DllCallbackGetPtr($hWndProc)) Global $iTabItems = 13 For $i = 0 To $iTabItems GUICtrlCreateTabItem("Tab " & $i) GUICtrlCreateButton("Button " & $i, 20, 100, 80, 30) Next GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd Func NewWndProc($hWndFrom, $iMsg, $wParam, $lParam) #forceref $hWndFrom, $iMsg, $wParam, $lParam ; Struct that can be used to get information for SOME of the Windows Messages below ; Use caution, using the $iCode or $iIdFrom on the wrong windows message will break your code. ; It's best to initialize them INSIDE the Switch ($iMsg) below. ; Check the URL to see what values you can get from the $lParam and $wParam Local $tNMHDR = DllStructCreate($tagNMHDR, $lParam) ;Local $iCode = DLLStructGetData($tNMHDR, "Code") ;Local $iIdFrom = DLLStructGetData($tNMHDR, "IDFrom") ; Only valid on mouse functions Local $iMouseX = _WinAPI_LoWord($lParam) Local $iMouseY = _WinAPI_HiWord($lParam) Switch ($hWndFrom) Case $hWndTab Switch ($iMsg) Case $WM_LBUTTONDOWN ; https://msdn.microsoft.com/en-us/library/windows/desktop/ms645607(v=vs.85).aspx Case $WM_LBUTTONUP ; https://msdn.microsoft.com/en-us/library/windows/desktop/ms645608%28v=vs.85%29.aspx Case $WM_RBUTTONDOWN ; https://msdn.microsoft.com/en-us/library/windows/desktop/ms646242(v=vs.85).aspx Case $WM_RBUTTONUP ; https://msdn.microsoft.com/en-us/library/windows/desktop/ms646243%28v=vs.85%29.aspx Case $WM_MBUTTONDOWN ; https://msdn.microsoft.com/en-us/library/windows/desktop/ms645610(v=vs.85).aspx Case $WM_MBUTTONUP ; https://msdn.microsoft.com/en-us/library/windows/desktop/ms645611%28v=vs.85%29.aspx For $i = 0 To $iTabItems Local $aTabRect = _GUICtrlTab_GetItemRect($hWndTab, $i) If (Not @error) Then If (_WinAPI_PtInRectEx($iMouseX, $iMouseY, $aTabRect[0], $aTabRect[1], $aTabRect[2], $aTabRect[3])) Then ConsoleWrite("Deleting tab index: " & $i & " | Tab text: " & _GUICtrlTab_GetItemText($hWndTab, $i)) _GUICtrlTab_DeleteItem($hWndTab, $i) $iTabItems -= 1 ExitLoop EndIf EndIf Next Case $WM_MOUSEMOVE ; https://msdn.microsoft.com/en-us/library/windows/desktop/ms645616%28v=vs.85%29.aspx For $i = 0 To $iTabItems Local $aTabRect = _GUICtrlTab_GetItemRect($hWndTab, $i) If (Not @error) Then If (_WinAPI_PtInRectEx($iMouseX, $iMouseY, $aTabRect[0], $aTabRect[1], $aTabRect[2], $aTabRect[3])) Then ExitLoop EndIf Next GUICtrlSetData($lblId, "Hovering over tab index: " & $i & " | " & _GUICtrlTab_GetItemText($hWndTab, $i)) Case $WM_NCHITTEST ; https://msdn.microsoft.com/en-us/library/windows/desktop/ms645618%28v=vs.85%29.aspx Case $WM_SETCURSOR ; https://msdn.microsoft.com/en-us/library/windows/desktop/ms648382%28v=vs.85%29.aspx Case $WM_PAINT ; https://msdn.microsoft.com/en-us/library/windows/desktop/dd145213(v=vs.85).aspx Case $WM_MOUSELEAVE ; https://msdn.microsoft.com/en-us/library/windows/desktop/ms645615%28v=vs.85%29.aspx GUICtrlSetData($lblId, "Hovering over tab index: N/A | N/A") Case $WM_MOUSEACTIVATE ; https://msdn.microsoft.com/en-us/library/windows/desktop/ms645612%28v=vs.85%29.aspx Case $WM_NOTIFY ; https://msdn.microsoft.com/en-us/library/windows/desktop/bb775583%28v=vs.85%29.aspx Case $WM_NOTIFYFORMAT ; https://msdn.microsoft.com/en-us/library/windows/desktop/bb775584(v=vs.85).aspx Case $WM_UPDATEUISTATE ; https://msdn.microsoft.com/en-us/library/windows/desktop/ms646361%28v=vs.85%29.aspx Case $WM_GETDLGCODE ; https://msdn.microsoft.com/en-us/library/windows/desktop/ms645425%28v=vs.85%29.aspx Case $WM_IME_SETCONTEXT ; https://msdn.microsoft.com/en-us/library/windows/desktop/dd374142(v=vs.85).aspx Case $WM_SETFOCUS ; https://msdn.microsoft.com/en-us/library/windows/desktop/ms646283(v=vs.85).aspx Case $WM_ERASEBKGND ; https://msdn.microsoft.com/en-us/library/windows/desktop/ms648055%28v=vs.85%29.aspx Case $WM_NCPAINT ; https://msdn.microsoft.com/en-us/library/windows/desktop/dd145212%28v=vs.85%29.aspx Case 0x001308, 0x00130A, 0x002006, 0x00133E, 0x00130C, 0x000129, 0x000210 ; Unknown messages that are constantly sent to the tab control but could not identify in WindowsConstants.au3 Case 0x00133C ; Unknown message sent to the tab control when highlighting an item Case Else ConsoleWrite('[' & @HOUR & ":" & @MIN & ":" & @SEC & ":" & @MSEC & "] Unknown Message: 0x" & Hex($iMsg, 6) & @LF & "############################################" & @LF) EndSwitch EndSwitch Return _WinAPI_CallWindowProc($pOldWndProc, $hWndFrom, $iMsg, $wParam, $lParam) EndFunc ;==>NewWndProc Also, I didn't actually test it but I'm guessing _GUICtrlTab_GetItemRect is just the same as _WinApi_GetRect which will get the rect of a given handle. Can be used on buttons, edits, etc. And since tab items are really just buttons1 point -
Closing tabs with middle-click
masterlink950 reacted to InunoTaishou for a topic
Tab of what? Could you post the code you've tried?1 point -
Activate Screen Saver after Locking Workstation
Shadeclan reacted to ViciousXUSMC for a topic
All I do is check "On resume, display logon screen" in my screen saver settings. This effectively locks the computer if your screen saver starts. My script is them simply, launch screensaver. #Include <WinAPI.au3> #Include <WindowsConstants.au3> Global Const $SC_SCREENSAVE = 0XF140 _SendMessage(_WinAPI_GetDesktopWindow(), $WM_SYSCOMMAND, $SC_SCREENSAVE, 0)1 point -
1 point
-
be careful. >> causes output to append to a file. > overwrites the contents of a file. If you only use >> your file will grow, and grow, and grow. You should still use > for the netsh dump and >> for ipconfig to create a "fresh" file each run.1 point
-
First thanks for this code i used for a long time this code successfully in my Tool, but unfortunately it has limits, if you put them large files (such as an ISO 5GB) crashes or returns Wrong Hash, in web there are thousands of examples and threads, when everything very simple ehhhh https://msdn.microsoft.com/en-us/library/windows/desktop/aa382380(v=vs.85).aspx If Not IsDeclared("arDllCall") Then Global Static $arDllCall Global Const $hKernel32DLL = DllOpen("Kernel32.dll") Global Const $hAdvapi32Dll = DllOpen("AdvApi32.dll") Func _MD5ForFile($sFile) $arDllCall = DllCall($hKernel32DLL, "hwnd", "CreateFileW", "wstr", $sFile, "dword", 0x80000000, "dword", 3, "ptr", 0, "dword", 3, "dword", 0x80, "ptr", 0) If @Error Or $arDllCall[0] = -1 Then Return SetError(1, 0, "") EndIf Local $hFile = $arDllCall[0] $arDllCall = DllCall($hAdvapi32Dll, "int", "CryptAcquireContextW", "ULONG_PTR*", 0, "ptr", 0, "ptr", 0, "dword", 1, "dword", 0xF0000000) ; CRYPT_VERIFYCONTEXT If @Error Or Not $arDllCall[0] Then DllCall($hKernel32DLL, "int", "CloseHandle", "hwnd", $hFile) Return SetError(3, 0, "") EndIf Local $hContext = $arDllCall[1] $arDllCall = DllCall($hAdvapi32Dll, "int", "CryptCreateHash", "ULONG_PTR", $hContext, "dword", 0x00008003, "ptr", 0, "dword", 0, "ULONG_PTR*", 0) If @Error Or Not $arDllCall[0] Then DllCall($hAdvapi32Dll, "int", "CryptReleaseContext", "ULONG_PTR", $hContext, "dword", 0) DllCall($hKernel32DLL, "int", "CloseHandle", "hwnd", $hFile) Return SetError(3, 0, "") EndIf Local $hHashMD5 = $arDllCall[5], $bSucceeded = 1, $Buffer = DllStructCreate("byte[65535]") While $bSucceeded $arDllCall = DllCall($hKernel32DLL, "BOOL", "ReadFile", "HANDLE", $hFile, "ptr", DllStructGetPtr($Buffer), "dword", 65535, "dword*", 0, "ptr", Null) If @Error Or $arDllCall[4] = 0 Then ExitLoop $bSucceeded = $arDllCall[0] $arDllCall = DllCall($hAdvapi32Dll, "int", "CryptHashData", "ULONG_PTR", $hHashMD5, "struct*", $Buffer, "dword", $arDllCall[4], "dword", 0) If @Error Or Not $arDllCall[0] Then DllCall($hAdvapi32Dll, "int", "CryptDestroyHash", "ULONG_PTR", $hHashMD5) DllCall($hAdvapi32Dll, "int", "CryptReleaseContext", "ULONG_PTR", $hContext, "dword", 0) DllCall($hKernel32DLL, "int", "CloseHandle", "hwnd", $hFile) Return SetError(4, 0, "") EndIf WEnd If Not $bSucceeded Then DllCall($hAdvapi32Dll, "int", "CryptDestroyHash", "ULONG_PTR", $hHashMD5) DllCall($hAdvapi32Dll, "int", "CryptReleaseContext", "ULONG_PTR", $hContext, "dword", 0) DllCall($hKernel32DLL, "int", "CloseHandle", "hwnd", $hFile) Return SetError(5, 0, "") EndIf Local $tOutMD5 = DllStructCreate("byte[16]") $arDllCall = DllCall($hAdvapi32Dll, "int", "CryptGetHashParam", "ULONG_PTR", $hHashMD5, "dword", 2, "ptr", DllStructGetPtr($tOutMD5), "dword*", 16, "dword", 0) If @Error Or Not $arDllCall[0] Then DllCall($hAdvapi32Dll, "int", "CryptDestroyHash", "ULONG_PTR", $hHashMD5) DllCall($hAdvapi32Dll, "int", "CryptReleaseContext", "ULONG_PTR", $hContext, "dword", 0) DllCall($hKernel32DLL, "int", "CloseHandle", "hwnd", $hFile) Return SetError(6, 0, "") EndIf Local $sSHA1 = Hex(DllStructGetData($tOutMD5, 1)) DllCall($hAdvapi32Dll, "int", "CryptDestroyHash", "ULONG_PTR", $hHashMD5) DllCall($hAdvapi32Dll, "int", "CryptReleaseContext", "ULONG_PTR", $hContext, "dword", 0) DllCall($hKernel32DLL, "int", "CloseHandle", "hwnd", $hFile) Return SetError(0, 0, $sSHA1) EndFunc Func _SHA1ForFile($sFile) $arDllCall = DllCall($hKernel32DLL, "hwnd", "CreateFileW", "wstr", $sFile, "dword", 0x80000000, "dword", 3, "ptr", 0, "dword", 3, "dword", 0x80, "ptr", 0) If @Error Or $arDllCall[0] = -1 Then Return SetError(1, 0, "") EndIf Local $hFile = $arDllCall[0] $arDllCall = DllCall($hAdvapi32Dll, "int", "CryptAcquireContextW", "ULONG_PTR*", 0, "ptr", 0, "ptr", 0, "dword", 1, "dword", 0xF0000000) ; CRYPT_VERIFYCONTEXT If @Error Or Not $arDllCall[0] Then DllCall($hKernel32DLL, "int", "CloseHandle", "hwnd", $hFile) Return SetError(2, 0, "") EndIf Local $hContext = $arDllCall[1] $arDllCall = DllCall($hAdvapi32Dll, "int", "CryptCreateHash", "ULONG_PTR", $hContext, "dword", 0x00008004, "ptr", 0, "dword", 0, "ULONG_PTR*", 0) If @Error Or Not $arDllCall[0] Then DllCall($hAdvapi32Dll, "int", "CryptReleaseContext", "ULONG_PTR", $hContext, "dword", 0) DllCall($hKernel32DLL, "int", "CloseHandle", "hwnd", $hFile) Return SetError(3, 0, "") EndIf Local $hHashSHA1 = $arDllCall[5], $bSucceeded = 1, $Buffer = DllStructCreate("byte[65535]") While $bSucceeded $arDllCall = DllCall($hKernel32DLL, "BOOL", "ReadFile", "HANDLE", $hFile, "ptr", DllStructGetPtr($Buffer), "dword", 65535, "dword*", 0, "ptr", Null) If @Error Or $arDllCall[4] = 0 Then ExitLoop $bSucceeded = $arDllCall[0] $arDllCall = DllCall($hAdvapi32Dll, "int", "CryptHashData", "ULONG_PTR", $hHashSHA1, "struct*", $Buffer, "dword", $arDllCall[4], "dword", 0) If @Error Or Not $arDllCall[0] Then DllCall($hAdvapi32Dll, "int", "CryptDestroyHash", "ULONG_PTR", $hHashSHA1) DllCall($hAdvapi32Dll, "int", "CryptReleaseContext", "ULONG_PTR", $hContext, "dword", 0) DllCall($hKernel32DLL, "int", "CloseHandle", "hwnd", $hFile) Return SetError(4, 0, "") EndIf WEnd If Not $bSucceeded Then DllCall($hAdvapi32Dll, "int", "CryptDestroyHash", "ULONG_PTR", $hHashSHA1) DllCall($hAdvapi32Dll, "int", "CryptReleaseContext", "ULONG_PTR", $hContext, "dword", 0) DllCall($hKernel32DLL, "int", "CloseHandle", "hwnd", $hFile) Return SetError(5, 0, "") EndIf Local $tOutSHA1 = DllStructCreate("byte[20]") $arDllCall = DllCall($hAdvapi32Dll, "int", "CryptGetHashParam", "ULONG_PTR", $hHashSHA1, "dword", 2, "ptr", DllStructGetPtr($tOutSHA1), "dword*", 20, "dword", 0) If @Error Or Not $arDllCall[0] Then DllCall($hAdvapi32Dll, "int", "CryptDestroyHash", "ULONG_PTR", $hHashSHA1) DllCall($hAdvapi32Dll, "int", "CryptReleaseContext", "ULONG_PTR", $hContext, "dword", 0) DllCall($hKernel32DLL, "int", "CloseHandle", "hwnd", $hFile) Return SetError(6, 0, "") EndIf Local $sSHA1 = Hex(DllStructGetData($tOutSHA1, 1)) DllCall($hAdvapi32Dll, "int", "CryptDestroyHash", "ULONG_PTR", $hHashSHA1) DllCall($hAdvapi32Dll, "int", "CryptReleaseContext", "ULONG_PTR", $hContext, "dword", 0) DllCall($hKernel32DLL, "int", "CloseHandle", "hwnd", $hFile) Return SetError(0, 0, $sSHA1) EndFunc Ciao a tutti.1 point
-
Convert HTML to MHTML
mLipok reacted to andybiochem for a topic
Hi, I know this is a bit retro, but here is a simple way to embed images into HTML files to give MHTML 'archive' files. For me, this is useful because I am often called on to create various types of reports which often include images (graphs etc). It's much easier to send/email someone a single file rather than the report HTML and its images separately. This script will prompt for an input HTML file which it will then scan through for images, convert them to Base64, and write out to a .MHT file. The MHT file will contain both the HTML and the embedded images. _HTML_To_MHTML(FileOpenDialog("", ".", "(*.html;*.htm)")) Func _HTML_To_MHTML($sFileName) Local $i, $aFile ;----- Prepare MHT Header ----- Local $sMHTHold = 'From:' & @CRLF & _ 'Subject:' & @CRLF & _ 'Date:' & @CRLF & _ 'MIME-Version:' & @CRLF & _ 'Content-Type: multipart/related; type="text/html"; boundary="----=_NextPart"' & @CRLF & _ 'X-MimeOLE:' & @CRLF & _ @CRLF & _ '------=_NextPart' & @CRLF & _ 'Content-Type: text/html; charset="Windows-1252"' & @CRLF & @CRLF ; ;----- Open HTML & Convert Images ----- Local $sHTML = FileRead($sFileName) $sHTML = StringReplace($sHTML,"%20"," ") Local $sHTMLtemp = StringStripCR($sHTML) Local $aIMGImages = StringRegExp($sHTMLtemp, "<(?:img|IMG) [^>]*>", 3) Local $sMHTPost = "" ;MHT Footer For $i = 0 To UBound($aIMGImages) - 1 $aFile = StringRegExp($aIMGImages[$i], 'src="([^"]*)"', 1) $sHTML = StringReplace($sHTML, $aFile[0], "cid:" & $aFile[0]) $sMHTPost &= '------=_NextPart' & @CRLF & _ 'Content-Type: image' & @CRLF & _ 'Content-ID: <' & $aFile[0] & '>' & @CRLF & _ 'Content-Transfer-Encoding: base64' & @CRLF & _ @CRLF & _ _Base64Encode(FileRead($aFile[0])) & @CRLF & _ @CRLF ; Next ;----- Combine Header, HTML, & Footer ----- $sMHTHold &= $sHTML & @CRLF & $sMHTPost ;----- Prompt to save ----- $sSaveFile = FileSaveDialog("Save File", ".", "(*.mht)", Default, StringMid($sFileName, 1, StringInStr($sFileName, ".", -1) - 1)) If @error < 1 Then FileWrite($sSaveFile & ".mht", $sMHTHold) EndFunc ;==>_HTML_To_MHTML Func _Base64Encode($sData) ;by TurboV21 Local $oXml = ObjCreate("Msxml2.DOMDocument") Local $oElement = $oXml.createElement("b64") $oElement.dataType = "bin.base64" $oElement.nodeTypedValue = Binary($sData) Local $sReturn = $oElement.Text Return $sReturn EndFunc ;==>_Base64Encode Some caveats: - The HTML and images must exist on your PC, it won't pull images straight from the net - The saved file must be created in the SAME directory as the original HTML file - If your HTML file contains the string "%20" it will be converted to WS - ONLY images are embedded, any CSS PHP etc will still be dependent on external files - It won't pull images from javascript tags, only HTML <img > tags Please don't rely on this to successfully convert anything other than very simple HMTL files, it is designed to put simple images into basic HTML files. Credits: TurboV21 - for the Base64 encoder, which I butchered.1 point