Jump to content

Autoit Wrappers


Valuater
 Share

Recommended Posts

Local $sFilePath = _FileOpenDialog("", "", "Images (*.jpg;*.bmp)|Videos (*.avi;*.mpg)", Random(1, @DesktopWidth, 1), Random(1, @DesktopHeight, 1), 1 + 4, "")
ConsoleWrite('File = ' & $sFilePath & ', @error = ' & @error & @CRLF)

; #FUNCTION# ====================================================================================================================
; Name ..........: _FileOpenDialog
; Description ...: Initiates a Open File Dialog with the option to set the position of the GUI.
; Syntax ........: _FileOpenDialog($sTitle, $sIntitialDirectory, $sFilter[, $iLeft = -1[, $iTop = -1[, $iOptions = 0[,
;                  $sDefaultName = ""]]]])
; Parameters ....: $sTitle              - Title text of the Dialog GUI.
;                  $sIntitialDirectory  - Initial directory selected in the GUI file tree.
;                  $sFilter             - File type single filter such as "All (*.*)" or "Text files (*.txt)".
;                  $iLeft               - [optional] The left side of the dialog box. By default (-1), the window is centered.
;                  $iTop                - [optional] The top of the dialog box. Default (-1) is centered
;                  $iOptions            - [optional] Dialog Options: To use more than one option, add the required values together. See FileOpenDialog. Default is 0.
;                  $sDefaultName        - [optional] Suggested file name for the user to open. Default is blank ("").
; Return values .: Success: Returns the full path of the file(s) chosen. Results for multiple selections are "Directory|file1|file2|..."
;                  Failure: Sets @error to non-zero.
; Author ........: guinness
; Remarks........: This doesn't change the working directory of the script like FileOpenDialog does.
; Example .......: Yes
; ===============================================================================================================================
Func _FileOpenDialog($sTitle, $sIntitialDirectory, $sFilter, $iLeft = -1, $iTop = -1, $iOptions = 0, $sDefaultName = "")
    Local $hGUI = GUICreate('', -1, -1, $iLeft, $iTop), $sWorkingDir = @WorkingDir
    Local $sFilePath = FileOpenDialog($sTitle, $sIntitialDirectory, $sFilter, $iOptions, $sDefaultName, $hGUI)
    Local $iError = @error
    FileChangeDir($sWorkingDir)
    Return SetError($iError, GUIDelete($hGUI), $sFilePath)
EndFunc   ;==>_FileOpenDialog

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

This was based on the idea provided by some time ago.

#include <Crypt.au3>

Local $sGenericPassword_1 = 'Password@AutoIt', $sGenericPassword_2 = 'NewPassword@AutoIt', $sSavePath = @ScriptDir & 'License.dat'
ConsoleWrite('1. ' & _PasswordCrypt($sGenericPassword_1, $sSavePath) & @CRLF) ; Write the password to a file located in the @ScriptDir. The password we wrote is returned by the function.
ConsoleWrite('2. ' & _PasswordCrypt($sGenericPassword_1, $sSavePath) & @CRLF) ; Since the password has been written already, we now want to check if the user has entered the password correctly. Returns True or False.
ConsoleWrite('3. ' & _PasswordCrypt($sGenericPassword_2, $sSavePath, 1) & @CRLF) ; Overwrite the old password with a new one.
ConsoleWrite('4. ' & _PasswordCrypt($sGenericPassword_1, $sSavePath) & @CRLF) ; Check the password matches. This will fail as we're checking the old password against the new one.
FileDelete($sSavePath)

Func _PasswordCrypt($sPassword, $sFilePath, $iOverwrite = 0) ; By guinness, idea by Valuater.
    If FileExists($sFilePath) And $iOverwrite = 0 Then
        Return BinaryToString(_Crypt_DecryptData(IniRead($sFilePath, 'PasswordKey', 'Password', ''), @ComputerName, $CALG_AES_256)) == $sPassword
    Else
        If IniWrite($sFilePath, 'PasswordKey', 'Password', _Crypt_EncryptData($sPassword, @ComputerName, $CALG_AES_256)) Then
            Return $sPassword
        EndIf
    EndIf
    Return SetError(1, 0, '')
EndFunc   ;==>_PasswordCrypt

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w 7
#include <Array.au3>

__INIFileFill(@ScriptDir & 'Example.ini') ; Create an INI file with random data.
Local $aArray = _IniReadFile(@ScriptDir & 'Example.ini')
FileDelete(@ScriptDir & 'Example.ini')
_ArrayDisplay($aArray)

Func _IniReadFile($sFilePath)
    Local $aReturn[1][3] = [[0, 3]], $aSectionArray, $aSectionNameArray, $iCount = 0
    $aSectionNameArray = IniReadSectionNames($sFilePath)
    If @error Then
        Return SetError(1, 0, $aReturn)
    EndIf
    For $A = 1 To $aSectionNameArray[0]
        $aSectionArray = IniReadSection($sFilePath, $aSectionNameArray[$A])
        If @error Then
            ContinueLoop
        EndIf
        For $B = 1 To $aSectionArray[0][0]
            $aReturn[0][0] += 1
            $iCount += 1
            If $aReturn[0][0] <= $iCount + 1 Then
                ReDim $aReturn[$aReturn[0][0] * 2][$aReturn[0][1]]
            EndIf
            $aReturn[$iCount][0] = $aSectionArray[$B][0]
            $aReturn[$iCount][1] = $aSectionArray[$B][1]
            $aReturn[$iCount][2] = $aSectionNameArray[$A]
        Next
    Next
    ReDim $aReturn[$aReturn[0][0] + 1][$aReturn[0][1]] ; Remove empty entries.
    Return $aReturn
EndFunc   ;==>_IniReadFile

Func __INIFileFill($sFilePath)
    Local $sData = '', $sHeader = ''

    For $i = 1 To Random(1, 5, 1)
        $sHeader = _RandomText(Random(5, 25, 1))
        $sData = ""
        For $j = 1 To Random(1, 25, 1)
            $sData &= _RandomText(Random(5, 25, 1)) & '=' & _RandomText(Random(5, 25, 1)) & @LF
        Next
        IniWriteSection($sFilePath, $sHeader, $sData)
    Next
EndFunc   ;==>__FillINIFile

Func _RandomText($iLength = 10)
    Local $sData = '', $sRandom = ''
    For $i = 1 To $iLength
        $sRandom = Random(55, 116, 1)
        $sData &= Chr($sRandom + 6 * ($sRandom > 90) - 7 * ($sRandom < 65))
    Next
    Return $sData
EndFunc   ;==>_RandomText

Edited by guinness

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

#include <Array.au3>

Global $aArray_1D[2] = ["Data", "Data"]
_ArrayDisplay($aArray_1D)
_1Dto2DArray($aArray_1D)
_ArrayDisplay($aArray_1D)

Global $aArray_1D[10] = ["Data", "Data","Data", "Data","Data", "Data","Data", "Data","Data", "Data"]
_ArrayDisplay($aArray_1D)
_1Dto2DArray($aArray_1D, 9)
_ArrayDisplay($aArray_1D)


Func _1Dto2DArray(ByRef $aArray, $iAdditionalColumns = 1)
    Local $iSize = UBound($aArray, 1)
    Local $aReturn[$iSize][$iAdditionalColumns + 1]
    For $A = 0 To $iSize - 1
        $aReturn[$A][0] = $aArray[$A]
    Next
    $aArray = $aReturn
    Return $aReturn
EndFunc   ;==>_1Dto2DArray

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

  • Moderators

Hi all,

This thread has been superceded by the Autoit Snippets thread - please post there from now on. :bye:

All of the working posts in this thread have been transfered to the new Autoit Snippets page in the Wiki and catalogued by Chimaera. :oops:

Snippets posted to the new thread will also be tranferred to the Wiki in due course. Sincere thanks to Valuater for starting this thread and the collection of useful code that it became. Please continue to support our community by posting your own useful little bits of code so that everyone can use them. :doh:

M23

Edited by Melba23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...