Jump to content

gruntydatsun

Active Members
  • Posts

    289
  • Joined

  • Last visited

About gruntydatsun

  • Birthday 01/01/1972

Profile Information

  • Location
    Australia

Recent Profile Visitors

399 profile views

gruntydatsun's Achievements

  1. I have an XML file and every time there are three lines in a row with only <null/> in them, i want to insert a fourth line with <null/>. Each line starts with 3 white spaces, followed by <null/> and ends with a white space followed by CR LF. The presence of the three lines as described is unique to the points where I want to insert a line in this document. I'm trying to figure out how to apply the repeating part of a regex {1,4} but apply it to this whole segment. So far I have the below which picks up an individual line ok: ^\s{3}<null/>\s\r\n I tried wrapping it all in braces () then adding {3} but I'm obviously getting something wrong. Attached is a section from the xml file with a block of nulls that should be matched if anyone would like to have a look. Help_From_Forum.xml
  2. @FrancescoDiMuro ... mate that is needlessly combative. Is it normal behaviour here these days to attack people who are trying to help?
  3. looks like you're spoiled for choice today Vikramjeet Local $string = "AX 123 26OCT ABC 23 1800 UHS TIM XON LIST A12B20C213" Local $sum = 0 $array = StringRegExp($string,"A(\d*?)B(\d*?)C(\d*?)$",3) for $element in $array $sum += $element Next msgbox(1,"SUM",$sum)
  4. or using regular expressions (not my forte so be gentle) Global $FindThis = "Rocks" msgbox(1,"Match on " & $FindThis, GetValue($FindThis)) Func GetValue($SearchTerm) Local $fileA = FileRead(@ScriptDir & "\FileA.txt") Local $fileB = FileRead(@ScriptDir & "\FileB.txt") Local $regex = $SearchTerm & ",(\d.*)" $array = StringRegExp($fileB,$regex,3) if @error = 0 then return $array[0] $array = StringRegExp($fileA,$regex,3) if @error = 0 then return $array[0] EndFunc
  5. here's how i'd do it (error checking left out to make it easy to read) #include <array.au3> #include <file.au3> #include <MsgBoxConstants.au3> Global $arrA, $arrB Global $SearchTerm = "Stones" _FileReadToArray(@ScriptDir & "\FileA.txt",$arrA, $FRTA_NOCOUNT,",") _FileReadToArray(@ScriptDir & "\FileB.txt",$arrB, $FRTA_NOCOUNT,",") msgbox(1,"RESULT","Value of " & $SearchTerm & " is " & GetValue($SearchTerm)) Func GetValue($SearchTerm) $indexB = _ArraySearch($arrB,$SearchTerm) if ($indexB <> -1) Then return $arrB[$indexB][1] $indexA = _ArraySearch($arrA,$SearchTerm) if ($indexA <> -1) Then return $arrA[$indexA][1] EndFunc
  6. you can use the process.au3 library to terminate the other process ProcessExists ProcessWaitClose should do it.
  7. Depending on how big $hFileList is your inner loop could result in $fCount becoming a negative number while inside your inner loop, so the "Until $fCount=0" condition of your outer loop may never be satisfied. If $fCount is being calculated the way you need it to be you could change the last line to: Until $fCount <= 0
  8. If you assign that Runwait command to a variable eg $var = RunWait("someprogram.exe") then var will hold whatever exit code that program generates. If this is an installer for software though you can directly test that the files, registry keys and shortcuts have been created using AutoIT. Run FileMon and RegMon or something like that, do the install. Find all the stuff the installer added. Write autoit code to confirm all those things have been done. It's amazing how easy it is to SAY those things
  9. like Danyfirex says: #include <Array.au3> $array = FileReadToArray(FileOpen(@Scriptdir & "\mult.txt")) for $x = 0 to Ubound($array) - 1 $array[$x] = int($array[$x]) Next _ArraySort($array) _ArrayDisplay($array,"SORTED ARRAY")
  10. For $i = 0 to UBound($FreqArray)-1 ;for every element in the array in turn $FreqArray[$i][0] = Int($FreqArray[$i][0]) ;convert each element into an INT and overwrite self Next _ArraySort($FreqArray) ;sort the array
  11. They don't help with game automation here. Have a look on google and you'll find other autoit forums who'll help you out.
  12. Have a look at the IE library in the helpfile. It will make those operations pretty easy.
  13. PixelSearch returns a two element array so your mouse move would read MouseMove($coord[0],$coord[1])
×
×
  • Create New...