Jump to content

c0re

Members
  • Posts

    11
  • Joined

  • Last visited

Everything posted by c0re

  1. Thanks UEZ! This worked as expected. After dropping those into my includes dir and using _ArrayNaturalSort($aDirs) the resultant array was sorted as expected. I still think it's odd that when I setup a defined test array in the "1234567 : text" format it's able to be sorted with _ArraySort, but if the array is populated in the same format but with data from DirGetSize and _FileListToArray it does not work. Thanks again!
  2. Hi everyone, I'm having some trouble trying to sort a simple array containing a number, a delimiter, and some text. Example - "183942 : data". In my test defined array it works correctly, but when I use _FileListToArray to read in directory names and DirGetSize for the number _ArraySort does not sort as expected. I thought there might be some weird white space or a CR in the element so I tried using StringStripWS and StringStripCR with no success. I do a round when I put the number and text in the array so I thought that might be an issue, I rounded first and then put in array with the same results. I am expecting the array to be sorted from lowest to highest numerically. I'm sure I am just not understanding how _ArraySort is supposed to work, please let me know if you have any advice. This is part of a script that scans a volume, if total disk used in >90% then will grab the size of each directory, the data owners of the top 5 directories on the disk, and email them a note asking to clean up their data. If you know of a existing script that does this please point me to it. Here is some example code that points to c:\program files and tries to sort the directory sizes with names. This example demonstrates sorting numerically does not work as I am expecting. #Include <Array.au3> #include <file.au3> Dim $aDirs[1] Dim $aDirsizeonly[1] Dim $x, $dir, $aMixed, $aNumbers $aMixed = _ArrayCreate("101: text", "1: text", "9224: text", "4239: text", "0: text", "1247: text") $aNumbers = _ArrayCreate("101", "1", "9224", "4239", "0", "1247") $dir = _FileListToArray('c:\program files', "*", 2) If @Error=1 Then MsgBox (16,"Error","No Folders Found.") Exit EndIf For $x = 0 to UBound($dir)-1 $size = DirGetSize('c:\program files\' & $dir[$x], 1) If IsArray($size) Then ;$size1 = Round($size[0] /1024/1024) ;_ArrayAdd($aDirs, $size1 & ' : ' & $dir[$x]) _ArrayAdd($aDirsizeonly, Round($size[0] /1024/1024, 0)) _ArrayAdd($aDirs, Round($size[0] /1024/1024, 0) & ' : ' & $dir[$x]) EndIf Next _ArraySort($aNumbers) _ArrayDisplay($aNumbers, "Defined array - Numbers only. This Works!") _ArraySort($aMixed) _ArrayDisplay($aMixed, "Defined array - Mixed text with Numbers. This Works!") _ArraySort($aDirsizeonly) _ArrayDisplay($aDirsizeonly,"DirGetSize array - Dir size only. This Works!") _ArraySort($aDirs) _ArrayDisplay($aDirs,"DirGetSize array - Dir name with size. This Does Not Sort As Expected.") Thanks in advance!
  3. Thanks for the suggestions guys.
  4. Hi, Is there anyway to link text in a msgbox to an executable? For instance, in the example below is it possible to have the "server1" text do a run function when clicked on? MsgBox(0,"whee" , "Click servername to connect: server1" & @CRLF & "Click servername to connect: server2" & @CRLF & "Click servername to connect: server3" & @CRLF & "Click servername to connect: server3" & @CRLF & "Click servername to connect: server4") Thanks for any help.
  5. That works! Shame on me for not spotting this in the help file, I totally mised those 2 StringStip functions. Thanks for the excellent help.
  6. 1. Thanks for the StdoutRead tip, I'm checking into that. 2. When I pasted in the line I was splitting to the forum post earlier it cut out all the reoccurring spaces for some reason. So, while StringSplit may remove some of the spaces it does not remove them all. I still end up with many spaces in $split. Here is an example of what the array looks like after I do the StringSplit: [0]=30 [1]= [2]= [3]= [4]= [5]= [6]= [7]= gen.exe [8]= [9]= 7160 [10]= ...empty elements to 16 [16] = 3 ...empty elements to 24 [24] = 8 [25] = [26] = [27] = 0 [28] = [29] = 18/09/2006 [30] = 20:21:20 The problem is these empty elements change on me from iteration to iteration, [30] may not contain the time but instead will contain an empty element or no element at all.
  7. Hi everyone, 2 things - Question #1 Is there a way to redirect output from a program to an array instead of a file then reading the file into an array? If I use a line like this: Dim $array $array = RunWait(@ComSpec & " /c " & 'c:\temp\check\psexec.exe \\' & $psiservers[$x] & ' -s -c process.exe -c |findstr -i powersi', 'c:\temp\check', @SW_HIDE)oÝ÷ Øw«z+ìZ^¡ûazËkxßÙ­¯(§Ú,¦X­¶¬¥§²­¡øì^ï^´ßÍ5óý=ÿm4ëm6×mÁ« ¢)à¶h¢a® Mú²b¶·¦¢ø§©e¶rzW¦z{lÂ+a²¶§X¤y«­¢+Ù½ÈÀÌØíÈôÄѼÀÌØíÍÁ±¥ÑlÁt(%ÀÌØíÍÁ±¥ÑlÀÌØíÉtôÅÕ½ÐìÅÕ½ÐìQ¡¸(}ÉÉå±Ñ ÀÌØíÍÁ±¥Ð°ÀÌØíȤ(¹%)9áÐ This bombed with some "Array variable has incorrect number of subscripts or subscript dimension range exceeded" errors so then I tried using UBound($split)-1 instead of $split[0] but got the same errors. I figured I must be doing something wrong as I'm sure many of you do this all the time; so here I am . Any help offered is appreciated. Thanks.
  8. Thanks for the great news! For future reference, should I always look in the beta section for requested bug fix solutions, or is a response usually sent to the person that requested the fix? Thanks for making a great tool and complementing it with excellent Help documentation.
  9. Any update on this? Was a work around made available that I missed? Thanks.
  10. Hi everyone, I'm using AutoIt version 3.1.1 and my OS is Server 2003 EE. On systems with > 2GB of memory MemGetStats always reports 2097151.99902344. I've verified this on 4GB and 6GB systems. On 1GB and 2GB systems memory is reported correctly, or as close as it gets with regards to the different vendor BIOS'. I'm new to AutoIt so I could be using MemGetStats incorrectly, but I copied the example out of the help file. this is how i'm using it: $mem = MemGetStats() MsgBox(0, "Total physical RAM (KB):", $mem[1]). I tried a search on the forums for any information regarding my issue and didn't find any relevant hits. Please tell me if there is a work around for this. Thank you in advance.
×
×
  • Create New...