Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 09/11/2014 in all areas

  1. I've wanted to post this for a while. It's a great script to help debug control data....perfect scenario, when you have a 'Button' grouping, and spy tools cannot focus on those controls within the button bounds (groups). I also use it to verify that a given ID is not present more than once...if not, that's how I identify the control in future scripts. Output can be filtered by: 1) Filter by IsVisible 2) Filter by matching class (ex Button, Label, Static) 3) Filter by containing text #include <Array.au3> #include <WinAPI.au3> ConsoleWrite("Make your window active!" & @CRLF) Sleep(5000) GetAllWindowsControls(WinGetHandle("[ACTIVE]")) Func GetAllWindowsControls($hCallersWindow, $bOnlyVisible=Default, $sStringIncludes=Default, $sClass=Default) If Not IsHWnd($hCallersWindow) Then ConsoleWrite("$hCallersWindow must be a handle...provided=[" & $hCallersWindow & "]" & @CRLF) Return False EndIf ; Get all list of controls If $bOnlyVisible = Default Then $bOnlyVisible = False If $sStringIncludes = Default Then $sStringIncludes = "" If $sClass = Default Then $sClass = "" $sClassList = WinGetClassList($hCallersWindow) ; Create array $aClassList = StringSplit($sClassList, @CRLF, 2) ; Sort array _ArraySort($aClassList) _ArrayDelete($aClassList, 0) ; Loop $iCurrentClass = "" $iCurrentCount = 1 $iTotalCounter = 1 If StringLen($sClass)>0 Then For $i = UBound($aClassList)-1 To 0 Step - 1 If $aClassList[$i]<>$sClass Then _ArrayDelete($aClassList,$i) EndIf Next EndIf For $i = 0 To UBound($aClassList) - 1 If $aClassList[$i] = $iCurrentClass Then $iCurrentCount += 1 Else $iCurrentClass = $aClassList[$i] $iCurrentCount = 1 EndIf $hControl = ControlGetHandle($hCallersWindow, "", "[CLASSNN:" & $iCurrentClass & $iCurrentCount & "]") $text = StringRegExpReplace(ControlGetText($hCallersWindow, "", $hControl), "[\n\r]", "{@CRLF}") $aPos = ControlGetPos($hCallersWindow, "", $hControl) $sControlID = _WinAPI_GetDlgCtrlID($hControl) $bIsVisible = ControlCommand($hCallersWindow, "", $hControl, "IsVisible") If $bOnlyVisible And Not $bIsVisible Then $iTotalCounter += 1 ContinueLoop EndIf If StringLen($sStringIncludes) > 0 Then If Not StringInStr($text, $sStringIncludes) Then $iTotalCounter += 1 ContinueLoop EndIf EndIf If IsArray($aPos) Then ConsoleWrite("Func=[GetAllWindowsControls]: ControlCounter=[" & StringFormat("%3s", $iTotalCounter) & "] ControlID=[" & StringFormat("%5s", $sControlID) & "] Handle=[" & StringFormat("%10s", $hControl) & "] ClassNN=[" & StringFormat("%19s", $iCurrentClass & $iCurrentCount) & "] XPos=[" & StringFormat("%4s", $aPos[0]) & "] YPos=[" & StringFormat("%4s", $aPos[1]) & "] Width=[" & StringFormat("%4s", $aPos[2]) & "] Height=[" & StringFormat("%4s", $aPos[3]) & "] IsVisible=[" & $bIsVisible & "] Text=[" & $text & "]." & @CRLF) Else ConsoleWrite("Func=[GetAllWindowsControls]: ControlCounter=[" & StringFormat("%3s", $iTotalCounter) & "] ControlID=[" & StringFormat("%5s", $sControlID) & "] Handle=[" & StringFormat("%10s", $hControl) & "] ClassNN=[" & StringFormat("%19s", $iCurrentClass & $iCurrentCount) & "] XPos=[winclosed] YPos=[winclosed] Width=[winclosed] Height=[winclosed] Text=[" & $text & "]." & @CRLF) EndIf If Not WinExists($hCallersWindow) Then ExitLoop $iTotalCounter += 1 Next EndFunc ;==>GetAllWindowsControls
    1 point
  2. Mp3SearchEngine v2.0.0.6 May be some of you know Songr . This script do the same job, it can find more mp3 files but is not as fast as Songr. Sites used are music search engine Websites designed for LEGAL entertainment purposes only. Thanks to Brett Francis, Prog@ndy and Eukalyptus for >Bass Udf, trancex for >WinHttp Udf and the AutoIt Community for his help. Changes of v1.0.8.5 Three websites replaced cause they are dead or use now js. All search engines updated ( not without difficulties for audiodump) I use RAGrid.dll for the first listview (more fast and stable, but with some inconvenients to manage the no-edit of cells) Input queries are saved ( the twenty latest) I use now an mp3 pre-Load management before playing and a double progressbar for visualize pre-load and play, where you can click for directly go play in the loaded part. Most includes needed are embedded and all external files are embedded in script with >BinaryToAu3Kompressor . Multi downloads available with embedded downloader.exe Changes of v1.0.8.8 Search on audiodump and myfreemp3 fixed. New buttons. Added Gui Menu. Titles are no more editable. New "About" with >TaskDialog (Thanks Prog@andy) Query button permit now to check / uncheck all checkboxes And some few fixes and cleaning. Really more stable now. Changes of v1.0.9.2 Dilandau is replaced by mp3chief and mp3ili by mp3clan Search on mp3juices, baseofmp3 and soundcloud fixed. Soso now provide m4a (aac) instead of mp3 ( m4a can be played by MSE) Added possibility to encode automaticaly to mp3, aac or ogg ( at the end of download) using bassenc.dll and command line tools : lame, faac and oggenc. Changes of v1.0.9.3 mp3skull fixed mp3chief fixed myfreemp3 fixed mp3clan changed to tusmp3 mp3juices changed to emp3world baseofmp3 changed to imp3 and some minor improvements. Version 2.0.0.6 Most previous websites used are dead or have changed the way to get links, so instead of try to repair the previous version, i have created a complete new version. The main tendency is the simplification : Only one website : audiodump (Up to 500 results by request) Script use now the little pearl created by Ward : curl.au3 It permit to create tasks (get source and get multi mp3) in asynchronous mode. So now, no need to use several executables and no more gui who do not respond in case of connection problems. Script use Bass.dll X86 loaded in memory for play songs. Result is light and fast, but don't abuse of audiodump servers who are not beasts of race. Warning : For avoid errors with curl.au3, you'll need to comment the line 63 : ;~ #Include <BinaryCall.au3> @AutoItX64 not supported and only tested on Win7X64 and Win8.1X64. As your browser, use Ctrl+w for remove the current Tab.(if there is no search or download running from it) And also Ctrl+q for set/remove Gridlines. Events are displayed to the bottom of the Gui. Version 2.0.1.1 Added a Paste Button. Querry list is now correctly saved. Querry Combo is now sorted in alphabetical order After a 'No match', the next search will use the previous empty listview. Bug when removing tabs is corrected. Added string correction for the request that, in the previous version, was not always able to return a correct result. A big thanks to Ward for his great UDF, and Nina my favorite tester, (who between us is also my third daughter), for his precious advices . previous downloads : 1703 As there is no more script downloads count, source and executable are available in the downloads section Enjoy ! July 2017 Project Discontinued due to website changes
    1 point
  3. I created this after I developed >_ShellFolder() because I was interested in the entry displaying when an associated file was right clicked on. I was also intrigued to see how easy it would be to register a file type with my program, quite easy it appears. The UDF is a little different to what I've seen on the forum as this works with the Current User and/or All Users and an icon is created in the ContextMenu too. The entry will pass the file name to your program via a commandline argument, so you'll have to use $CmdLine/$CmdLineRaw to access the file that was selected. Any problems or suggestions then please post below. Thanks. UDF: #include-once ; #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w 7 ; #INDEX# ======================================================================================================================= ; Title .........: _ShellFile ; AutoIt Version : v3.2.12.1 or higher ; Language ......: English ; Description ...: Create an entry in the shell contextmenu when selecting an assigned filetype, includes the program icon as well. ; Note ..........: ; Author(s) .....: guinness ; Remarks .......: ; =============================================================================================================================== ; #INCLUDES# ==================================================================================================================== #include <Constants.au3> ; #GLOBAL VARIABLES# ============================================================================================================ ; None ; #CURRENT# ===================================================================================================================== ; _ShellFile_Install: Creates an entry in the 'All Users/Current Users' registry for displaying a program entry in the shell contextmenu, but only displays when selecting an assigned filetype to the program. ; _ShellFile_Uninstall: Deletes an entry in the 'All Users/Current Users' registry for displaying a program entry in the shell contextmenu. ; =============================================================================================================================== ; #INTERNAL_USE_ONLY#============================================================================================================ ; None ; =============================================================================================================================== ; #FUNCTION# ==================================================================================================================== ; Name ..........: _ShellFile_Install ; Description ...: Creates an entry in the 'All Users/Current Users' registry for displaying a program entry in the shell contextmenu, but only displays when selecting an assigned filetype to the program. ; Syntax ........: _ShellFile_Install($sText, $sFileType[, $sName = @ScriptName[, $sFilePath = @ScriptFullPath[, $sIconPath = @ScriptFullPath[, ; $iIcon = 0[, $fAllUsers = False[, $fExtended = False]]]]]]) ; Parameters ....: $sText - Text to be shown in the contextmenu. ; $sFileType - Filetype to be associated with the application e.g. .autoit or autoit. ; $sName - [optional] Name of the program. Default is @ScriptName. ; $sFilePath - [optional] Location of the program executable. Default is @ScriptFullPath. ; $sIconPath - [optional] Location of the icon e.g. program executable or dll file. Default is @ScriptFullPath. ; $iIcon - [optional] Index of icon to be used. Default is 0. ; $fAllUsers - [optional] Add to Current Users (False) or All Users (True) Default is False. ; $fExtended - [optional] Show in the Extended contextmenu using Shift + Right click. Default is False. ; Return values .: Success - Returns True ; Failure - Returns False and sets @error to non-zero. ; Author ........: guinness ; Example .......: Yes ; =============================================================================================================================== Func _ShellFile_Install($sText, $sFileType, $sName = @ScriptName, $sFilePath = @ScriptFullPath, $sIconPath = @ScriptFullPath, $iIcon = 0, $fAllUsers = False, $fExtended = False) Local $i64Bit = '', $sRegistryKey = '' If $iIcon = Default Then $iIcon = 0 EndIf If $sFilePath = Default Then $sFilePath = @ScriptFullPath EndIf If $sIconPath = Default Then $sIconPath = @ScriptFullPath EndIf If $sName = Default Then $sName = @ScriptName EndIf If @OSArch = 'X64' Then $i64Bit = '64' EndIf If $fAllUsers Then $sRegistryKey = 'HKEY_LOCAL_MACHINE' & $i64Bit & '\SOFTWARE\Classes\' Else $sRegistryKey = 'HKEY_CURRENT_USER' & $i64Bit & '\SOFTWARE\Classes\' EndIf $sFileType = StringRegExpReplace($sFileType, '^\.+', '') $sName = StringLower(StringRegExpReplace($sName, '\.[^.\\/]*$', '')) If StringStripWS($sName, $STR_STRIPALL) = '' Or FileExists($sFilePath) = 0 Or StringStripWS($sFileType, $STR_STRIPALL) = '' Then Return SetError(1, 0, False) EndIf _ShellFile_Uninstall($sFileType, $fAllUsers) Local $iReturn = 0 $iReturn += RegWrite($sRegistryKey & '.' & $sFileType, '', 'REG_SZ', $sName) $iReturn += RegWrite($sRegistryKey & $sName & '\DefaultIcon\', '', 'REG_SZ', $sIconPath & ',' & $iIcon) $iReturn += RegWrite($sRegistryKey & $sName & '\shell\open', '', 'REG_SZ', $sText) $iReturn += RegWrite($sRegistryKey & $sName & '\shell\open', 'Icon', 'REG_EXPAND_SZ', $sIconPath & ',' & $iIcon) $iReturn += RegWrite($sRegistryKey & $sName & '\shell\open\command\', '', 'REG_SZ', '"' & $sFilePath & '" "%1"') $iReturn += RegWrite($sRegistryKey & $sName, '', 'REG_SZ', $sText) $iReturn += RegWrite($sRegistryKey & $sName, 'Icon', 'REG_EXPAND_SZ', $sIconPath & ',' & $iIcon) $iReturn += RegWrite($sRegistryKey & $sName & '\command', '', 'REG_SZ', '"' & $sFilePath & '" "%1"') If $fExtended Then $iReturn += RegWrite($sRegistryKey & $sName, 'Extended', 'REG_SZ', '') EndIf Return $iReturn > 0 EndFunc ;==>_ShellFile_Install ; #FUNCTION# ==================================================================================================================== ; Name ..........: _ShellFile_Uninstall ; Description ...: Deletes an entry in the 'All Users/Current Users' registry for displaying a program entry in the shell contextmenu. ; Syntax ........: _ShellFile_Uninstall($sFileType[, $fAllUsers = False]) ; Parameters ....: $sFileType - Filetype to be associated with the application e.g. .autoit or autoit. ; $fAllUsers - [optional] Add to Current Users (False) or All Users (True) Default is False. ; Return values .: Success - Returns True ; Failure - Returns False and sets @error to non-zero. ; Author ........: guinness ; Example .......: Yes ; =============================================================================================================================== Func _ShellFile_Uninstall($sFileType, $fAllUsers = False) Local $i64Bit = '', $sRegistryKey = '' If @OSArch = 'X64' Then $i64Bit = '64' EndIf If $fAllUsers Then $sRegistryKey = 'HKEY_LOCAL_MACHINE' & $i64Bit & '\SOFTWARE\Classes\' Else $sRegistryKey = 'HKEY_CURRENT_USER' & $i64Bit & '\SOFTWARE\Classes\' EndIf $sFileType = StringRegExpReplace($sFileType, '^\.+', '') If StringStripWS($sFileType, $STR_STRIPALL) = '' Then Return SetError(1, 0, False) EndIf Local $iReturn = 0, $sName = RegRead($sRegistryKey & '.' & $sFileType, '') If @error Then Return SetError(2, 0, False) EndIf $iReturn += RegDelete($sRegistryKey & '.' & $sFileType) $iReturn += RegDelete($sRegistryKey & $sName) Return $iReturn > 0 EndFunc ;==>_ShellFile_UninstallExample 1: #include <GUIConstantsEx.au3> #include '_ShellFile.au3' If @Compiled = 0 Then Exit MsgBox($MB_SYSTEMMODAL, '@Compiled Returned 0.', 'Please compile the program before testing. Thanks.') EndIf _Main() Func _Main() Local $sFilePath = '' If $CmdLine[0] > 0 Then $sFilePath = $CmdLine[1] EndIf Local $hGUI = GUICreate('_ShellFile() Example', 370, 110) GUICtrlCreateEdit(_GetFile($sFilePath), 10, 5, 350, 65) ; If a file was passed via commandline then random text will appear in the GUICtrlCreateEdit(). Local $iAdd = GUICtrlCreateButton('Add FileType', 10, 80, 75, 25) Local $iRemove = GUICtrlCreateButton('Remove FileType', 90, 80, 95, 25) GUISetState(@SW_SHOW, $hGUI) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $iAdd _ShellFile_Install('Open with _ShellFile()', 'autoit') ; Add the running EXE to the Shell ContextMenu. If @error Then MsgBox($MB_SYSTEMMODAL, 'Association NOT Created.', '".autoit" was not associated due to an error occurring.') Else MsgBox($MB_SYSTEMMODAL, 'Association Created.', '"RandomFile.autoit" file was created to show that the filetype ".autoit" has been associtated with ' & @ScriptName & '.' & _ @CRLF & @CRLF & 'If you restart the computer you''ll see the icon of "RandomFile.autoit" is the same as the program icon.' & _ @CRLF & @CRLF & 'Now close the program and double/right click on "RandomFile.autoit" to display the random text in the edit box.') EndIf _SetFile(_RandomText(5000), @ScriptDir & '\RandomFile.autoit', 1) ; Create a file with Random text. Case $iRemove _ShellFile_Uninstall('autoit') ; Remove the running EXE from the Shell ContextMenu. If @error Then MsgBox($MB_SYSTEMMODAL, 'Association NOT Deleted.', '".autoit" was not deleted from the Registry due to an error occurring.') Else MsgBox($MB_SYSTEMMODAL, 'Association Deleted.', '".autoit" was successfully deleted from the Registry and is no longer associated with ' & @ScriptName & '.') EndIf EndSwitch WEnd GUIDelete($hGUI) EndFunc ;==>_Main Func _GetFile($sFilePath, $sFormat = 0) Local $hFileOpen = FileOpen($sFilePath, $sFormat) If $hFileOpen = -1 Then Return SetError(1, 0, 'No File Was Passed Via Commandline.') EndIf Local $sData = FileRead($hFileOpen) FileClose($hFileOpen) Return $sData EndFunc ;==>_GetFile Func _RandomText($iLength = 7) Local $iCount = 0, $iCRLF, $sData = '', $sRandom For $i = 1 To $iLength $sRandom = Random(55, 116, 1) If $iCount = 100 Then $iCRLF = @CRLF $iCount = 0 EndIf $sData &= Chr($sRandom + 6 * ($sRandom > 90) - 7 * ($sRandom < 65)) & $iCRLF $iCount += 1 $iCRLF = '' Next Return $sData EndFunc ;==>_RandomText Func _SetFile($sString, $sFilePath, $iOverwrite = 0) Local $hFileOpen = FileOpen($sFilePath, $iOverwrite + 1) FileWrite($hFileOpen, $sString) FileClose($hFileOpen) If @error Then Return SetError(1, 0, $sString) EndIf Return $sString EndFunc ;==>_SetFileAll of the above has been included in a ZIP file. ShellFile.zip
    1 point
  4. I use a USB key or an FM transmitter in my car to listen mp3. Two problems have emerged: long silences or a different sound level between different tracks or between tracks and FM radio. Seeking a software that could solve automatically these problems, for multiple files, I returned empty-handed ! All i have found who could be interesting were some examples about remove silence on un4seen.com (the bass audio library website) After much research I managed to adapt it, here is the result : Mp3SilenceRemover can trim a bunch of mp3 files that have silence at the beginnings and ends, automatically. Script scans each file for when the sound starts and ends, by detecting a pre-determined silence threshold, then reencode them without silent parts found. Usefull if you want use mp3 files for a mix or avoid long silences between tracks. Multiple settings are available for preserving mp3 quality. Mp3Gain can be used for avoid a too big difference in sound level between 2 tracks. Main Id3 Tags can be preserved and the fade at end of the track too. Script use : bass.dll, bassenc.dll, bassext.dll, tags.dll, lame.exe and mp3gain.exe. The default settings I have choosen are the ones who give me the best results during my numerous tries. Free to you to adapt them to your needs, they are saved automatically. New mp3 files will be located in the same folder with "_SR1" at the end of the name. Buttons were made online with chimply.com the easy and free buttons generator ! No external files or includes needed, they are embbeded in script. source and executable are available in the Download Section Hope you like it !
    1 point
  5. There's no need to ReDim the array after you've found all the old files, _ArrayDelete is already doing that for you. You can use the $redim variable to keep track of how many items were deleted, that way you can update $afiles[0] with the correct number of items in the array after it's done deleting. Also, your script wouldn't run as written anyways because the $afiles array is local to the RemOldXML function and the SortXML function wouldn't be able to access it. I've updated the script with some changes that will work as I believe you wanted it to. Look for the comment lines with <<<<<<<< in them #include <Array.au3> #include <File.au3> #include <date.au3> Global $aFiles RemOldXML() Func RemOldXML() Local $path, $aFiles, $aFilesTime, $TimeArray, $redim = 0 $sPath = @ScriptDir $aFiles = _FileListToArrayRec(@ScriptDir, "*.xml", 1, 0, 0, 2) _ArrayDisplay($aFiles, "original xml file array") $redim = UBound($aFiles) - 1 ; <<<<<<<<<<<< created the variable with the original value of the Ubound of $afiles For $i = UBound($aFiles) - 1 To 1 Step -1 $aFilesTime = FileGetTime($aFiles[$i], 1, 0) $TimeArray = StringFormat("%s/%s/%s %s:%s:%s", $aFilesTime[0], $aFilesTime[1], $aFilesTime[2], $aFilesTime[3], $aFilesTime[4], $aFilesTime[5]) If _DateDiff('h', $TimeArray, _NowCalc()) >= 49 Then _ArrayDelete($aFiles, $i) $redim -= 1 ; <<<<<<<<<<< changed this to a subtraction, lowers the value by one everytime you delete a line from the array EndIf Next $aFiles[0] = $redim ;<<<<<<<<<<<<< Update the value in $afiles[0] to equal the new count _ArrayDisplay($aFiles, "Final array") SortXML($aFiles) ; <<<<<<<<<<<< pass the array to the SortXML function EndFunc ;==>RemOldXML Func SortXML($aFiles) ; <<<<<<<<<<<< changed the function to accept a parameter Local $aFileList2D[$aFiles[0] + 1][2]= [[$aFiles[0], ""]] ; <<<<<<<<<<<<<<<<<< corrected the array initiliazation For $i = 1 To $aFiles[0] $aFileList2D[$i][0] = $aFiles[$i] $aFileList2D[$i][1] = FileGetTime($aFiles[$i], 1, 1) Next _ArraySort($aFileList2D, 1, 0, 0, 1) _ArrayDisplay($aFileList2D, "Final Sorted Array") EndFunc ;==>SortXML
    1 point
  6. Melba23

    AutoTyping Scripts

    JScriptinghomework, JLogan3o13 is quite right - please read the Forum rules (the link is also at bottom right of each page) - particularly the bit about not discussing game automation - before you post again. Thread locked. But welcome to the AutoIt forum - and see you soon with a legitimate question I hope. M23
    1 point
  7. I'm glad to have helped you!
    1 point
  8. Try to change: Global $EVENT_Min = 0x00000001 Global $EVENT_Max = 0x7FFFFFFF Does it affects in any way?
    1 point
  9. Because than it would not be an ObjCreateInterface example would it.
    1 point
  10. Exit

    alternative to exit

    For $i = 1 To 5 MsgBox(64 + 262144, Default, "", 1) If $i = 3 Then _MyExit("exit due to ... blabla ...") Next Func _MyExit($reason) Local $a MsgBox(16 + 262144, Default, $reason, 3) $t = $a[99] ; this line errors out ==> Subscript used on non-accessible variable.: EndFunc ;==>_MyExit
    1 point
  11. JohnOne

    alternative to exit

    Look out, here he comes.
    1 point
  12. Best just write a new script. What you are asking for will get the angry AutoIt villagers hunting you with pitch forks.
    1 point
  13. BitByteBit, A few lines to add to your code just before and within your While...WEnd loop: $dll = DllOpen("user32.dll") $Search_Handle = GUICtrlGetHandle($Search) While 1 $nMsg = GUIGetMsg() ;$Msg= GUIGetMsg ($GUI_EVENT_PRIMARYDOWN) Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Google Google() Case $GUI_EVENT_PRIMARYDOWN $aCurInfo = GUIGetCursorInfo() If $aCurInfo[4] = $Search Then Sleep(100) Send("{HOME}{SHIFTDOWN}{END}{SHIFTUP}") EndIf EndSwitch If _IsPressed("0D", $dll) And _WinAPI_GetFocus() = $Search_Handle Then ConsoleWrite("I can run a function!" & @CRLF) While _IsPressed("0D", $dll) Sleep(10) ; Important so as not to use 100% CPU! WEnd EndIf WEndIt seems Input controls do not send messages, so we have to take a roundabout way of looking for a click and then seeing if the mouse if over the Input. As to the hitting the Enter key, you can see how it checks if the Input has focus before doing anything. As we are polling _IsPressed in a loop, it is good practice to open the DLL beforehand - but you then need to close the DLL once you no longer need to check for the keypress. Despite its less than elegant form, I hope this code helps. M23
    1 point
×
×
  • Create New...