Jump to content

Search the Community

Showing results for tags 'UDF'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Location


WWW


Interests

Found 149 results

  1. What is Rollbar? Rollbar provides real-time error alerting & debugging tools for developers. Learn more about it at https://rollbar.com/product/ Demo: https://rollbar.com/demo/demo/ Screenshot: Instructions: (RollbarTest.au3) ; Include RollbarSDK #include "RollbarSDK.au3" ;Turns on ConsoleWrite debugging override. ;Global $Rollbar_Debug=False ; Initialize RollbarSDK with the project's API key. ; Parameters ....: $__Rollbar_sToken - [Required] Go to https://rollbar.com/<User>/<ProjectName>/settings/access_tokens/ for your project. Use the token for post_server_item. _Rollbar_Init("eaa8464a4082eeabd9454465b8f0c0af") ; Write code that causes an error you want to catch, then call ; _Rollbar_Send ; Parameters ....: $__Rollbar_sErrorLevel - [Required] Must be one of the following values: Debug, Info, Warning, Error, Critical. ; $__Rollbar_sMessage - [Required] The message to be sent. This should contain any useful debugging info that will help you debug. ; $__Rollbar_sMessageSummary - [Optional] A string that will be used as the title of the Item occurrences will be grouped into. Max length 255 characters. If omitted, Rollbar will determine this on the backend. _Rollbar_Send("Debug", "This is an debug message. If you received this, you were successful!", "Debug Message") _Rollbar_Send("Info", "This is a test message. If you received this, you were successful!", "Info Message") _Rollbar_Send("Warning", "This is an warning message. If you received this, you were successful!", "Warning Message") _Rollbar_Send("Error", "This is an error message. If you received this, you were successful!", "Error Message") _Rollbar_Send("Critical", "This is an critical message. If you received this, you were successful!", "Critical Message") _Rollbar_Send("Info", "This is a test message. If you received this, you were successful!") ;No Message ; Rollbar_Send's helper functions ; Parameters ....: $__Rollbar_sMessage - [Required] The message to be sent. This should contain any useful debugging info that will help you debug. ; $__Rollbar_sMessageSummary - [Optional] A string that will be used as the title of the Item occurrences will be grouped into. Max length 255 characters. If omitted, Rollbar will determine this on the backend. _Rollbar_SendDebug("This is an debug message. If you received this, you were successful!", "Debug Message") _Rollbar_SendInfo("This is a test message. If you received this, you were successful!", "Info Message") _Rollbar_SendWarning("This is an warning message. If you received this, you were successful!", "Warning Message") _Rollbar_SendError("This is an error message. If you received this, you were successful!", "Error Message") _Rollbar_SendCritical("This is an critical message. If you received this, you were successful!", "Critical Message") ; Usable Example Local $sImportantFile = "C:\NOTAREALFILE_1234554321.txt" Switch FileExists($sImportantFile) Case True MsgBox(0, "Example Script", "An important file was found. Continuing...") Case Else _Rollbar_SendCritical('An important file was missing. Halting... File: "' & $sImportantFile & '"', 'Important file "' & $sImportantFile & '" is missing.') EndSwitch Notes: Please comment your feedback, advice, & suggestions below. While this is only a proof of concept, I will expand its feature set for everyone to use. Right now, it is fully functional but not tested in production. Changelog: RollbarSDK.au3 RollbarTest.au3 v0.2 v0.1.1
  2. Hi! I wrote an UDF that can simplify the way you can control Telegram Bot with AutoIt. If you don't know what is a Telegram Bot, maybe you should read their official website here. All about this UDF is on my GitHub: what is, how it work, how to use and also a Test.au3 to see the script in action. But... let's talk about this UDF. What is: It's an UDF that contain functions to control a Telegram Bot. Send messages, photo, video, stickers, wait for incoming messages and answer to them. How it works: Insert you Token given from BotFather, initialize your bot with _InitBot() function and... you're ready! All functions are commented: You will find a description of what it does, an explanation for every argument that function has need and what it return. This is the test script, that initialize your bot, run all functions and write the return value. #include "Telegram UDF.au3" $ChatID = "Your_Chat_ID_For_Test" _InitBot("Bot_ID","Bot_Token") ConsoleWrite("Test _GetUpdates -> " & @TAB & _GetUpdates() & @CRLF) ConsoleWrite("Test _GetMe -> " & @TAB & _GetMe() & @CRLF) ConsoleWrite("Test _SendMsg -> " & @TAB & _SendMsg($ChatID,"Test _SendMsg") & @CRLF) ConsoleWrite("Test _ForwardMsg -> " & @TAB & _ForwardMsg($ChatID,$ChatID,'MsgID') & @CRLF) ConsoleWrite("Test _SendPhoto -> " & @TAB & _SendPhoto($ChatID,"C:\image.jpg","Test _SendPhoto") & @CRLF) ConsoleWrite("Test _SendVideo -> " & @TAB & _SendVideo($ChatID,"C:\video.mp4","Test _SendVideo") & @CRLF) ConsoleWrite("Test _SendAudio -> " & @TAB & _SendAudio($ChatID,"C:\audio.mp3","Test _SendAudio") & @CRLF) ConsoleWrite("Test _SendDocument -> " & @TAB & _SendDocument($ChatID,"C:\document.txt","Test _SendDocument") & @CRLF) ConsoleWrite("Test _SendVoice -> " & @TAB & _SendVoice($ChatID,"C:\voice.ogg","Test _SendVoice") & @CRLF) ConsoleWrite("Test _SendSticker -> " & @TAB & _SendSticker($ChatID,"C:\sticker.webp") & @CRLF) ConsoleWrite("Test _SendLocation -> " & @TAB & _SendLocation($ChatID,"74.808889","-42.275391") & @CRLF) ConsoleWrite("Test _SendContact -> " & @TAB & _SendContact($ChatID,"0123456789","Josh") & @CRLF) ConsoleWrite("Test _SendChatAction -> " & @TAB & _SendChatAction($ChatID,"typing") & @CRLF) ConsoleWrite("Test _GetUserProfilePhotos -> " & @TAB & _GetUserProfilePhotos($ChatID) & @CRLF) ConsoleWrite("Test _GetChat -> " & @TAB & _GetChat($ChatID) & @CRLF) While 1 $msgData = _Polling() _SendMsg($msgData[2],$msgData[3]) WEnd Last part of the script (While cycle) use Polling function to put the script in a wait-state for incoming messages: _Polling() function return an array ($msgData in this case) that contain information about the received message (for example, $msgData[2] is the Chat ID of the user that send the message, important to send a reply. See GitHub page for other info. So, finally, here you can find and download the library -> https://github.com/xLinkOut/telegram-udf-autoit <- UPDATE: Thanks to @mLipok to added my Telegram UDF on AutoItScript Wiki! UPDATE 2: Functions that send files to Telegram Servers (photos, videos..) don't need anymore cURL executable file. Thanks to @Jos that suggested how to use WinHttp UDF by trancexx. If you have question, bug report or anything else just contact me or reply to this Thread Don't forget to follow me on GitHub for future updates. Bye!
  3. 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.au3
  4. I decided to enhance the functionality of the OOo COM UDF found >here and >here. Thanks to Leagnus and Andy G for providing the initial functions and framework. This UDF includes the following working functions: _OOoCalc_BookNew _OOoCalc_BookOpen _OOoCalc_BookAttach _OOoCalc_BookSave _OOoCalc_BookSaveAs _OOoCalc_BookClose _OOoCalc_WriteCell _OOoCalc_WriteFormula _OOoCalc_WriteFromArray _OOoCalc_HyperlinkInsert _OOoCalc_RangeMoveOrCopy _OOoCalc_RangeSort _OOoCalc_RangeClearContents _OOoCalc_CreateBorders _OOoCalc_NumberFormat _OOoCalc_ReadCell _OOoCalc_ReadSheetToArray _OOoCalc_RowDelete _OOoCalc_ColumnDelete _OOoCalc_RowInsert _OOoCalc_ColumnInsert _OOoCalc_SheetAddNew _OOoCalc_SheetDelete _OOoCalc_SheetNameGet _OOoCalc_SheetNameSet _OOoCalc_SheetList _OOoCalc_SheetActivate _OOoCalc_SheetSetVisibility _OOoCalc_SheetMove _OOoCalc_SheetPrint _OOoCalc_HorizontalAlignSet _OOoCalc_FontSetProperties _OOoCalc_CellSetColors _OOoCalc_RowSetColors _OOoCalc_ColumnSetColors _OOoCalc_RowSetProperties _OOoCalc_ColumnSetProperties _OOoCalc_FindInRange _OOoCalc_ReplaceInRange Please help me test this and let me know of any problems, questions, suggestions or comments you may have. Edit (August 5, 2016): Latest files have been uploaded. Script-breaking changes include renaming the functions to start with _OOoCalc_. Edit (November 14, 2016): New version, including fixed sort function! Edit (November 15, 2016): Lots of minor changes including tightening up the error checking. Edit (November 16, 2016): Added ByRef to object parameters. Edited demo. OOoCalcConstants.au3 OOoCalc.au3 OOoCalc_Demo.au3
  5. Hello! I was wondering why there are no UDFs (on this forum) for automating Adobe software. So, I decided to start writing one for Photoshop. Features: Creating, opening and saving documents Manipulating layer settings Applying effects to layers Now, the UDF is pretty limited, but my goal is to implement the whole Photoshop's VBScript interface. Have fun! Adobe Photoshop UDF
  6. GuiFlatButton is a UDF to easily create regular buttons with different colors for background, foreground, border, hover, focus, etc.. This started as an effort to change the background color of a button and eventually grew into a full UDF. If you've looked around forums for changing button background colors, you have probably noticed that each proposed workaround has its own set of issues/side-effects. The answers usually circle back to 'use ownerdrawn buttons' and 'not worth it'. Well, now it is possible for anyone to easily create ownerdrawn buttons - totally worth it! Some issues with other workarounds such as drawing with GDI+ or using a colored label as a 'button': Not 'real' buttons so you lose built-in functionality that windows gives to buttons Messy / inefficient code in the main while loop to check for mouse position Slow to respond to click, paint, etc... Having to deal with GUIRegisterMsg messages Not straight-forward to implement GuiFlatButton is not a workaround; it is a technique to respond to Windows' built-in owner-drawn button events. With minimal effort, we can now create true simple colored buttons. The idea is to create an owner-drawn button using GUICtrlCreateButton then subclass the GUI and controls to handle the button-specific events to paint it however we want. This UDF magically does all of this for us! No need to worry about event handling or main while loop logic. How to use It couldn't be any easier! Simply create a new button using the familiar syntax. This creates an ownerdrawn button with default colors. $mybutton1 = GuiFlatButton_Create("Button 1", 78, 20, 120, 40) If you want to change the background and text colors: GuiFlatButton_SetBkColor(-1, 0x5555FF) GuiFlatButton_SetColor(-1, 0xFFFFFF) Advanced Usage Set background/text/border all at once GuiFlatButton_SetColors(-1, 0x0000FF, 0xFFFFFF, 0x9999FF) Set ALL colors for ALL button states! (normal, focus, hover, selected) Local $aColorsEx = [0x0000FF, 0xFFFFFF, -2, 0x4444FF, 0xFFFFFF, 0xAAAAFF, 0x6666FF, 0xFFFFFF, 0xCCCCFF, 0x0000EE, 0xFFFFFF, 0x7777EE] GuiFlatButton_SetColorsEx(-1, $aColorsEx) Set default colors to apply to any future buttons ;set colors GuiFlatButton_SetDefaultColors(0x0000FF, 0xFFFFFF, 0x9999FF) ;create buttons $mybutton1 = GuiFlatButton_Create("Button 1", 12, 20, 120, 40) $mybutton2 = GuiFlatButton_Create("Button 2", 143, 20, 120, 40) Set ALL color defaults ;set colors Local $aColorsEx = [0x0000FF, 0xFFFFFF, -2, 0x4444FF, 0xFFFFFF, 0xAAAAFF, 0x6666FF, 0xFFFFFF, 0xCCCCFF, 0x0000EE, 0xFFFFFF, 0x7777EE] GuiFlatButton_SetDefaultColorsEx($aColorsEx) ;create buttons $mybutton1 = GuiFlatButton_Create("Button 1", 12, 20, 120, 40) $mybutton2 = GuiFlatButton_Create("Button 2", 143, 20, 120, 40) Available Functions Simple Example #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include "GuiFlatButton.au3" Example() ;GUI with one button Func Example() Local $hGUI, $mybutton1 $hGUI = GUICreate("GuiFlatButton Ex0", 275, 120) GUISetBkColor(0x333333) $idLabel = GUICtrlCreateLabel("Click the button", 10, 100, 150, 30) GUICtrlSetColor(-1, 0xFFFFFF) ;create new button then set the background and foreground colors $mybutton1 = GuiFlatButton_Create("Button 1", 78, 20, 120, 40) GuiFlatButton_SetBkColor(-1, 0x5555FF) GuiFlatButton_SetColor(-1, 0xFFFFFF) GUISetState(@SW_SHOW, $hGUI) Local $i = 0 Local $iMsg While 1 $iMsg = GUIGetMsg() Switch $iMsg Case $GUI_EVENT_CLOSE ExitLoop Case $mybutton1 $i += 1 GUICtrlSetData($idLabel, $i) ConsoleWrite($i & @CRLF) EndSwitch Sleep(10) WEnd GUIDelete() EndFunc ;==>Example Menu/Toolbar Example #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include "GuiFlatButton.au3" Example() ;Example GUI with toolbar Func Example() Local $hGUI, $idLabel, $aButtons, $iTbSize $hGUI = GUICreate("GuiFlatButton Ex2", 300, 200) GUISetBkColor(0x444444) $idLabel = GUICtrlCreateLabel("Click a button", 10, 180, 150, 30) GUICtrlSetColor(-1, 0xFFFFFF) $aButtons = createToolbar() $iTbSize = UBound($aButtons) GUISetState(@SW_SHOW, $hGUI) Local $i = 0 Local $iMsg While 1 $iMsg = GUIGetMsg() Switch $iMsg Case $GUI_EVENT_CLOSE ExitLoop Case $aButtons[0] To $aButtons[$iTbSize - 1] ConsoleWrite("1") GUICtrlSetData($idLabel, GuiFlatButton_Read($iMsg)) EndSwitch Sleep(10) WEnd GUIDelete() EndFunc ;==>Example Func createToolbar() Local $aButtons[6] Local $bkColor = 0x777777 Local $textColor = 0xFFFFFF Local $borderColor = 0x999999 Local $aBtnClrs[12] = [0x777777, 0xFFFFFF, $GUI_BKCOLOR_TRANSPARENT, 0x888888, 0xFFFFFF, $GUI_BKCOLOR_TRANSPARENT, 0x999999, 0xFFFFFF, $GUI_BKCOLOR_TRANSPARENT, 0x666666, 0xFFFFFF, $GUI_BKCOLOR_TRANSPARENT] For $i = 0 To UBound($aButtons) - 1 $aButtons[$i] = GuiFlatButton_Create("B" & $i, $i * 50, 0, 50, 17) GuiFlatButton_SetColorsEx($aButtons[$i], $aBtnClrs) Next Return $aButtons EndFunc ;==>createToolbar Icon Example You can even easily add icons to your buttons -- just create a new button and send it an icon! #include <GDIPlus.au3> #include "GuiFlatButton.au3" Example() ;buttons with Icon images Func Example() ;get images for demonstration _GDIPlus_Startup() ;initialize GDI+ Local $hIcon = _WinAPI_ShellExtractIcon(@SystemDir & '\shell32.dll', 258, 24, 24) ;extract the 'Save' icon Local $hBitmap = _GDIPlus_BitmapCreateFromHICON($hIcon) ;Create Bitmap from Icon (for demonstration) Local $hHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap) ;Create HBitmap from Bitmap _GDIPlus_BitmapDispose($hBitmap) ;dispose the bitmap _GDIPlus_Shutdown() ;done with GDI+ Local $hGUI = GUICreate("GuiFlatButton Ex5", 255, 400) GUISetBkColor(0xEEEEEE) ;set default colors of future buttons Local $aColorsEx = _ [0xE2E5E8, 0X000000, 0x888888, _ ; normal : Background, Text, Border 0xE2E5E8, 0X000000, 0x333333, _ ; focus : Background, Text, Border 0xE8E8E8, 0X000000, 0x666666, _ ; hover : Background, Text, Border 0xDDDDDD, 0X000000, 0xAAAAAA] ; selected : Background, Text, Border GuiFlatButton_SetDefaultColorsEx($aColorsEx) ;normal button with icon $label1 = GUICtrlCreateLabel( "$BS_TOOLBUTTON -->", 5, 10) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) Local $mybutton1 = GuiFlatButton_Create("Save", 130, 5, 50, 48, $BS_TOOLBUTTON) _WinAPI_DeleteObject(_SendMessage(GUICtrlGetHandle($mybutton1), $BM_SETIMAGE, $IMAGE_ICON, $hIcon)) ;align top Local $mybuttonT = GuiFlatButton_Create("Top", 5, 65, 120, 55, $BS_TOP) _WinAPI_DeleteObject(_SendMessage(GUICtrlGetHandle($mybuttonT), $BM_SETIMAGE, $IMAGE_ICON, $hIcon)) ;align top-left Local $mybuttonTL = GuiFlatButton_Create("Top-Left", 5, 125, 120, 55, BITOR($BS_TOP, $BS_LEFT)) _WinAPI_DeleteObject(_SendMessage(GUICtrlGetHandle($mybuttonTL), $BM_SETIMAGE, $IMAGE_ICON, $hIcon)) ;align top-right Local $mybuttonTR = GuiFlatButton_Create("Top-Right", 5, 185, 120, 55, BITOR($BS_TOP, $BS_RIGHT)) _WinAPI_DeleteObject(_SendMessage(GUICtrlGetHandle($mybuttonTR), $BM_SETIMAGE, $IMAGE_ICON, $hIcon)) ;align left Local $mybuttonL = GuiFlatButton_Create("Left", 5, 245, 120, 55, $BS_LEFT) _WinAPI_DeleteObject(_SendMessage(GUICtrlGetHandle($mybuttonL), $BM_SETIMAGE, $IMAGE_ICON, $hIcon)) ;align bottom Local $mybuttonB = GuiFlatButton_Create("Bottom", 130, 65, 120, 55, $BS_BOTTOM) _WinAPI_DeleteObject(_SendMessage(GUICtrlGetHandle($mybuttonB), $BM_SETIMAGE, $IMAGE_ICON, $hIcon)) ;align bottom-left Local $mybuttonBL = GuiFlatButton_Create("Bottom-Left", 130, 125, 120, 55, BITOR($BS_BOTTOM, $BS_LEFT)) _WinAPI_DeleteObject(_SendMessage(GUICtrlGetHandle($mybuttonBL), $BM_SETIMAGE, $IMAGE_ICON, $hIcon)) ;align bottom-right Local $mybuttonBR = GuiFlatButton_Create("Bottom-Right", 130, 185, 120, 55, BITOR($BS_BOTTOM, $BS_RIGHT)) _WinAPI_DeleteObject(_SendMessage(GUICtrlGetHandle($mybuttonBR), $BM_SETIMAGE, $IMAGE_ICON, $hIcon)) ;align right Local $mybuttonR = GuiFlatButton_Create("Right", 130, 245, 120, 55, $BS_RIGHT) _WinAPI_DeleteObject(_SendMessage(GUICtrlGetHandle($mybuttonR), $BM_SETIMAGE, $IMAGE_ICON, $hIcon)) GuiFlatButton_SetState($mybuttonR, $GUI_DISABLE ) ;disabled Local $mybuttonDisable = GuiFlatButton_Create("Disabled", 130, 310, 120, 55, $BS_TOOLBUTTON) _WinAPI_DeleteObject(_SendMessage(GUICtrlGetHandle($mybuttonDisable), $BM_SETIMAGE, $IMAGE_BITMAP, $hHBitmap)) GuiFlatButton_SetState($mybuttonDisable, $GUI_DISABLE ) ;clean up! _WinAPI_DestroyIcon( $hIcon ) _WinAPI_DeleteObject( $hHBitmap ) GUISetState(@SW_SHOW, $hGUI) Local $iMsg While 1 $iMsg = GUIGetMsg() Switch $iMsg Case $GUI_EVENT_CLOSE ExitLoop EndSwitch Sleep(10) WEnd GUIDelete() EndFunc ;==>Example I'm sure there are some use-cases I've forgotten, so feedback is welcome! Download the UDF and several more examples: GuiFlatButton_20190414.zip Update 2019-04-14 Fixed bug, not showing pressed down state when clicking rapidly Added Icon/Bitmap support! Added function GuiFlatButton_SetPos to change the position and/or size of a button Update 2019-02-09 Added 2 new functions to set the button colors globally for all future buttons. GuiFlatButton_SetDefaultColors GuiFlatButton_SetDefaultColorsEx Credits to: Melba23 (UDF template) LarsJ (general subclassing code) 4ggr35510n (TrackMouseEvent example) binhnx (disable dragging with $WS_EX_CONTROLPARENT) GUIRegisterMsg in AutoIt Help (owner-draw button example) funkey (_WinAPI_DrawState example)
  7. Hi all. Today I would like to introduce the beginning of the UDF. How to get started: http://winscp.net/eng/docs/library http://winscp.net/eng/docs/library_install Original readme_automation.txt: now I have only one function (standard FTP on standard port) to show the future possibilities: Local $oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc") Const Enum _ $__eWSCP_SO_Protocol_Sftp, _ $__eWSCP_SO_Protocol_Scp, _ $__eWSCP_SO_Protocol_Ftp Const Enum _ $__eWSCP_TO_TransferMode_Binary, _ $__eWSCP_TO_TransferMode_Ascii, _ $__eWSCP_TO_TransferMode_Automatic Example_PutFile('YOUR FTP HOST NAME', 'YOUR USER NAME', 'YOUR PASSWORD') Func Example_PutFile($sHostName, $sUserName, $sPassword) Local $sFileFullPath = StringReplace(@ScriptFullPath, '\', '\\') Local $sFilesToPut = StringReplace(@ScriptDir & '\*.au3', '\', '\\') ; based on: ; http://winscp.net/eng/docs/library_com_wsh#vbscript Local $oSessionOptions = ObjCreate("WinSCP.SessionOptions"); With $oSessionOptions .Protocol = $__eWSCP_SO_Protocol_Ftp .HostName = $sHostName; .UserName = $sUserName; .Password = $sPassword; ; below not jet tested ; .SshHostKeyFingerprint = "ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx" EndWith Local $oSession = ObjCreate("WinSCP.Session"); With $oSession ; Connect: Open sesion with defined options .Open($oSessionOptions); ; Set TransferOptions Local $oTransferOptions = ObjCreate("WinSCP.TransferOptions") $oTransferOptions.TransferMode = $__eWSCP_TO_TransferMode_Binary ; Upload files: put @ScriptFullPath to the ROOT directory Local $oTransferResult = .PutFiles($sFilesToPut, '/'); ; Throw on any error $oTransferResult.Check ; Print results For $oTransfer In $oTransferResult.Transfers ConsoleWrite("Upload of " & $oTransfer.FileName & " succeeded" & @CRLF) Next ;' Disconnect, clean up .Dispose() EndWith ; CleanUp $oSession = '' $oSessionOptions = '' EndFunc ;==>Example_PutFile Func _ErrFunc($oError) ; Do anything here. ConsoleWrite(@ScriptName & " (" & $oError.scriptline & ") : ==> COM Error intercepted !" & @CRLF & _ @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _ @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _ @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _ @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _ @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _ @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _ @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _ @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _ @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF) EndFunc ;==>_ErrFunc EDIT: 2014-06-20 04:47 - script changed
  8. I updated the UDF by Patric Pendelin to use the MemoryDLL UDF. There are only two new functions: _SevenZip_Load & _SevenZip_Free The first function must be called before using any other functions included in the UDF and the other should be called to free memory when the UDF is no longer needed! The size of binary from the module was excessive so I used the ZLMA UDF to compress it. It will be decompressed at run time before its loaded into memory. The only advantage of using this UDF is that it removes the need to included any DLLs in your script. A lot of functions haven't been added yet! For those that dare: The API for the 7-Zip32.dll module is included in the attachment. These functions work in the same way you would you use the standalone 7za.exe executable so the Help.chm file applies to these functions aswell. Thats it, Enjoy! The code below is a sneak peak at the actually UDF, meaning it dosen't work without the other includes and the embed binary. - Download the attachment. #include-once #include "MemoryDLL.au3" #include "LZMA.au3" Global $__7ZIPDLL = Default, $__7ZIPINIT = False #cs =============================================================================== Name: 7-Zip.au3 Version: 1.0 Datum: 08.07.2008 Author: Patric Pendelin eMail: <patric.pendelin (a) gmx.de> Modified By: Decipher Script Function: _SevenZip_Load() _SevenZip_Extract($s_Archive, $s_Out="", $s_Pass="", $szCmdLine="", $s_Overwrite="", $hwnd=0, $szOutput="NULL", $dwSize=0) Extracts files from an archive _SevenZip_Add($s_Archive, $s_Out = "", $s_Typ = "7z32", $i_Comp = 5, $s_Pass = "", $szCmdLine = "", $hwnd = 0, $szOutput = "NULL", $dwSize = 0) Add files to an archive _SevenZip_GetVersion() Get 7_zip32.dll Version _SevenZip_GetRunning() _SevenZip_CheckArchive($s_Archive, $i_iMode = 0) _SevenZip_GetArchiveType($s_Archive) _SevenZip_GetFileCount($s_Archive) _SevenZip_GetUDFVersion() Returns UDF version number _SevenZip_Free() #ce =============================================================================== Func _SevenZip_Load() If Not $__7ZIPINIT Then $__7ZIPDLL = MemoryDllOpen(__7ZIPBIN()) $__7ZIPINIT = True EndIf EndFunc Func _SevenZip_Free() If $__7ZIPINIT Then MemoryDllClose($__7ZIPDLL) $__7ZIPINIT = False $__7ZIPDLL = Default EndIf EndFunc ;=============================================================================== ; Function Name: _SevenZip_Extract ; Description: Extracts files from an archive ; ; Parameter(s): $s_Archive: Fullpath to Archive-File ; $s_Out: Specifies a destination directory where files are to be extracted. (Def. "") ; $s_Pass: Specifies password. (Def. "") ; $szCmdLine: Command Line Commands. (Def. "") ; $s_Overwrite: Specifies the overwrite mode during extraction, to overwrite files already present on disk. (Def. "") ; -1: Overwrite All existing files without prompt. ; -2: Skip extracting of existing files. ; -3: aUto rename extracting file (for example, name.txt will be renamed to name_1.txt). ; -4: auto rename existing file (for example, name.txt will be renamed to name_1.txt). ; $hwnd: The window handle of the application which calls 7-zip32.dll. (Def. 0) ; $szOutput: The buffer because 7-zip32.dll returns the result. (Def. "NULL") ; $dwSize: Größe des Puffers. When the result exceeds designated size, it is economized in this size. ; If size is 1 or more, always NULL letter is added lastly. (Def. 0) ; ; Syntax: _SevenZip_Extract($s_Archive, $s_Out="", $s_Pass="", $szCmdLine="", $s_Overwrite="", $hwnd=0, $szOutput="NULL", $dwSize=0) ; Return Value(s): On Success -Return 1 ; On Failure -@error ; Author(s): Patric Pendelin <patric.pendelin (a) gmx.de> ;=============================================================================== Func _SevenZip_Extract($s_Archive, $s_Out = "", $s_Pass = "", $szCmdLine = "", $s_Overwrite = "", $hwnd = 0, $szOutput = "NULL", $dwSize = 0) ; Set Output directory If $s_Out = "" Then Local $as_Res = StringSplit($s_Archive, "\") For $i = 1 To $as_Res[0] - 1 $s_Out &= $as_Res[$i] & "\" Next EndIf ; (Overwrite mode) switch: If $s_Overwrite = 1 Then $s_Overwrite = "-aoa"; Overwrite All existing files without prompt. ElseIf $s_Overwrite = 2 Then $s_Overwrite = "-aos"; Skip extracting of existing files. ElseIf $s_Overwrite = 3 Then $s_Overwrite = "-aou"; Auto rename extracting file (for example, name.txt will be renamed to name_1.txt). ElseIf $s_Overwrite = 4 Then $s_Overwrite = "-aot"; Auto rename existing file (for example, name.txt will be renamed to name_1.txt). EndIf If $szCmdLine = "" Then $szCmdLine = ' x "' & $s_Archive & '" ' & $s_Overwrite & ' -o"' & $s_Out & '" -p"' & $s_Pass & '"' Local $aRet = MemoryDllCall($__7ZIPDLL, "int", "SevenZip", "hwnd", $hwnd, "str", $szCmdLine, "str", $szOutput, "int", $dwSize) Return SetError(@error, "", $aRet[0]) EndFunc ;==> _SevenZip_Extract ;=============================================================================== ; Function Name: _SevenZip_Add ; Description: Extracts files from an archive ; ; Parameter(s): $s_Archive: Fullpath to Archive-File ; $s_Out: Specifies a destination directory where files are to be extracted. (Def. "") ; $s_Typ: Specifies the type of archive. ; $i_Comp: Sets level of compression. [0 | 1 | 3 | 5 | 7 | 9 ] ; $s_Pass: Specifies password. (Def. "") ; $szCmdLine: Command Line Commands. (Def. "") ; $hwnd: The window handle of the application which calls 7-zip32.dll. (Def. 0) ; $szOutput: The buffer because 7-zip32.dll returns the result. (Def. "NULL") ; $dwSize: Größe des Puffers. When the result exceeds designated size, it is economized in this size. ; If size is 1 or more, always NULL letter is added lastly. (Def. 0) ; ; Syntax: _SevenZip_Add($s_Archive, $s_Out = "", $s_Typ = "7z32", $i_Comp = 5, $s_Pass = "", $szCmdLine = "", $hwnd = 0, $szOutput = "NULL", $dwSize = 0) ; Return Value(s): On Success -Return 1 ; On Failure -@error ; Author(s): Patric Pendelin <patric.pendelin (a) gmx.de> ;=============================================================================== Func _SevenZip_Add($s_Archive, $s_Out = "", $s_Typ = "7z32", $i_Comp = 5, $s_Pass = "", $szCmdLine = "", $hwnd = 0, $szOutput = "NULL", $dwSize = 0) If $szCmdLine = "" Then If $s_Pass = "" Then $szCmdLine = '-t' & $s_Typ & ' a "' & $s_Archive & '" "' & $s_Out & '" -mx=' & $i_Comp Else $szCmdLine = '-t' & $s_Typ & ' a "' & $s_Archive & '" "' & $s_Out & '" -p"' & $s_Pass & '" -mhe=on -mx=' & $i_Comp EndIf EndIf Local $aRet = MemoryDllCall($__7ZIPDLL, "int", "SevenZip", "hwnd", $hwnd, "str", $szCmdLine, "str", $szOutput, "int", $dwSize) Return SetError(@error, "", $aRet[0]) EndFunc ;==> _SevenZip_Add ;=============================================================================== ; Function Name: _SevenZip_GetVersion ; Description: The version of 7-zip32.dll is returned. ; ; Parameter(s): None. ; ; Syntax: _SevenZip_GetVersion() ; Return Value(s): On Success -Return File Version ; On Failure -@error ; Author(s): Patric Pendelin <patric.pendelin (a) gmx.de> ;=============================================================================== Func _SevenZip_GetVersion() Local $aRet = MemoryDllCall($__7ZIPDLL, "int", "SevenZipGetVersion") Return SetError(@error, "", $aRet[0]) EndFunc ;==> _SevenZip_GetVersion ;=============================================================================== ; Function Name: _SevenZip_GetRunning ; Description: Whether or not presently 7-zip32.dll while operating, you obtain. ; Application side before executing API which by all means accompanies file access such as compressing/thawing, ; it is necessary to check whether because of this feasibility. ; ; Parameter(s): None. ; ; Syntax: _SevenZip_GetRunning() ; Return Value(s): On Success -Return 1(It is in the midst of executing.) ; Return 0(Is not in the midst of executing, (feasibility).) ; On Failure -@error ; Author(s): Patric Pendelin <patric.pendelin (a) gmx.de> ;=============================================================================== Func _SevenZip_GetRunning() Local $aRet = MemoryDllCall($__7ZIPDLL, "int", "SevenZipGetRunning") Return SetError(@error, "", $aRet[0]) EndFunc ;==> _SevenZip_GetRunning ;=============================================================================== ; Function Name: _SevenZip_CheckArchive ; Description: Whether or not presently 7-zip32.dll while operating, you obtain. ; As the archive file which the designated file supports ; It returns whether or not it is correct. ; ; Parameter(s): $s_Archive: Fullpath to Archive file ; ; Syntax: _SevenZip_CheckArchive($s_Archive) ; Return Value(s): On Success -Return 1 (At the time of correct archive file.) ; Return 0 (When the file is illegitimate.) ; On Failure -@error ; Author(s): Patric Pendelin <patric.pendelin (a) gmx.de> ;=============================================================================== Func _SevenZip_CheckArchive($s_Archive, $i_iMode = 0) Local $aRet = MemoryDllCall($__7ZIPDLL, "int", "SevenZipCheckArchive", "str", $s_Archive, "int", $i_iMode) Return SetError(@error, "", $aRet[0]) EndFunc ;==> _SevenZip_CheckArchive ;=============================================================================== ; Function Name: _SevenZip_GetArchiveType ; Description: Type of the archive file ; ; Parameter(s): $s_Archive: Fullpath to Archive file ; ; Syntax: _SevenZip_GetArchiveType($s_Archive) ; Return Value(s): On Success -Return 1 (ZIP type) ; Return 2 (7z32 type) ; On Failure -@error ; Author(s): Patric Pendelin <patric.pendelin (a) gmx.de> ;=============================================================================== Func _SevenZip_GetArchiveType($s_Archive) Local $aRet = MemoryDllCall($__7ZIPDLL, "int", "SevenZipGetArchiveType", "str", $s_Archive) Return SetError(@error, "", $aRet[0]) EndFunc ;==> _SevenZip_GetArchiveType ;=============================================================================== ; Function Name: _SevenZip_GetFileCount ; Description: Type of the archive file ; ; Parameter(s): $s_Archive: The number of files in the Archive file. ; ; Syntax: _SevenZip_GetFileCount($s_Archive) ; Return Value(s): On Success -Return Numer of files ; On Failure -@error 1: Can´t opens a DLL file for use in MemoryDllCall. ; @error 2: Error in MemoryDllCall ; ; Author(s): Patric Pendelin <patric.pendelin (a) gmx.de> ;=============================================================================== Func _SevenZip_GetFileCount($s_Archive) Local $aRet = MemoryDllCall($__7ZIPDLL, "int", "SevenZipGetFileCount", "str", $s_Archive) Return SetError(@error, "", $aRet[0]) EndFunc ;==> _SevenZip_GetFileCount #region ### BINARY ### Func __7ZIPBIN() #cs Name: 7-ZIP32 BINARY Version 9.20.00.02 Requirements: Windows9x/Me/NT/200x/XP/Vista/7 Author: Akita Minoru ( Http://Akky.Xrea.Jp/support.Html ) Download the Library: 7-Zip-Library.7z Basic Usage: #include "7-Zip.au3" _SevenZip_Load() Dim $sCommandLine = "Accepts Switches and etc" _SevenZip_Exec($sCommandLine) ; See the included 7-Zip.chm documentation _SevenZip_Free() Exit
  9. Hello! Microsoft Edge, the new browser released with Windows 10, uses Chakra as its JavaScript engine. In January, Microsoft released ChakraCore - the open source version of the engine that can be used in other apps. So, how about using it in AutoIt? I tried 2 times to create ChakraCore UDF, and I succeeded. So here it is - the ChakraCore UDF. Features: Executing JavaScript from AutoIt (obviously) Passing data from AutoIt to JavaScript Calling AutoIt functions from JavaScript ChakraCore UDF Have fun!
  10. Hi mates, well this is my first contribution. a simple UDF to use Virustotal API v2.0 The response return is not parsed|splitted. requires >WinHttp UDF Functions List: Update: Now a Only Function using a flags for respective mode. VT() Use respective flag($Type) VT(ByRef $aAPI, $Type, $sResource, $sAPIkey,$Comments="") flags($Type) $fReport = retrieve a scan report on a given file $fScan = submit a file for Scanning $fRescan = Rescan files in VirusTotal's file store $uReport = retrieve a scan report on a given URL $uScan = submit a URL for Scanning $Comment = Make a commnet on files and URLs Example: #include <Crypt.au3> #include "VT.au3" Example() Func Example() _Crypt_Startup() Local $sFilePath = @WindowsDir & "\Explorer.exe" Local $bHash = _Crypt_HashFile($sFilePath, $CALG_MD5) _Crypt_Shutdown() Local $hVirusTotal = VT_Open() Local $APIkey='Your API key' ConsoleWrite(VT($hVirusTotal, $fReport, '20c83c1c5d1289f177bc222d248dab261a62529b19352d7c0f965039168c0654',$APIkey) & @CRLF) ConsoleWrite(VT($hVirusTotal, $fScan, $sFilePath,$APIkey) & @CRLF) ConsoleWrite(VT($hVirusTotal, $fRescan, hex($bHash),$APIkey) & @CRLF) ConsoleWrite(VT($hVirusTotal, $uReport, "http://www.virustotal.com",$APIkey) & @CRLF) ConsoleWrite(VT($hVirusTotal, $uScan, "http://www.google.com",$APIkey) & @CRLF) ConsoleWrite(VT($hVirusTotal, $Comment, hex($bHash) ,$APIkey,"Hello Word | Hola Mundo") & @CRLF) VT_Close($hVirusTotal) ; EndFunc ;==>Example Saludos VT.au3
  11. This is an UDF that helps you use Font Awesome in your AutoIt project. Screenshot Download Click here to download! Usage/Example #NoTrayIcon #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> ; Font Icon UDF by Juno_okyo #include <font-icon.au3> Opt('GUIOnEventMode', 1) #Region ### START Koda GUI section ### Global $FormMain = GUICreate('Font Icon for AutoIt by Juno_okyo', 355, 126, -1, -1) GUISetFont(20, 400, 0, 'Arial') GUISetOnEvent($GUI_EVENT_CLOSE, 'FormMainClose') GUIStartGroup() Global $Label1 = GUICtrlCreateLabel('Juno_okyo', 25, 42, 155, 36) GUICtrlSetFont(-1, 24, 400, 0, 'Arial') ; See demo.html for Icon name Global $Label2 = GUICtrlCreateLabel(Font_Icon('icon-heart'), 193, 46, 35, 36) GUICtrlSetFont(-1, 20, 400, 0, 'juno_okyo') ; Font name GUICtrlSetColor(-1, 0xa83f39) ; Heart color ;) Global $Label3 = GUICtrlCreateLabel('AutoIt', 235, 42, 90, 36) GUICtrlSetFont(-1, 24, 400, 0, 'Arial') GUIStartGroup() GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 Sleep(100) WEnd Func FormMainClose() Exit EndFunc Credits Author: Juno_okyo Font Awesome by Dave Gandy Source code on GitHub. Contributing are welcome!
  12. Here the this wiki page with list of available UDFs for data compression. For my tasks I only need ZIP support, so I started looking at pure AutoIt UDFs without any 3rd party dlls. And found out that most of available realizations uses standard ("native method") Windows dll - "zipfldr.dll". So for now I chose ZIP UDF by wraithdu. I've tested it on Windows 7 (x64) and it seem works fine. But here the comment from another topic where user says that Windows 10 discontinued support of "zipfldr.dll". Now I confused. I don't have around any Windows 10 machine to tested it. So maybe someone could confirm or deny that? Or maybe would better to switch to UDF with 7zip dll? I need an advice...
  13. Hi All, In a recent project of mine I needed to send multiple message to an app on my Iphone called Prowl. Hopefully this will come in useful to someone. #Include-Once #include <WinHttp.au3> ; #INDEX# ========================================================================================= ; Title .........: Prowl UDF ; AutoIt Version : 3.3.8++ ; Language ..... : English ; Description ...: Functions for use with Prowl App (http://www.prowlapp.com/) API ; Author(s) .....: mrflibblehat (danielcarroll@gmail.com) ; ================================================================================================= ; #GLOBALS# ======================================================================================= Global Const $vProwl = "api.prowlapp.com" ;~ Prowl API Site Global $vOpen = 0, $vConnect = 0 ; ================================================================================================= ; #CURRENT# ======================================================================================= ;_Prowl_Open ;_Prowl_Close ;_ProwlAdd ; ================================================================================================= ; #FUNCTION# ==================================================================================================================== ; Name...........: _Prowl_Open ; Description ...: Create Session and Connection Handle ; Syntax.........: _Prowl_Open ; Return values .: Failure - Returns 0 and Sets @Error: ; |@error = 1 - Error Opening WinHTTP Handle ; |@error = 2 - Error Opening WinHTTPConnect Handle ; Author ........: mrflibblehat (danielcarroll@gmail.com) ; =============================================================================================================================== Func _Prowl_Open() $vOpen = _WinHttpOpen() if (@error) then Return SetError(1, 0, "Error Opening WinHTTP Handle") $vConnect = _WinHttpConnect($vOpen, $vProwl) if (@error) then Return SetError(2, 0, "Error Opening WinHTTPConnect Handle") EndFunc ; #FUNCTION# ==================================================================================================================== ; Name...........: _Prowl_Close ; Description ...: Close Session and Connection Handle ; Syntax.........: _Prowl_Close ; Author ........: mrflibblehat (danielcarroll@gmail.com) ; =============================================================================================================================== Func _Prowl_Close() _WinHttpCloseHandle($vConnect) _WinHttpCloseHandle($vOpen) EndFunc ; #FUNCTION# ==================================================================================================================== ; Name ..........: _ProwlAdd ; Description ...: ; Syntax ........: _ProwlAdd($vAPIKey, $vEvent, $vDescription[, $vPriority = 0[, $vApplicationName = "Prowl 4 AutoIT"[, $vProviderKey = ""[, $vURL = ""]]]]) ; Parameters ....: $vAPIKey - Prowl API Key ; $vEvent - Name of Event. ; $vDescription - Message to Send. ; $vPriority - [optional] Priority of Message. Default is 0 - Normal. -2 - Very Low | -1 - Moderate | 0 - Normal | 1 - High | 2 - Emergency ; $vApplicationName - [optional] Application Name. Default is "Prowl 4 AutoIT" ; $vProviderKey - [optional] Your provider API key. Only necessary if you have been whitelisted. Default is "". ; $vURL - [optional] Requires Prowl 1.2 The URL which should be attached to the notification. Default is "". ; Return values .: XML response from server ; Author ........: mrflibblehat (danielcarroll@gmail.com) ; =============================================================================================================================== Func _ProwlAdd($vAPIKey, $vEvent, $vDescription, $vPriority = 0, $vApplicationName = "Prowl 4 AutoIT", $vProviderKey = "", $vURL = "") Local $sData = ("apikey=" & $vAPIKey & "&application=" & $vApplicationName & "&event=" & $vEvent & "&description=" & $vDescription & "&priority=" & $vPriority & "&providerkey=" & $vProviderKey & "&url=" & $vURL) Local $vRequest = _WinHttpSimpleRequest($vConnect, "POST", "/publicapi/add/", $WINHTTP_NO_REFERER, $sData, "Content-Type: application/x-www-form-urlencoded") if (@error) then Return SetError(3, 0, "Unable To Send Request") Return $vRequest EndFunc Example #include <ProwlUDF.au3> Global $vApiKey = "PUT API KEY HERE" _Prowl_Open() _ProwlAdd($vApiKey, "Test", "Test Message") _Prowl_Close()
  14. As the Active Directory UDF - Help & Support thread has grown too big, I start a new one. The original thread can be found here.
  15. Version 3: Ops, you may ask, where's the version 2? The answer is, you will never see it. I skipped it to jump to version 3 directly. Why? Actually, I didn't learn M$ about that versioning The reason is, I planed to write version 2, using the new window/control handle indexing technique to eliminate all the ugly and slow loop. But when nearly finish, I feel so tired, tired of using a lots of all workaround. And finally, I decided to rewrite entire the UDF, using the direct solution, the way all other languages used, and should use. I late some day, because of some machine code (it's actually not so necessary, but if the control is doing an expensive task, like heavy drawing then passing all the Window Message to AutoIt is not a so good idea because its slow speed may result in some annoying-small-but-easy-to-figure-out problems, (like tearing as example). So I use machine code directly to pass over it. Now you have not a Stupid but a Smart UDF And it's still simple. API change: Remove a parameter from _SSCtrlHover_Register. You nolonger can attach other controls to the registered control. Use another method to do it and when you delete the control be sure to delete all the attached controls yourself. This breaks your old script. Add double click event (last 2 parameters of _SSCtrlHover_Register) Remove the _SSCtrlHover_Delete. You must manually delete yourself. It's easy with GUICtrlDelete and I decide not to duplicate this function to my UDF (be sure to delete your attached control too) This version eliminate all the odd limit of old version, include: No:longer use timer/adlib to test the control is on mouse event. Now it directly use native WinAPI method to provide a truly event-driven way. Every click is detected, every mouse hover/left, is handled perfectly. Fast and very fast. All the loop is eliminated. Machine code. Execute speed is much much improved. (read as: nano seconds instead of milliseconds ) I documented it quite well so if you want you can easily browse it and change it the way you want. Now you can use in both GUIGetMsg() loop mode or event mode. No longer setting constants like before because it works perfectly in both mode. Cheer Remark: I don't include <WinAPI.au3> and <WinAPIShellEx.au3> in my UDF, because those UDF is very large and it will consume much more memory when you run (not matter you run the 'compiled' exe, the au3 file, or the .a3x file). In the CtrlHover UDF, i included a small subset of those UDF with the same name, so if you have already included <WinAPI.au3> or <WinAPIShell.au3>, be sure to edit the UDF and comment out the corresponding region. Edit 2: Reorganize script. Fix some issues when drag too fast. Add ability to handle "click" (work RIGHT as normal button, will not fire if you only release the mouse button upon the control as some UDF use MouseUp event) Add a helper method to check if MouseUp event is click event or not. Add compability function to call as normal UDF (with first letter is underscore). Edit 1: Add some function descriptions as JS's advice. Thank you I also changed script name (shorter) and modify the register function so it may be called with less parameter. From now on, the function name and calling syntax will be fixed. OK, I know there is the famous "GUICtrlOnHover" UDF already in this forum, and many people have used it and enjoyed it! But the UDF didn't work as I expected . So I wrote an UDF myself, as much simple as possible, and it works out of the box It has some advantages compare to the old GUICtrlOnHover.au3 It creates the normal button behavior. When you press primary mouse button in the control and begin to drag, it do not set other controls to "hover" state. Faster. I try to add 2k controls. When mouse change from one control to another, it only take about 25ms to handle. In idle state (mouse cursor is not over any control), the cost is ignorable with < 0.1ms. Compare with GUICtrlOnHover UDF takes about 3ms when mouse cursor is over the control, but in idle state, it takes about 35ms. (I do not know why) (That is, because I tested script with overlapped controls. GUICtrlOnHover rely on WinAPI function WindowFromPoint(), which return the first created control (the control with is overlapped any others), but my script rely on GUIGetCursorInfo() which return the last created control - which is the most nested control in Windows). So my script need to check entire 2k control, but GUICtrlOnHover return the first element. I will wait for information about GUIGetCursorInfo() to decide that my UDF should use WinAPI function instead of the native function. In the normal usecase and controls is not overlapped, my UDF is far faster. Edit: Add a setting constant, make you ability to choose use WindowFromPoint() or GUIGetCursorInfo(). Default to the WinAPI function) Faster time to create/ register control. Native AutoIt. No Callback. The only DllCall I use is to get parent window of a control. Wonder why AutoIt do not have a similar function. Found a new bug #2899. If someone can ad more functinal to WinGetHandle("[LAST]"), it should be great Edit: Use some other WinAPI call to provide workaround for issue with GUIGetCursorInfo. Smaller size, about 280 lines compare with about 400 lines of GUICtrlOnHover. More simple, more easy to use. No more than 120 characters in one line. No annoying jumping when scroll the UDF Support event mode to detect mouse down event. But it doesn't work with overlay control. So you cannot have a control (with event) over another control. (use $_BGUIGETCURSORINFOFIX const setting to get rid of this). It seems that it's a AutoIt bug, the GUIGetCursorInfo return a useless control id when controls overlapped. Its not the same with the control received with WindowFromPoint(), or the control which fire event (anyone can confirm it's a bug? Or it's a special feature? ) ( I open a new Trac Ticket here: #2900) Current limit: Mouse down Almost all mouse event is currently detected by timeout (this is why the script called Simple and Stupid, but every UDF I found in this forum also use this method). You can set a smaller timeout to catch the mouse, but sometimes its annoying. Edit: Default changed to 30ms timeout, it should be fast enough to detect any click! You can also change to use event mode to detect click better! Otherwise, it works like a charm. Try it and happy with it Example: Callback function #include "SSCtrlHover.au3" GUICreate(@AutoItVersion) $idLbl1 = GUICtrlCreateLabel("Label 1", 5, 5) SSCtrlHover_Register($idLbl1, "FnNormal", 0, "FnHover", 0, "FnActive", 0, "FnClick", 0) $idLbl2 =GUICtrlCreateLabel("Label 2", 5, 35) SSCtrlHover_Register($idLbl2, "FnNormal", 0, "FnHover", 0, "FnActive", 0, "FnClick", 5) GUISetState() While GUIGetMsg() <> -3 Sleep(10) WEnd Func FnNormal($idCtrl, $hWnd, $vData) ConsoleWrite(@CRLF & "Normal/Leave " & $idCtrl) EndFunc Func FnHover($idCtrl, $hWnd, $vData) ConsoleWrite(@CRLF & "Hover " & $idCtrl) EndFunc Func FnActive($idCtrl, $hWnd, $vData) ConsoleWrite(@CRLF & "Active " & $idCtrl) EndFunc Func FnClick($idCtrl, $hWnd, $vData) ConsoleWrite(@CRLF & "CLICK! " & $idCtrl & " - " & $hWnd & " - " & $vData) EndFunc You can use it with GUICtrlSetImage to provide a "hover button" effect Version 1: SSCtrlHover.au3 Version 3: SSCtrlHover.zip
  16. Hello! I've been checking the logging UDFs in the wiki, mostly Log4a and Loga and I wanted to ask which one would you recommend for a script that will be executed remotely through PSExec. My main question is where the logs are located in that situation and if I can change that location to a custom one., because I need to retrieve them at the end of execution. So in a rough description the process is Open PSExec Send compiled AutoIT script to remote machine Execute script Copy logs from the remote to the local machine. Any opinions?
  17. I have started to rewrite the PowerPoint UDF similar to the Word, Excel and Outlook UDF. The new UDF will not be compatible with the existing one. I will add examples, documentation, a section in the wiki etc. So far the following functions have been coded - more are on the ToDo list. _PPT_Open: Open a connection to a running instance of PowerPoint or start a new one_PPT_Close: Close a PowerPoint instance_PPT_PresentationAttach: Attach to an already opened presentation_PPT_PresentationClose: Close a presentation_PPT_PresentationExport: Export one/multiple/all slides as PDF or XPS._PPT_PresentationExportGraphic: Export one/multiple/all slides in a graphic format._PPT_PresentationNew: Create a new presentation_PPT_PresentationOpen: Open an existing presentation_PPT_PresentationSave: Save a presentation_PPT_PresentationSaveAs: Save a presentation to another location or with another type_PPT_SlideAdd: Add slide(s) to a presentation_PPT_SlideCopyMove: Copy, move, duplicate slide(s)_PPT_SlideDelete: Delete slide(s)_PPT_SlideShow: Show a presentationWhich functions do you want me to add to the UDF? ToDo list: create slide (JLogan3o13) - Done: _PPT_SlideAddApply template to slide (JLogan3o13) - Done: _PPT_SlideAddApply theme to slide (JLogan3o13)Cut/Copy/Duplicate/Move/Delete slide(s) (JLogan3o13) - Done: _PPT_SlideCopyMove, _PPT_SlideDeleteExport slides (JLogan3o13) - Done: _PPT_PresentationExportCut/Copy/Duplicate/Move/Delete shape(s) (JLogan3o13)ApplyAnimation, Select, SetDefaultProperties, and zOrder for shape(s) (JLogan3o13)Searching and replacing text (pcjunki)Export slides in a graphic format (JPG, GIF, PNG ...) (UEZ) - Done: _PPT_PresentationExportGraphicAdded the Alpha version to the download forum.
  18. I watched _OL_ItemSend&_OL_ItemFind&_OL_ItemCreate in OutlookEx UDF but hmmm Since it use the test environnement i cant get the orders of the mail creation Can someone make me win some time of reading all exemples script and lead me how to do one ? That whould be lovely. Gnight
  19. Here is the bare bones of a UDF I have started work on. Mostly just a proof of concept at this stage, and still need to add some functions and dress the UDF up a bit ... to look like a UDF ... though it has my own distinct styling, especially as I have never really developed a UDF before now .... used plenty and modified plenty though. I've even invented my own UDF variable naming convention, which I am sure some of you will be aghast at. I work with what feels best for me, but others are free to adapt if they wish. The idea is to emulate the simplicity of INI files, but gain the benefits of SQL. Two scripts are provided. (1) The UDF, a work in progress - SimpleSQL_UDF.au3 (2) An example or testing script - UDF_Test.au3 Another first for me, is creating a 2D array from scratch, never done that before, that I can recall ... never had a need, and even for 1 dimension arrays, for a long time now, I have just used _StringSplit to create them. So I needed a bit of a refresher course, which my good buddy @TheDcoder assisted me with ... not without some angst I might add. LOL SimpleSQL_UDF.zip (12 downloads previously) (I have now completed all the functions I intended to. My next update will be a big improvement, bringing things more inline with my latest INItoSQL DB program changes.) Program requires the sqlite3.dll, not included, but easily enough obtained. Hopefully the usage is self-evident ... just change the Job number variable in the UDF_Test.au3 file to check the existing functions out. Enjoy! P.S. This is also related to a new program I have just finished and uploaded - INItoSQL DB
  20. I dug this UDF out in response to a request in the General Help forum. There is still some tidying to do, but I thought I would post here for anyone that would benefit. All functions have been tested on both XP and Windows 7. Updated January 22, 2014: Tested on XP, WIN7 and WIN8.1, x86 and x64 Current version includes: Enable or Disable the Windows Firewall Add or Remove Authorized Applications to the Exclusions list Add or Delete Ports from the Exclusions list. Enable or Disable the use of Exceptions Enable or Disable Notifications of blocked applications Enable or Disable Existing Ports List all Applications in the Exclusions List List all Ports in the Exclusions List List Properties of the current Firewall Configuration Restore the Windows Firewall to its default configuration Windows Firewall.au3
  21. Hello, as a start in Autoit i tried something i was missing since im using Autoit. I build a custom MessageBox which has a large amount of custom options and which scales its size on the parameters you set. Aviable Settings: -Title -Unlimited Buttons -Text Color (Buttons, Text) -Background Color (Msgbox, Buttons, Label) -Button Timeout -Autoclose Timeout -Icon (Default, No Icon, Custom) -Label/ Button Style. -Transparency I tried to keep this as close as i could to a Msgbox i was used too on my batch times. After i was ready i realised, @Melba23 probably build a way better msgbox which would have suit my needs enterly, anyway thanks to @Melba23 because i use his Stringsize UDF. local $Message = _sMsgBox("Test", 6, "Continue?") if @extended <> -1 Then MsgBox(0, @extended, $Message&" Button pressed") ScalingMessageBox.au3
  22. Dear members, I am working on a project where, emails from outlook are to be read and moved to various folders within the mailbox, based on the content of the emails. I used the below code for moving mails. It works fine when I run it against individual mail ids. But when I run it on Shared mailbox, the mails are not moved to respective folders. _OL_ItemMove($oOutlook, $sEntryId, Default, $sDestinationFolder) The value of $sEntryId is saved in an excel report initially. The current process reads the $sEntryId from the excel and passes it to "_OL_ItemMove" statement. Requesting the guidance of the forum members in this issue.
  23. Good evening everyone I am working with Word UDF ( thanks @water! ), and, especially, with the function _Word_DocFindReplace(). The replace does work everywhere in the document, but, it does not work in Headers or Footers. Am I missing something or am I forced to use the code below? I have already looked in the Help file ( about _Word_DocFindReplace() ), but there are no mentions about replace text in Headers/Footers. Sub FindAndReplaceFirstStoryOfEachType() Dim rngStory As Range For Each rngStory In ActiveDocument.StoryRanges With rngStory.Find .Text = "find text" .Replacement.Text = "I'm found .Wrap = wdFindContinue .Execute Replace:=wdReplaceAll End With Next rngStory End Sub Thanks everyone in advance Best Regards.
  24. I noticed a lack of a constants file for _WinAPI_GetSystemMetrics() so I made this for anyone who wants to add it to their library. Enjoy! (file attached below) #include-once ; #INDEX# ======================================================================================================================= ; Title .........: WinAPI GetSystemMetrics Constants ; AutoIt Version : 3.3.14.5 ; Language ......: English ; Description ...: Constants for _WinAPI_GetSystemMetrics(). ; Author(s) .....: ScriptJunky ; =============================================================================================================================== ; #CONSTANTS# =================================================================================================================== ; _WinAPI_GetSystemMetrics() Global Const $ARRANGE = 56 Global Const $CLEANBOOT = 67 Global Const $CMONITORS = 80 Global Const $CMOUSEBUTTONS = 43 Global Const $CONVERTIBLESLATEMODE = 0x2003 Global Const $CXBORDER = 5 Global Const $CXCURSOR = 13 Global Const $CXDLGFRAME = 7 Global Const $CXDOUBLECLK = 36 Global Const $CXDRAG = 68 Global Const $CXEDGE = 45 Global Const $CXFIXEDFRAME = 7 Global Const $CXFOCUSBORDER = 83 Global Const $CXFRAME = 32 Global Const $CXFULLSCREEN = 16 Global Const $CXHSCROLL = 21 Global Const $CXHTHUMB = 10 Global Const $CXICON = 11 Global Const $CXICONSPACING = 38 Global Const $CXMAXIMIZED = 61 Global Const $CXMAXTRACK = 59 Global Const $CXMENUCHECK = 71 Global Const $CXMENUSIZE = 54 Global Const $CXMIN = 28 Global Const $CXMINIMIZED = 57 Global Const $CXMINSPACING = 47 Global Const $CXMINTRACK = 34 Global Const $CXPADDEDBORDER = 92 Global Const $CXSCREEN = 0 Global Const $CXSIZE = 30 Global Const $CXSIZEFRAME = 32 Global Const $CXSMICON = 49 Global Const $CXSMSIZE = 52 Global Const $CXVIRTUALSCREEN = 78 Global Const $CXVSCROLL = 2 Global Const $CYBORDER = 6 Global Const $CYCAPTION = 4 Global Const $CYCURSOR = 14 Global Const $CYDLGFRAME = 8 Global Const $CYDOUBLECLK = 37 Global Const $CYDRAG = 69 Global Const $CYEDGE = 46 Global Const $CYFIXEDFRAME = 8 Global Const $CYFOCUSBORDER = 84 Global Const $CYFRAME = 33 Global Const $CYFULLSCREEN = 17 Global Const $CYHSCROLL = 3 Global Const $CYICON = 12 Global Const $CYICONSPACING = 39 Global Const $CYKANJIWINDOW = 18 Global Const $CYMAXIMIZED = 62 Global Const $CYMAXTRACK = 60 Global Const $CYMENU = 15 Global Const $CYMENUCHECK = 72 Global Const $CYMENUSIZE = 55 Global Const $CYMIN = 29 Global Const $CYMINIMIZED = 58 Global Const $CYMINSPACING = 48 Global Const $CYMINTRACK = 35 Global Const $CYSCREEN = 1 Global Const $CYSIZE = 31 Global Const $CYSIZEFRAME = 33 Global Const $CYSMCAPTION = 51 Global Const $CYSMICON = 50 Global Const $CYSMSIZE = 53 Global Const $CYVIRTUALSCREEN = 79 Global Const $CYVSCROLL = 20 Global Const $CYVTHUMB = 9 Global Const $DBCSENABLED = 42 Global Const $DEBUG = 22 Global Const $DIGITIZER = 94 Global Const $IMMENABLED = 82 Global Const $MAXIMUMTOUCHES = 95 Global Const $MEDIACENTER = 87 Global Const $MENUDROPALIGNMENT = 40 Global Const $MIDEASTENABLED = 74 Global Const $MOUSEPRESENT = 19 Global Const $MOUSEHORIZONTALWHEELPRESENT = 91 Global Const $MOUSEWHEELPRESENT = 75 Global Const $NETWORK = 63 Global Const $PENWINDOWS = 41 Global Const $REMOTECONTROL = 0x2001 Global Const $REMOTESESSION = 0x1000 Global Const $SAMEDISPLAYFORMAT = 81 Global Const $SECURE = 44 Global Const $SERVERR = 289 Global Const $SHOWSOUNDS = 70 Global Const $SHUTTINGDOWN = 0x2000 Global Const $SLOWMACHINE = 73 Global Const $STARTER = 88 Global Const $SWAPBUTTON = 23 Global Const $TABLETPC = 86 Global Const $XVIRTUALSCREEN = 76 Global Const $YVIRTUALSCREEN = 77 WinAPISystemMetricsConstants.au3
  25. The _XLSXReadToArray Fuction Reads the EXCEL XLSX Sheet into an Array, not needed that Office is installed and do not use Object just use the REGEXP so_XLSXReadToArray works very fast, in a test done by me here with BulletinSearch_20121008_170143.xlsx (1,5 Mb, Rows = 12148 & Column = 15), the _XLSXReadToArray Return Array in 10 seconds, instead to Excel 2013 them have served more than 20 seconds to open the file ect ect, Normally should not happen ever of not finding the "[Content_Types].xml" or other files mentioned in "[Content_Types].xml", but if anything happens already Added the >_FileListToArrayEx to try to search the *.xml files in "Temp Extract Diretory" #include-once ; #UDF# ======================================================================================================================= ; Title .........: XLSX Read To Array ; AutoIt Version : 3.3.8.1 ; Language ......: English ; Description ...: Fuction Reads the EXCEL XLSX Sheet into an Array ; Author(s) .....: DXRW4E ; Notes .........: ; =============================================================================================================================== ; #CURRENT# ===================================================================================================================== ;~ _XLSXReadToArray ;~ _XLSXSheetGetColumnNumber ;~ _SSNToDate ;~ _DateToSSN ;~ _FileListToArrayEx ; =============================================================================================================================== If Not ObjEvent("AutoIt.Error") Then Global Const $_XLSXZip_COMErrorFunc = ObjEvent("AutoIt.Error", "_XLSXZip_COMErrorFunc") Global $DateSSN[27] = [0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335] ; #FUNCTION# ================================================================================================================================ ; Name...........: _XLSXReadToArray ; Description ...: The _XLSXReadToArray Fuction Reads the EXCEL XLSX Sheet into an Array ; Syntax.........: _XLSXReadToArray($XLSXFilePath, $iFlag) ; Parameters ....: $XLSXFilePath - Path and filename of the XLSX file to be read. ; $iFlag - Optional ; |$iFlag = 0 (Default) None ; |$iFlag = 1 if there are also add HyperLinks in the Array ; Strings\Test in Column\Rows will separate from HyperLink by @LF, example "Value" & @LF & http://www.autoitscript.com/forum/ ; |$Cols - Optional, Columns Number to Read (read only X column) ; |$Rows - Optional, Rows Number to Read (read only X Row) ; |$iSheet - Optional, Number of Sheet*.xml to Read, Default is 1 ; Return values .: Success - Return ; Array ($Array[0][0] = Rows Number & @Extended = Column Nmmber) ; If Set $Cols and $Rows Return is String Data, if Return Strigs = "" @Extended is Set to 1 ; @Error - Set Error ; |1 = XLSX file not found or invalid (Can not Read\Extract XLSX file) ; |2 = [Content_Types].xml not found or invalid ; |3 = sheet1.xml file not found or invalid ; |4 = Sheet Dimension Not found Or is Greater than 15999999 (Array Size Limit) ; |5 = No SheetDate (Columns & Rows) Found ; Author ........: DXRW4E ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: __XLSXReadToArray("C:\file.xlsx") ; Note ..........: ; =========================================================================================================================================== Func _XLSXReadToArray($XLSXFilePath, $iFlag = 0, $Cols = 0, $Rows = 0, $iSheet = 1) If ($Cols * ($Rows + 1)) > 15999999 Then Return SetError(4, 0, "") Local $XLSXExtractDir = @WindowsDir & "\Temp\XLSX_" & @YEAR & @MON & @MDAY & @HOUR & @MIN & @SEC & @MSEC, $XLSXZip, $oShell, $X $XLSXZip = FileCopy($XLSXFilePath, $XLSXExtractDir & "\__xlsx.zip", 9) If Not $XLSXZip Then Return SetError(1, DirRemove($XLSXExtractDir, 1), "") $oShell = ObjCreate("shell.application") $oShell.Namespace($XLSXExtractDir).CopyHere($oShell.Namespace($XLSXExtractDir & "\__xlsx.zip").items, 20) Local $ContentTypesXML = StringReplace(FileRead($XLSXExtractDir & "\[Content_Types].xml"), "/", "\", 0, 1) If Not $ContentTypesXML Then $ContentTypesXML = _FileListToArrayEx($XLSXExtractDir, "*Content*Types*.xml", 37) If Not @Error Then $ContentTypesXML = StringReplace(FileRead($XLSXExtractDir & "\" & $ContentTypesXML[0]), "/", "\", 0, 1) If Not $ContentTypesXML Then Return SetError(2, DirRemove($XLSXExtractDir, 1), "") EndIf Local $SharedStringsXMLPath = StringRegExp($ContentTypesXML, '(?si)<Override\s*PartName="([^"]*\\sharedStrings\.xml)"', 1) If @Error Then $SharedStringsXMLPath = _FileListToArrayEx($XLSXExtractDir, "sharedStrings.xml", 165) If Not @Error Then $SharedStringsXMLPath = $XLSXExtractDir & $SharedStringsXMLPath[0] Local $SheetXMLPath = StringRegExp($ContentTypesXML, '(?si)<Override\s*PartName="([^"]*\\sheet' & $iSheet & '\.xml)"', 1) If @Error Then $SheetXMLPath = _FileListToArrayEx($XLSXExtractDir, "sheet" & $iSheet & ".xml", 165) If @Error Then $SheetXMLPath = StringRegExp($ContentTypesXML, '(?si)<Override\s*PartName="([^"]*\\sheet[^"]*\.xml)"', 1) If @Error Then $SheetXMLPath = _FileListToArrayEx($XLSXExtractDir, "sheet*.xml", 165) If Not @Error Then $SheetXMLPath = $XLSXExtractDir & $SheetXMLPath[0] Local $WorkSheet = FileRead($SheetXMLPath) If Not $WorkSheet Then Return SetError(3, DirRemove($XLSXExtractDir, 1), "") Local $SharedStringsXML = FileRead($SharedStringsXMLPath) ;; Example Get File Path using the StringRegExpReplace(), but more slowly than StringRegExp Mod. ;; Local $WorkBookXMLPath = $XLSXExtractDir & StringRegExpReplace($ContentTypesXML, '(?si).*<Override\s+PartName="([^"]*\\workbook\.xml)".*', "$1") ;; Local $StylesXMLPath = $XLSXExtractDir & StringRegExpReplace($ContentTypesXML, '(?si).*<Override\s+PartName="([^"]*\\styles\.xml)".*', "$1") ;; Local $SharedStringsXMLPath = $XLSXExtractDir & StringRegExpReplace($ContentTypesXML, '(?si).*<Override\s+PartName="([^"]*\\sharedStrings\.xml)".*', "$1") ;; Local $SheetXMLPath = $XLSXExtractDir & StringRegExpReplace($ContentTypesXML, '(?si).*<Override\s+PartName="([^"]*\\sheet1\.xml)".*', "$1") ;; ;; ;; read other ect ect ect ;; Local $WorkBookXMLPath = StringRegExp($ContentTypesXML, '(?si)<Override\s*PartName="([^"]*\\workbook\.xml)"', 1) ;; If @Error Then $WorkBookXMLPath = _FileListToArrayEx($XLSXExtractDir, "workbook.xml", 165) ;; If Not @Error Then $WorkBookXMLPath = $XLSXExtractDir & $WorkBookXMLPath[0] ;; $WorkBookXML = FileRead($WorkBookXMLPath) ;; ;Example using the StringRegExpReplace() ;; Local $SheetName = $XLSXExtractDir & StringRegExpReplace($WorkBookXML, '(?si).*<sheet\s+name="([^"]*)".*', "$1") ;; ;; Local $AppXMLPath = StringRegExp($ContentTypesXML, '(?si)<Override\s*PartName="([^"]*\\app\.xml)"', 1) ;; If @Error Then $AppXMLPath = _FileListToArrayEx($XLSXExtractDir, "app.xml", 165) ;; If Not @Error Then $AppXMLPath = $XLSXExtractDir & $AppXMLPath[0] ;; $AppXML = FileRead($AppXMLPath) ;; ;Example using the StringRegExpReplace() ;; Local $AppVersion = $XLSXExtractDir & StringRegExpReplace($AppXML, '(?si).*<AppVersion>([^<]*)</AppVersion>.*', "$1") ;; ;; Local $CoreXMLPath = StringRegExp($ContentTypesXML, '(?si)<Override\s*PartName="([^"]*\\core\.xml)"', 1) ;; If @Error Then $CoreXMLPath = _FileListToArrayEx($XLSXExtractDir, "core.xml", 165) ;; If Not @Error Then $CoreXMLPath = $XLSXExtractDir & $CoreXMLPath[0] ;; $CoreXML = FileRead($CoreXMLPath) ;; ;Example using the StringRegExpReplace() ;; Local $Modified = $XLSXExtractDir & StringRegExpReplace($CoreXML, '(?si).*<dcterms\:modified[^>]([^<]*)</dcterms:modified>.*', "$1") ;; ;; Local $StylesXMLPath = StringRegExp($ContentTypesXML, '(?si)<Override\s*PartName="([^"]*\\styles\.xml)"', 1) ;; If @Error Then $StylesXMLPath = _FileListToArrayEx($XLSXExtractDir, "styles.xml", 165) ;; If Not @Error Then $StylesXMLPath = $XLSXExtractDir & $StylesXMLPath[0] ;; $StylesXML = FileRead($StylesXMLPath) ;; ;ect ect ect ect ;; ;; Local $SheetViews = StringRegExp($WorkSheet, '(?si)<sheetView\s+tabSelected="([^"]*)".*?\sworkbookViewId="([^"]*)".*?\stopLeftCell="([A-Z]{1,3})([0-9]+)".*?\sactiveCell="([A-Z]{1,3})([0-9]+)".*?\sdefaultRowHeight="([^"]*)"', 1) ;; If @Error Then Local $SheetViews[7] ;; $SheetViews[2] = _XLSXSheetGetColumnNumber($SheetViews[2]) ;; $SheetViews[4] = _XLSXSheetGetColumnNumber($SheetViews[4]) ;; ;;;; $SheetViews.... ;; ;;;; $SheetViews[0] = tabSelected ;; ;;;; $SheetViews[1] = workbookViewId ;; ;;;; $SheetViews[2] = top Left Cell - Column Number ;; ;;;; $SheetViews[3] = top Left Cell - Rows Nmmber ;; ;;;; $SheetViews[4] = active Cell - Column Number ;; ;;;; $SheetViews[5] = active Cell - Rows Nmmber ;; ;;;; $SheetViews[6] = default Row Height DirRemove($XLSXExtractDir, 1) Local $nCols = Number($Cols), $nRows = "[0-9]+", $X = StringRegExp($WorkSheet, '(?si)<([^:><]*:?)?worksheet\s+', 1) If Not @Error Then $X = $X[0] If $Rows > 0 Then ;;;; StringRegExp($WorkSheet, '(?s)<' & $X & 'row\s+r="' & $Rows & '".*?</' & $X & 'row>', 1) $nRows = $Rows $Rows = 1 EndIf Local $SheetDimension = StringRegExp($WorkSheet, '(?si)<' & $X & '(?:dimension|autoFilter)\s+ref="([A-Z]{1,3})([0-9]+):([A-Z]{1,3})(?i)([0-9]+)', 1) If Not @Error Then $Cols = _XLSXSheetGetColumnNumber($SheetDimension[2]) If $nRows = "[0-9]+" Then $Rows = $SheetDimension[3] EndIf $SheetDimension = StringRegExp($WorkSheet, '(?si)<' & $X & 'col\s+min="?(\d+)[^>]*></' & $X & 'cols>', 1) If Not @Error And $SheetDimension[0] > $Cols Then $Cols = $SheetDimension[0] If $nRows = "[0-9]+" Then $SheetDimension = StringRegExp($WorkSheet, '(?si).*<' & $X & 'c\s+r="?[A-Z]*(\d+)', 1) If Not @Error And $SheetDimension[0] > $Rows Then $Rows = $SheetDimension[0] EndIf If $nCols > ($Cols + 1) Then Return SetError(5, 0, "") If $Cols < 1 Or $Rows < 1 Or ($Cols * ($Rows + 1)) > 15999999 Then Return SetError(4, 0, "") Local $SheetData = StringRegExp($WorkSheet, '(?s)<' & $X & 'c\s+r="([A-Z]{1,3})(?i)(' & $nRows & ')"\s*(?:s=")?([0-9]*)"?\s*(?:t=")?([^">]*)"?\s*><' & $X & 'v>([^<]*)\s*</' & $X & 'v>\s*</' & $X & 'c>', 3) If @Error Then Return SetError(5, 0, "") If $nCols Then $Cols = 1 Local $SheetDataA[($Rows + 1)][$Cols] = [[UBound($SheetData) - 1]], $ColumnName, $ColumnNumber, $ColumnSize, $SharedStringsXMLSize If $SharedStringsXML Then Local $S = StringRegExp($SharedStringsXML, '(?si)<([^:><]*:?)?sst\s+', 1) If Not @Error Then $S = $S[0] $SharedStringsXML = StringRegExp($SharedStringsXML, '(?si)<' & $S & 'si>(?:<' & $S & 'r>.*?)?<' & $S & 't(?:/|\s[^>]*)?>(.*?)(?:</' & $S & 't>)?(?:</' & $S & 'r>)?</' & $S & 'si>', 3) If Not @Error Then $SharedStringsXMLSize = UBound($SharedStringsXML) For $i = 0 To $SharedStringsXMLSize - 1 If StringInStr($SharedStringsXML[$i], "<", 1) Then $SharedStringsXML[$i] = StringRegExpReplace($SharedStringsXML[$i], '</' & $S & 't>.*?<' & $S & 't>', "") If StringInStr($SharedStringsXML[$i], "&", 1) Then $SharedStringsXML[$i] = StringReplace(StringReplace(StringReplace($SharedStringsXML[$i], "&lt;", "<", 0, 1), "&gt;", ">", 0, 1), "&amp;", "&", 0, 1) Next EndIf EndIf For $i = 0 To $SheetDataA[0][0] Step 5 $ColumnSize = StringLen($SheetData[$i]) - 1 If Not $ColumnSize Then $ColumnNumber = Asc($SheetData[$i]) - 65 Else $ColumnName = StringToASCIIArray($SheetData[$i]) $ColumnNumber = $ColumnName[$ColumnSize] - 65 $ColumnNumber += 26 * ($ColumnName[$ColumnSize - 1] - 64) ;(26 ^ 1) * ($ColumnName[1] - 64) If $ColumnSize > 1 Then $ColumnNumber += 676 * ($ColumnName[0] - 64) ;(26 ^ 2) * ($ColumnName[0] - 64) ;;;$ColumnNumber = _XLSXSheetGetColumnNumber($SheetData[$i], 1) EndIf If $nCols Then If $nCols <> ($ColumnNumber + 1) Then ContinueLoop $ColumnNumber = 0 EndIf If $Rows = 1 Then $SheetData[$i + 1] = 1 If $SheetData[$i + 3] = "s" And $SharedStringsXMLSize > $SheetData[$i + 4] Then $SheetDataA[$SheetData[$i + 1]][$ColumnNumber] = $SharedStringsXML[$SheetData[$i + 4]] ElseIf $SheetData[$i + 2] = 2 Then $SheetDataA[$SheetData[$i + 1]][$ColumnNumber] = _SSNToDate($SheetData[$i + 4]) Else $SheetDataA[$SheetData[$i + 1]][$ColumnNumber] = $SheetData[$i + 4] EndIf Next $SheetDataA[0][0] = $Rows If $iFlag Then $HyperLinks = StringRegExp($WorkSheet, '(?si)<' & $X & 'hyperlink\s+ref="([A-Z]{1,3})(?i)(' & $nRows & ')".*?\s+display="([^"]*)"', 3) ;;$HyperLinks = StringRegExp($WorkSheet, '(?si)<' & $X & 'hyperlink\s+ref="([A-Z]{1,3})(?i)' & $nRows & '"\s+r:id="([^"]*)"\s+display="([^"]*)"', 3) If Not @Error Then Local $HyperLinksSize = UBound($HyperLinks) - 1 For $i = 0 To $HyperLinksSize Step 3 $ColumnNumber = _XLSXSheetGetColumnNumber($HyperLinks[$i], 1) If $Rows = 1 Then $HyperLinks[$i + 1] = 1 $SheetDataA[$HyperLinks[$i + 1]][$ColumnNumber] &= @LF & $HyperLinks[$i + 2] Next EndIf EndIf If $nCols And $Rows = 1 Then Return SetError(0, $SheetDataA[1][0] = "", $SheetDataA[1][0]) Return SetError(0, UBound($SheetDataA, 2), $SheetDataA) EndFunc ;==>_XLSXReadToArray ; #FUNCTION# ================================================================================================================= ; Name...........: _XLSXSheetGetColumnNumber ; Description ...: The _XLSXSheetGetColumnNumber Fuction return Column Number of EXCEL XLSX Sheet ; Syntax.........: _XLSXSheetGetColumnNumber($ColumnName) ; Parameters ....: $ColumnName - [A-Z] Uppercase Caracter\String, are not Supported line with more than 3 characters ; $iFlag - Optional ; |$iFlag = 0 (Default) Column Number ; |$iFlag = 1 Column Number - 1 (for Array Index 0) ; Return values .: Success - Return Column Number ; Failure - @Error ; Author ........: DXRW4E ; Modified.......: ; Remarks .......: Limit is 18278 (A = 1 & AB = 27 & ZZZ = 18278) ; Related .......: ; Link ..........: ; Example .......: _XLSXSheetGetColumnNumber("ABC") ; Note ..........: ; ============================================================================================================================ Func _XLSXSheetGetColumnNumber($ColumnName, $iFlag = 0) If Not StringRegExp($ColumnName, '^[A-Z]{1,3}$') Or $iFlag < 0 Or $iFlag > 1 Then Return SetError(1, 0, 0) Local $ColumnNumber, $SheetDimension = StringLen($ColumnName) - 1 If Not $SheetDimension Then $ColumnNumber = Asc($ColumnName) - 64 - $iFlag Else $ColumnName = StringToASCIIArray($ColumnName) $ColumnNumber = $ColumnName[$SheetDimension] - 64 - $iFlag $ColumnNumber += 26 * ($ColumnName[$SheetDimension - 1] - 64) ;(26 ^ 1) * ($ColumnName[1] - 64) If $SheetDimension > 1 Then $ColumnNumber += 676 * ($ColumnName[0] - 64) ;(26 ^ 2) * ($ColumnName[0] - 64) EndIf Return $ColumnNumber EndFunc ;==>_XLSXSheetGetColumnNumber ; #FUNCTION# ================================================================================================================= ; Name...........: _SSNToDate ; Description ...: The _SSNToDate Fuction return Date from sequential serial number ; Syntax.........: _SSNToDate($iDay) ; Parameters ....: $iDay - sequential serial number (generated from DATE fuction on EXCEL, example 39637 = 7/8/2008) ; Return values .: Success - Return DATE ; Failure - @Error ; Author ........: DXRW4E ; Modified.......: ; Remarks .......: DATE String is Month/Day/Year, Year - is number is 1900 to 9999 ; Related .......: ; Link ..........: ; Example .......: _SSNToDate(39637) ; Note ..........: ; ============================================================================================================================ Func _SSNToDate($iDay) If $iDay < 1 Or $iDay > 2958465 Then Return SetError(1, 0, "") $DateSSN[0] = Int($iDay / 365) $DateSSN[25] = $DateSSN[0] / 4 $DateSSN[26] = IsFloat($DateSSN[25]) $iDay = $iDay - ($DateSSN[0] * 365) - Int($DateSSN[25]) - $DateSSN[26] If $iDay < 1 Then $DateSSN[0] -= 1 $DateSSN[25] = IsInt(($DateSSN[0] -1) / 4) $iDay += 365 + $DateSSN[25] $DateSSN[26] = Int($DateSSN[25] = 0) EndIf $DateSSN[2] -= $DateSSN[26] For $iMonth = 1 To 11 If $DateSSN[$iMonth] >= $iDay Then ExitLoop $iDay -= $DateSSN[$iMonth] Next $DateSSN[2] += $DateSSN[26] Return $iMonth & "/" & $iDay & "/" & (1900 + $DateSSN[0]) EndFunc ;==>_SSNToDate ; #FUNCTION# ================================================================================================================= ; Name...........: _DateToSSN ; Description ...: The _DateToSSN Fuction return sequential serial number that represent a particular Date ; Syntax.........: _DateToSSN($iYear, $iMonth, $iDay) ; Parameters ....: $iYear - Year - is number is 1900 to 9999 ; Required. The value of the year argument can include one to four digits. Excel interprets the year argument ; according to the date system your computer is using. By default, Microsoft Excel for Windows uses the 1900 date system. ; We recommend using four digits for the year argument to prevent unwanted results. For example, "07" could mean "1907" or "2007." Four digit years prevent confusion. ; If year is between 0 (zero) and 1899 (inclusive), Excel adds that value to 1900 to calculate the year. For example, DATE(108,1,2) returns January 2, 2008 (1900+108). ; If year is between 1900 and 9999 (inclusive), Excel uses that value as the year. For example, _DateToSSN((2008,1,2) returns January 2, 2008. ; If year is less than 0 or is 10000 or greater, _DateToSSN returns the @Error ; $iMonth - is number is 1 to 12, If Month is less than 0 or is 13 or greater, _DateToSSN returns the @Error ; $iDay - Required. A positive or negative integer representing the day of the month from 1 to 31. ; If day is greater than the number of days in the month specified, day adds that number of days to the first day in the month. ; For example, _DateToSSN(2008,1,35) returns the serial number representing February 4, 2008. ; If day is less than 1, day subtracts the magnitude that number of days, plus one, from the first day of the month specified. ; For example, _DateToSSN(2008,1,-15) returns the serial number representing December 16, 2007. ; Return values .: Success - Return Sequential Serial Number ; Failure - @Error ; Author ........: DXRW4E ; Modified.......: ; Remarks .......: Sequential Serial Number, _DateToSSN(2008, 7, 8) Return 39637, that represent 7/8/2008 ; ; NOTE - Excel stores dates as sequential serial numbers so that they can be used in calculations. January 1, 1900 is serial number 1, ; and January 1, 2008 is serial number 39448 because it is 39,447 days after January 1, 1900. ; ; _DateToSSN NOT SUPPORT FOR NOW, THIS ; $iMonth Required. A positive or negative integer representing the month of the year from 1 to 12 (January to December). ; If month is greater than 12, month adds that number of months to the first month in the year specified. For example, ; DATE(2008,14,2) returns the serial number representing February 2, 2009. ; If month is less than 1, month subtracts the magnitude of that number of months, plus 1, from the first month in the ; year specified. For example, DATE(2008,-3,2) returns the serial number representing September 2, 2007. ; Related .......: ; Link ..........: ; Example .......: _DateToSSN(39637) ; Note ..........: ; ============================================================================================================================ Func _DateToSSN($iYear, $iMonth, $iDay) If $iYear < 1900 Or $iYear > 9999 Or $iMonth < 1 Or $iMonth > 12 Then Return SetError(1, 0, "") $iYear -= 1900 $DateSSN[0] = $iYear / 4 If IsFloat($DateSSN[0]) And $iMonth < 3 Then $iDay += 1 Return ($iYear * 365) + Int($DateSSN[0]) + $DateSSN[$iMonth + 12] + $iDay EndFunc ;==>_DateToSSN ; #FUNCTION# ======================================================================================================================================================= ; Name...........: _FileListToArrayEx ; Description ...: Lists files and\or folders in a specified path (Similar to using Dir with the /B Switch) ; Syntax.........: _FileListToArrayEx($sPath[, $sFilter = "*"[, $iFlag = 0]]) ; Parameters ....: $sPath - Path to generate filelist for. ; $sFilter - Optional the filter to use, default is *. (Multiple filter groups such as "All "*.png|*.jpg|*.bmp") Search the Autoit3 helpfile for the word "WildCards" For details. ; $iFlag - Optional: specifies whether to return files folders or both Or Full Path (add the flags together for multiple operations): ; |$iFlag = 0 (Default) Return both files and folders ; |$iFlag = 1 Return files only ; |$iFlag = 2 Return Folders only ; |$iFlag = 4 Search SubDirectory ; |$iFlag = 8 Return Full Path ; |$iFlag = 16 $sFilter do Case-Sensitive matching (By Default $sFilter do Case-Insensitive matching) ; |$iFlag = 32 Disable the return the count in the first element - effectively makes the array 0-based (must use UBound() to get the size in this case). ; By Default the first element ($array[0]) contains the number of file found, the remaining elements ($array[1], $array[2], etc.) ; |$iFlag = 64 $sFilter is REGEXP Mod, See Pattern Parameters in StringRegExp (Can not be combined with flag 16) ; |$iFlag = 128 Return Backslash at the beginning of the file name, example Return "\Filename1.xxx" (Can not be combined with flag 8) ; Return values .: Failure - @Error ; |1 = Path not found or invalid ; |2 = Invalid $sFilter ; |3 = No File(s) Found ; Author ........: DXRW4E ; Modified.......: ; Remarks .......: The array returned is one-dimensional and is made up as follows: ; $array[0] = Number of Files\Folders returned ; $array[1] = 1st File\Folder ; $array[2] = 2nd File\Folder ; $array[3] = 3rd File\Folder ; $array[n] = nth File\Folder ; Related .......: ; Link ..........: ; Example .......: Yes ; Note ..........: Special Thanks to SolidSnake & Tlem ; ================================================================================================================================================================== Func _FileListToArrayEx($sPath, $sFilter = "*", $iFlag = 0) $sPath = StringRegExpReplace($sPath & "\", "[\\/]+", "\\") If Not FileExists($sPath) Then Return SetError(1, 1, "") If StringRegExp($sFilter, StringReplace('^\s*$|\v|[\\/:><"]|^\||\|\||\|$', "[" & Chr(BitAND($iFlag, 64) + 28) & '\/:><"]|^\||\|\||\|$', "\\\\")) Then Return SetError(2, 2, "") Local $hSearch, $sFile, $sFileList, $sSubDir = BitAND($iFlag, 4), $sDelim = "|", $sDirFilter = StringReplace($sFilter, "*", "") $hSearch = FileFindFirstFile($sPath & "*") If @Error Then Return SetError(3, 3, "") Local $hWSearch = $hSearch, $hWSTMP, $SearchWD, $Extended, $iFlags = StringReplace(BitAND($iFlag, 1) + BitAND($iFlag, 2), "3", "0") If BitAND($iFlag, 8) Then $sDelim &= $sPath If BitAND($iFlag, 128) Then $sDelim = "|\" If Not BitAND($iFlag, 64) Then $sFilter = StringRegExpReplace(BitAND($iFlag, 16) & "(?i)(", "16\(\?\i\)|\d+", "") & StringRegExpReplace(StringRegExpReplace(StringRegExpReplace(StringRegExpReplace($sFilter, "[^*?|]+", "\\Q$0\\E"), "\\E(?=\||$)", "$0\$"), "(?<=^|\|)\\Q", "^$0"), "\*+", ".*") & ")" While 1 $sFile = FileFindNextFile($hWSearch) If @Error Then If $hWSearch = $hSearch Then ExitLoop FileClose($hWSearch) $hWSearch -= 1 $SearchWD = StringLeft($SearchWD, StringInStr(StringTrimRight($SearchWD, 1), "\", 1, -1)) ElseIf $sSubDir Then $Extended = @Extended If ($iFlags + $Extended <> 2) Then If $sDirFilter Then If StringRegExp($sFile, $sFilter) Then $sFileList &= $sDelim & $SearchWD & $sFile Else $sFileList &= $sDelim & $SearchWD & $sFile EndIf EndIf If Not $Extended Then ContinueLoop $hWSTMP = FileFindFirstFile($sPath & $SearchWD & $sFile & "\*") If $hWSTMP = -1 Then ContinueLoop $hWSearch = $hWSTMP $SearchWD &= $sFile & "\" Else If ($iFlags + @Extended = 2) Or StringRegExp($sFile, $sFilter) = 0 Then ContinueLoop $sFileList &= $sDelim & $sFile EndIf WEnd FileClose($hSearch) If Not $sFileList Then Return SetError(3, 3, "") Return StringSplit(StringTrimLeft($sFileList, 1), "|", StringReplace(BitAND($iFlag, 32), "32", 2)) EndFunc ;==>_FileListToArrayEx Func _XLSXZip_COMErrorFunc() Return SetError(1, 0, "") EndFunc ;==>_XLSXZip_COMErrorFunc example #include <Array.au3> #include <_XLSXReadToArray.au3> local $a, $t, $Error, $Extended $t = TimerInit() InetGet("http://go.microsoft.com/fwlink/?LinkID=245778", @WindowsDir & "\Temp\BulletinSearch.xlsx") $a = _XLSXReadToArray(@WindowsDir & "\Temp\BulletinSearch.xlsx", 0, 0, 0) $t = TimerDiff($t) _ArrayDisplay($a, $t) ;;or $t = TimerInit() $a = _XLSXReadToArray(@WindowsDir & "\Temp\BulletinSearch.xlsx", 0, 2, 11) $Error = @Error $Extended = @Extended $t = TimerDiff($t) ConsoleWrite("Timer = " & $t & @LF) ConsoleWrite("Return = " & $a & " - $Error = " & $Error & " - $Extended = " & $Extended & @LF) exit _XLSXReadToArray.au3
×
×
  • Create New...