Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/15/2022 in all areas

  1. Skeletor, I would do it this way: #include <Array.au3> #include <File.au3> ; Get the list of all folders $aFolderPaths = _FileListToArrayRec("M:", "*", $FLTAR_FOLDERS, $FLTAR_RECUR, $FLTAR_SORT, $FLTAR_FULLPATH) ; This will be the list of indices of folders to delete $sDeleteString = "" For $i = 1 To $aFolderPaths[0] ; Count number of "\" StringReplace($aFolderPaths[$i], "\", "") ; It is returned in @extended If @extended <> 6 Then ; If not at level 6 then add index of item to list to delete $sDeleteString &= $i & ";" EndIf Next ; Trim the finla and unwanted ";" $sDeleteString = StringTrimRight($sDeleteString, 1) ; Delete all the unwanted folders in one go _ArrayDelete($aFolderPaths, $sDeleteString) ; Reset the count $aFolderPaths[0] = UBound($aFolderPaths) - 1 ; And here we are! _ArrayDisplay($aFolderPaths, "", Default, 8) M23
    2 points
  2. Hello. Shouldn't be hard. I think is like this: Pseudo code: DllCall("Kernel32.dll","long","SetProcessInformation","handle",$hHandle,"int",4=ProcessPowerThrottling,"ptr",$tPROCESS_POWER_THROTTLING_STATE,"dword",Size($tPROCESS_POWER_THROTTLING_STATE)) Saludos
    1 point
  3. Thanks and sorry for my stupidness
    1 point
  4. Hi @Draygoes. Here's a link to a post in the thread with an example: I think this is what you need Hope it helps
    1 point
  5. Shaggi

    Console.au3 UDF

    Sup, This isn't really an advanced UDF, but implements a couple of functions and features, with the idea of substituting the original functions like ConsoleWrite() and ConsoleWriteError() and the seriously sketchy ConsoleRead() lol. Public functions: Cout()Cin()Getch()Cerr()system()RegisterConsoleEvent()The motive for writing this was the missing ability to read user input from consoles in AutoIt, known as std::cin >> in C++. The UDF's design allows quick and simple access to the functions, without startup / shutdown and handle passing - all this is automatically taken care of. Some users may have know, that you cannot open a console if the script is running from SciTE - this UDF handles that problem, so you can open an console while running scripts through SciTE. Features: Dynamically opens and closes consolesUse the STDOUT, STDERR and STDIN streams like in other languages.Print coloured/styled textAccess the command interpreter through the console.Uses unicode.Register console events.The UDF is designed to work standalone and to have minimal overhead (> 0.1 ms for writing a coloured string)The UDF supports my style of scripting. I hate long names so standard UDF naming like _Console_WriteConsoleW() is abbreviated to Cout() for now. I also hate having to start up certain UDF's by calling funcs etc., so this is handled first time you call a function. Handles are controlled globally and closed when needed, so you don't need to pass them around lol. Why would anyone need this? Good question. I guess this mainly goes out to people with a bit of nostalgia in them. I personally like the feel of a console. Picture: Changelog: 25-06-2012 Fixed system() to allow case sensitive text.25-06-2012 Fixed typo's.Changed frequent dllcalls to use dllcalladdress for speed.Added RegisterConsoleEvent - functions can be registrered to be called on certain events, like closure of console. This can be used to mimic OnAutoItExit behaviour, that wont be called in case of bad closure.Various optimizations.09-07-2011 Added Getch() function.Better error handling all around.Put back color attribute constants as they are more symbolic imo.Decreased the standard size of Cin allocation (bit harsh to allocate 2 kb memory each time) - it's now changed to 128 chars.05-06-2011 Added color constants thanks to Warmonger.16-03-2011 Fixed Cin() bug.Cin() isn't returning a trailing CRLF anymore.Fixed startup function, so it should run from SciTE now.15-03-2011 - Initial release.NotesI know Matt Diesel was/is working on large, similar UDF, however i wanted something simpler and easier to use. This is the result. Thoughts? Console.au3
    1 point
  6. Gianni

    String to 2D array

    or even this (copy your data to the clipboard before run this listing) #include <array.au3> ; just to show result Local $aArray1 = StringSplit(StringStripCR(ClipGet()), @LF), $aArray2, $aResult[$aArray1[0]][1] For $i = 1 To $aArray1[0] $aArray2 = StringSplit($aArray1[$i], @TAB) If $aArray2[0] > UBound($aResult, 2) Then ReDim $aResult[$aArray1[0]][$aArray2[0]] For $i2 = 1 To $aArray2[0] $aResult[$i-1][$i2-1] = $aArray2[$i2] Next Next _ArrayDisplay($aResult) edit: skin as Function #include <array.au3> ; just to show result ; $sMyVar = ClipGet() ; from Clipboard to a variable _ArrayDisplay(_VarTo2D($sMyVar)) ; Func _VarTo2D($var, $sSeparator = @TAB) Local $aRows = StringSplit(StringStripCR($var), @LF), $aColumns, $aResult[$aRows[0]][1] For $iRow = 1 To $aRows[0] $aColumns = StringSplit($aRows[$iRow], $sSeparator) If $aColumns[0] > UBound($aResult, 2) Then ReDim $aResult[$aRows[0]][$aColumns[0]] For $iColumn = 1 To $aColumns[0] $aResult[$iRow - 1][$iColumn - 1] = $aColumns[$iColumn] Next Next Return $aResult EndFunc ;==>_VarTo2D
    1 point
  7. FireFox, Try this: $string = ' = ' $text = 'text = autoit' $newtext = StringMid($text, StringInStr($text, " = ") + StringLen($string)) ConsoleWrite($newtext & @CRLF) M23
    1 point
  8. Info

    How to make ini files?

    It just can't get simpler than that: #include <GUIConstants.au3> $MainGUI = GUICreate("INI Stuff", 202, 95, -1, -1) $Input = GUICtrlCreateInput("", 8, 8, 185, 21) $Clear = GUICtrlCreateButton ("Clear Input's Data", 8, 36, 185, 25) $IniWrite = GUICtrlCreateButton("Ini Write", 8, 65, 57, 25, 0) $IniRead = GUICtrlCreateButton("Ini Read", 72, 65, 57, 25, 0) $IniDelete = GUICtrlCreateButton("Ini Delete", 136, 65, 57, 25, 0) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit Case $IniWrite IniWrite ("Ini File.ini", "Input Section", "Input Info", GUICtrlRead($Input)) Case $IniRead GUICtrlSetData ($Input, IniRead ("Ini File.ini", "Input Section", "Input Info", "")) Case $IniDelete IniDelete ("Ini File.ini", "Input Section", "Input Info") Case $Clear GUICtrlSetData ($Input, "") EndSwitch WEnd
    1 point
×
×
  • Create New...