Jump to content

Koder

Active Members
  • Posts

    48
  • Joined

  • Last visited

Everything posted by Koder

  1. The Au3Check.exe output in latest build has changed in a way that breaks jumping to the specified error using TextPad. Previously, I was able to double click the error line and TextPad would jump to file, line and column of the error. Now, the output has quotes around the file, which breaks the error jumping. Does anyone know how to configure TextPad to recognize the quotes in the output? I've played with the "Regular expression to match output" from TextPad but it seems to have no effect, even if I purposely break the expression. Or maybe that change in Au3Check.exe could be rolled back? Thanks! Rick
  2. Same UPX error over here "Unable to execute upx.exe to compress stub file". Virus scanner disabled. Aut2Exe.exe and AutoIt3Wrapper.exe both get the error... I just found it! It's the icon. Whenever the icon path is set, the upx.exe error message is displayed. Rick
  3. Problem solved... I guess the functions do return the same value. I was working with magic packets (I forget who originally posted the code, but big thanks) and the new build would no long generate a proper packet. The problem was the MAC was not formed properly (probably due to changes in binary string handling)... Anyway, I've reworked it and simplified the magic packet function and can now power on my machines... This will work in older versions too by using BinaryString() instead of Binary()... ; Should always return a value of length 102 Func GenerateMagicPacket ( $sMAC) Local $MagicPacket = Binary("0xFFFFFFFFFFFF"), $MACData = Binary("0x" & $sMAC) For $i = 1 To 16 $MagicPacket &= $MACData Next Return $MagicPacket EndFunc
  4. I know the new Binary system is different in build 3.2.3.6... Should the new Binary() return the same value as BinaryString()? If not then how do I get that previous value? Between versions, these are not equal Binary("0xFFFFFFFFFFFF") <> BinaryString("0xFFFFFFFFFFFF") Thanks, Rick
  5. Hey, thanks for the info, I would have kept using @error and never nocticed a download problem until later. Shouldn't @InetGetBytesRead return -1 only when an error has occurred? and return 0 while the connection is still being negotiated? If the connection later fails, -1 would be informative. Otherwise @InetGetBytesRead = -1 means different things during the course of the download. I could check for -1 at the start of the loop, but then what if it's a real error? Does @InetGetActive change to 0 at the same time? With @InetGetBytesRead = 0 until the connection starts, there is no special case required and @InetGetBytesRead can be used directly without being cleaned up from -1. So the real question is, what does a real error look like (if it occurs during a download that starts normally)? Ok, I've coded the answer to my question below and yes, this does work. But I still have no way of knowing what a real error will look like. Do I know that @InetGetActive wil change to 0 when my network cable is pulled out? $rc = InetGet($URL, $Local & "\" & $Files[$i], 0, 1) while @InetGetActive $LastBytes = @InetGetBytesRead if @InetGetActive == 1 AND $LastBytes == -1 Then ; Not an Error? ; server still connecting? $LastBytes = 0; prevents progress bar from using -1 ElseIf @InetGetActive == 0 AND $LastBytes == -1 Then ; Real error? ; Hard to test, pull the NIC cable on a large file? exitloop Endif ProgressSet(($LastBytes / $size) * 100, "", "") wend if @InetGetBytesRead == -1 Then ; Real error endif By the way this code fragment is intentionally, unnecessarily complicated. Valik, your example is better. I'm only complaining a bit about -1 not being a real error. Thanks! Rick
  6. I wrote a 'pre-search' for mine flags ages ago. I went nuts and made it random so it would look cool. I think it cheats too much... It can finish any grid in 1 second. I wrote another script that will 'play' without cheating. It actually won a game in about 10 seconds, unfortunately it was all luck. The algorithm gives me a headache just thinking about it. I like the un-sort function (ArrayRandomize2). Should be standard #CS Rick W Computer Cheats at Minesweeper # 2 Works on any size grid (without reason) Computer plays minesweeper extremely fast - 1 second on expert #CE Opt("MouseClickDelay", 0) Opt("MouseClickDownDelay", 0) Opt("WinTitleMatchMode", 3) ; Exit via Ctrl-Alt-X HotKeySet("^!x", "MyExit") global $title = "Computer Cheats at Minesweeper" global $win = "Minesweeper" global $Width, $Height, $wX, $wY, $X, $Y, $X1, $Y1, $X2, $Y2 global $i, $j, $color, $color1, $Cols, $Rows, $size If WinExists($win) = 0 then Run(@SystemDir & "\winmine.exe") Sleep(500) endIf WinActivate($win) Sleep(50) ; Get Minesweeper info $size = WinGetPos($win) $wX = $size[0] $wY = $size[1] $Width = $size[2] $Height = $size[3] ; Start coords of mine grid -relative to window $X1 = 16 $Y1 = 97 ; End coords of mine grid -relative to window $X2 = $Width - 11 $Y2 = $Height - 11 ; size of each box;W=16;H=16 ; Determine Grid size from window size $Cols = int(($X2 - $X1 + 1) / 16) $Rows = int(($Y2 - $Y1 + 1) / 16) if MsgBox(4, $title, "Ready?" & @CR & @CR & "Cols: " & $Cols & @CR & "Rows: " & $Rows & @CR ) <> 6 then exit Opt("MouseCoordMode", 0) Opt("PixelCoordMode", 1) WinActivate($win) ;MouseMove($Width / 2, 69) MouseClick("left", $Width / 2, 69, 1, 0); click new game ; Send happy fun code Send("xyzzy{RSHIFT}{ENTER}") ; Pre calculate X Y cordinates and save to an array (for random looping later on) global $aXY[$Rows * $Cols][2] global $k = 0 For $i = 0 to $Rows - 1 $Y = int($Y1 + (($Y2 - $Y1) / $Rows * ($i + 1)) - 8) For $j = 0 to $Cols - 1 $X = int($X1 + (($X2 - $X1) / $Cols * ($j + 1)) - 8) $aXY[$k][0] = $X $aXY[$k][1] = $Y $k += 1 Next Next sleep(300) ; Must be 1, this version will not work without pre-search global $PreSearch = 1 ; Find Mines & remove from array - does not count against time if $PreSearch Then For $i = 0 to ($Rows * $Cols) - 1 $X = $aXY[$i][0] $Y = $aXY[$i][1] Opt("PixelCoordMode", 1) MouseMove($X, $Y, 0) $color = PixelGetColor(0, 0) If $color = 16777215 Then continueloop ElseIf $color = 0 Then MouseClick("right") $aXY[$i][0] = -1; Remove mines from array $aXY[$i][1] = -1; mucho faster EndIf Next Endif ; Random is not just cool looking it helps! just barely faster.. ArrayRandomize2($aXY) Opt("PixelCoordMode", 0) For $i = 0 to ($Rows * $Cols) - 1 $X = $aXY[$i][0] if $X == -1 then ContinueLoop $Y = $aXY[$i][1] $color1 = PixelGetColor($X - 7, $Y) ; Unclicked/Unknown color If $color1 = 16777215 then MouseMove($X, $Y, 0) MouseClick("left") MouseClick("middle") EndIf Next ; Send happy fun code again to reset the 'mode' Send("xyzzy{RSHIFT}{ENTER}") Exit(0) ; Exit via Ctrl-Alt-X Func MyExit() Exit EndFunc ; UN-sorts a 2 dimensional array - 2 passes Func ArrayRandomize2 ( ByRef $a) local $Idx1, $Idx2 local $Ubound = UBound($a, 1), $i, $tmp For $i = 0 to $Ubound * 2 $Idx1 = Random(0, $Ubound - 1) $Idx2 = Random(0, $Ubound - 1) $tmp = $a[$Idx1][0] $a[$Idx1][0] = $a[$Idx2][0] $a[$Idx2][0] = $tmp $tmp = $a[$Idx1][1] $a[$Idx1][1] = $a[$Idx2][1] $a[$Idx2][1] = $tmp Next EndFunc
  7. InetGet() never needed a long pause before @InetGetBytesRead would work properly, I normally use 50 milliseconds. Now it needs at about 500. Why would @InetGetBytesRead return -1 if @InetGetActive is 1? In my script I check the files size (for a progress bar), then download the file. This works with NO problems whatsoever in build 118. Increasing the Sleep() fixes the problem, but how do I know it will work on other machines? A timing problem could be different on different machines. Would a slower Inet connection need a longer sleep time? Here's a cleaned up fragment. The error occurs at $LastBytes = @InetGetBytesRead, which in beta 119 reports -1 (if not paused long enough). For $i = 1 to $count $URL = "FTP:\\Ftp.URL.net\path\" & $Files[$i] $size = InetGetSize($URL) If @error == 1 Then ; report error msg(0,0,"Error: " & $Files[$i]) ExitLoop EndIf ProgressSet(0, "", "") ; Send FTP command to download file $rc = InetGet($URL, $Local & "\" & $Files[$i], 0, 1) If @error == 1 Then msg(0,0,"Error: " & $Files[$i]) Exit(1) EndIf Sleep(50); Error occurs if this sleep is too short... never needed to be any longer than 0 (zero) While @InetGetActive Sleep(10) $LastBytes = @InetGetBytesRead ; Reports -1 if sleep() is too short, but not in 118 If @InetGetBytesRead == -1 Then MsgBox(16, 0, "Download error!" & @CR & @InetGetBytesRead & @CR & $Files[$i]) ExitLoop EndIf ProgressSet((@InetGetBytesRead / $size) * 100, "", "") Wend Next Thanks! Rick
  8. I brought this up ages ago. Sorting should always be case sensitive otherwise the resulting sort is 'undefined'. _ArraySort() returns a differently sorted list depending on the original order because it is not case sensitive. I already have a string compare function but the DLLcall might be faster, Ill have to try that out, thanks.
  9. Good idea! A CMD hotkey should be mandatory! AutoIt hotkeys can interfere with other programs so I just use start menu hotkeys. This script puts a hotkey onto the default shortcut for these apps. It only runs once with no need to leave an AutoIt app running. ; ; Hot keys on shortcuts ; dim $a_Lnks[5][2] ; DOS Ctrl+Alt+D $a_Lnks[0][0] = @StartMenuDir & "\Programs\Accessories\Command Prompt.lnk" $a_Lnks[0][1] = "^!d" ; Notepad Ctrl+Alt+N $a_Lnks[1][0] = @StartMenuDir & "\Programs\Accessories\Notepad.lnk" $a_Lnks[1][1] = "^!n" ; Wordpad Ctrl+Alt+W $a_Lnks[2][0] = @StartMenuCommonDir & "\Programs\Accessories\WordPad.lnk" $a_Lnks[2][1] = "^!w" ; Calulator Ctrl+Alt+Shift+3 $a_Lnks[3][0] = @StartMenuCommonDir & "\Programs\Accessories\Calculator.lnk" $a_Lnks[3][1] = "^!+3" ; Paint Ctrl+Alt+P $a_Lnks[4][0] = @StartMenuCommonDir & "\Programs\Accessories\Paint.lnk" $a_Lnks[4][1] = "^!p" For $i = 0 to ubound($a_Lnks, 1) - 1 If FileExists($a_Lnks[$i][0]) == 1 then $det = FileGetShortcut($a_Lnks[$i][0]) If StringInStr($det[3],"-HK") == 0 then; Skip shortcuts that have already been modified FIleCopy($a_Lnks[$i][0], $a_Lnks[$i][0] & ".bak", 0) FileSetAttrib($a_Lnks[$i][0] & ".bak", "+H") FileCreateShortcut($det[0],$a_Lnks[$i][0], $det[1], $det[2], $det[3] & "-HK", $det[4], $a_Lnks[$i][1], $det[5], $det[6]) EndIf EndIf Next I also have a context menu for folders. This will open a DOS prompt, even to UNC paths using pushd. ; Open a Command Prompt to current folder RegWrite("HKEY_CLASSES_ROOT\Directory\shell\cmd", "", "REG_SZ", "Open CMD Here") ; This will open the command prompt on UNC shares RegWrite("HKEY_CLASSES_ROOT\Directory\shell\cmd\command", "", "REG_SZ", 'cmd.exe /k "pushd %L"')
  10. Ok, I remangled my code to work with alternate RDP ports and multiple connections. It will now report all terminal services connected IP address. Tested on a TS server with multiple connections... Use this command line in a script to be transparent to the user. RDP_Client -ip -s I use BGInfo so this script writes to a registry location that BGInfo uses. BGinfo then collects this datum (among others) and writes to a SQL server. The script can be easily modified to write to a file or do anything else with the data... RDP_Client.au3
  11. BF2 uses Punkbuster which *I think* can detect memory access from other programs. If online, it could label you as a cheater, so be careful.
  12. @IPAddress1 in my code is used only for parsing the netstat results. That's how it can tell it's an incoming connection. I didn't account for the possiblity of incoming connections on other NICs or multiple connections for that matter. @CyberSlug: Hey that's a good idea. Just pull the port from the registry. I do use alternate ports for forwarding to multiple machines, so this could help right away.
  13. Yeah, this kicked my butt a while back. Here's the script that I whipped up once I figured it out. This script does a netstat.exe -TCP and parses the output, looking for port 3389. Then it displays a message and writes the results to the registry for use with BGInfo. There are command line parameters for use in a BAT file... ; --------------------------------------------------------------------------- ; AutoIt Version: 3.1.1.+ beta ; Author: Rick Weber ; ; Script Function: ; Displays the current RDP user IP or Name and Writes it to the registry for BGInfo ; ; Command line stuff ; -? Help ; -s Silent mode - to use in a start up script ; -ip use IP rather than name ; --------------------------------------------------------------------------- dim $TempF, $TFile, $cmd dim $value, $pos1, $pos2, $silent = 0 dim $ComputerName=@ComputerName dim $RDP=":3389" dim $Key = "HKLM\SOFTWARE\BGInfo" dim $KeyU = "HKCU\SOFTWARE\BGInfo" dim $ValName = "RDPclient" dim $IP = "" dim $title = "RDP Client Address" dim $IsClient = "the client" ; Extended command line paramerters If $CmdLine[0] > 0 then For $i = 1 to $CmdLine[0] Switch $CmdLine[$i] Case "-s", "/s" $silent = 1 Case "-ip", "/ip" $IP = "-n " $ComputerName=@IPAddress1 Case "-?", "/?" MsgBox (0, $title,"Writes the RDP client address to the Registry" & @CR & _ $KeyU & "\" & $ValName & @CR & @CR & _ "-? Help" & @CR & _ "-s Silent mode - for BAT files" & @CR & _ "-ip Use IP Address rather than Computer Name") exit(0) EndSwitch Next EndIf $TempF = EnvGet("TEMP") & "\rdpclient.txt" ; Run netstat $cmd = @SystemDir & "\netstat.exe -p TCP " & $IP & "|find """ & $ComputerName & $RDP & """>" & $TempF RunWait(@ComSpec & " /c " & $cmd, "", @SW_HIDE) ; Parse the results of netstat $TFile = FileOpen($TempF, 0) $value = FileReadLine($TFile) $pos1 = StringInStr($value,":") + 1 $pos2 = StringInStr($value,":",0,2) - $pos1 $value= StringMid($value, $pos1, $pos2) if StringLeft($value, 4) = "3389" then $IsClient = "remote desktop client" elseif $value = "" then $IsClient = "unknown (probably the local host, RDP not in use)" else $IsClient = "the local host" endif $pos1 = StringInStr($value," ") + 1 $value= StringStripWS(StringMid($value, $pos1),1) if $value = "" then $value="NA"; this happens when run locally ; Write results to registry RegWrite($Key, $ValName, "REG_SZ", $value) RegWrite($KeyU, $ValName, "REG_SZ", $value) ; Display results - or not if $silent = 1 then exit(0) Inputbox($title,"Remote Desktop client address:" & @CR & @CR & "address = " & $IsClient, RegRead($KeyU, $ValName),"",400,-1)
  14. A static variable is not a constant. A static retains it's value between calls to a function and can only be changed within that function. Useful for keeping track of stuff like recursion depth.
  15. I can't seem to find anything about static local variables in AutoIt. Static locals are much more convenient than using globals. With gloabls you must scan for variable names that happen to match in different functions. Right now I tend to use ByRef variables in place of globals... Statics are good for recursion and various data structures. Anyway, I was just curious...
  16. TCPRecv() does not pause! At least it didn't back when I wrote an all AutoIt SMTP email function. I put all my TCPRecv()'s into loops (until they get what's expected) or they almost always miss something. Here's a function I wrote that illustrates the idea of waiting for a response from a server. Once I started using this all my TCP stuff started working. ; ; Does a TCPSend() and waits (default 20 seconds) for a response with TCPRecv() ; Func _TCPQuery ( $Sckt, $data, $TO = 20000) local $rc, $begin $rc = TCPSend($Sckt, $data) if $rc == 0 then SetError(@error) return "" EndIf $begin = TimerInit() Do Sleep(50) $rc = TCPRecv($Sckt, 1024) SetError(@error) Until ($rc <> "") OR (TimerDiff($begin) > $TO) Return $rc EndFunc
  17. It looks like it rapidly creates new label controls as a 'second hand'. I'm afraid to run this, I only have 2 gigabytes of ram Maybe drawing pixels would consume less memory.... Yep, memory usage goes up like crazy, pixels are cheaper but I don't know how to make them stick (they get painted over and disappear).
  18. That is cool... I'm fighting the urge to rewrite it so that the mines are in a smiley face. Must do work instead, arrg...
  19. My new script now does expert in 1 second. It's not pretty, but it is pretty cool. It 'pre-scans' (the not pretty part) the grid which does not count against the clock then solves by randomly clicking (the pretty cool part). I discovered a new way to click that made it happen. Apparently you can middle click to expose cells if all the surrounding mines have been discovered. Middle clicking does not work as well if you go in sequential order since many (as much as half) of the cells are already exposed. I click randomly but never on an already exposed cell (or mine). So, I get the optimum speed... 1 second, on expert even. #CS Computer Cheats at Minesweeper # 2 Works on any size grid (within reason) Computer plays minesweeper extremely fast - 1 second on expert Inspired by "Freekills Minesweeper Cheats" #CE Opt("MouseClickDelay",0) Opt("MouseClickDownDelay",0) Opt("WinTitleMatchMode", 3) ; Exit via Ctrl-Alt-X HotKeySet("^!x", "MyExit") dim $title = "Computer Cheats at Minesweeper" dim $win = "Minesweeper" dim $Width, $Height, $wX, $wY, $X, $Y, $X1, $Y1, $X2, $Y2 dim $i, $j, $color, $color1, $Cols, $Rows If WinExists($win) = 0 then Run(@SystemDir & "\winmine.exe") Sleep(500) endIf WinActivate($win) Sleep(50) ; Get Minesweeper info $size = WinGetPos($win) $wX = $size[0] $wY = $size[1] $Width = $size[2] $Height = $size[3] ; Start coords of mine grid -relative to window $X1 = 16 $Y1 = 97 ; End coords of mine grid -relative to window $X2 = $Width - 11 $Y2 = $Height - 11 ; size of each box;W=16;H=16 ; Determine Grid size from window size $Cols = int(($X2 - $X1 + 1) / 16) $Rows = int(($Y2 - $Y1 + 1) / 16) if MsgBox(4, $title, "Ready?" & @CR & @CR & "Cols: " & $Cols & @CR & "Rows: " & $Rows & @CR ) <> 6 then exit Opt("MouseCoordMode", 0) Opt("PixelCoordMode", 1) WinActivate($win) ;MouseMove($Width / 2, 69) MouseClick("left", $Width / 2, 69, 1, 0); click new game ; Send happy fun code Send("xyzzy{RSHIFT}{ENTER}") ; Pre calculate X Y cordinates and save to an array (for random looping later on) dim $aXY[$Rows * $Cols][2] dim $k = 0 For $i = 0 to $Rows - 1 $Y = int($Y1 + (($Y2 - $Y1) / $Rows * ($i + 1)) - 8) For $j = 0 to $Cols - 1 $X = int($X1 + (($X2 - $X1) / $Cols * ($j + 1)) - 8) $aXY[$k][0] = $X $aXY[$k][1] = $Y $k += 1 Next Next sleep(300) ; Must be 1, this version will not work without pre-search $PreSearch = 1 ; Find Mines & remove from array - does not count against time if $PreSearch Then For $i = 0 to ($Rows * $Cols) - 1 $X = $aXY[$i][0] $Y = $aXY[$i][1] Opt("PixelCoordMode", 1) MouseMove($X, $Y, 0) $color = PixelGetColor(0, 0) If $color = 16777215 Then continueloop ElseIf $color = 0 Then MouseClick("right") $aXY[$i][0] = -1 $aXY[$i][1] = -1 EndIf Next Endif ; Random is not just cool looking it helps! just barely faster.. ArrayRandomize2($aXY) Opt("PixelCoordMode", 0) For $i = 0 to ($Rows * $Cols) - 1 $X = $aXY[$i][0] if $X == -1 then ContinueLoop $Y = $aXY[$i][1] $color1 = PixelGetColor($X - 7, $Y) ; Unclicked/Unknown color If $color1 = 16777215 then MouseMove($X, $Y, 0) MouseClick("left") MouseClick("middle") EndIf Next ; Send happy fun code again to reset the 'mode' Send("xyzzy{RSHIFT}{ENTER}") Exit ; Exit via Ctrl-Alt-X Func MyExit() Exit EndFunc ; UN-sorts a 2 dimensional array - 2 passes Func ArrayRandomize2 ( ByRef $a) local $Idx1, $Idx2 local $Ubound = UBound($a, 1), $i, $tmp For $i = 0 to $Ubound * 2 $Idx1 = Random(0, $Ubound - 1) $Idx2 = Random(0, $Ubound - 1) $tmp = $a[$Idx1][0] $a[$Idx1][0] = $a[$Idx2][0] $a[$Idx2][0] = $tmp $tmp = $a[$Idx1][1] $a[$Idx1][1] = $a[$Idx2][1] $a[$Idx2][1] = $tmp Next EndFunc
  20. My script does not click on (or move the mouse to) every box, it also places the mine flag where mines are found. So, it's possible to end the game before the entire grid has been examined. To see it, run on a custom grid, 24 by 30 with only 10 mines, you'll see it skip the empty space.
  21. Not to nitpick... maybe a little, but this is not encryption, it's encoding. ROT13/ Base64 are a common encoding algorithms.. DES or Blowfish are types of encryption. The difference is that something that is encoded can be cracked just by knowing the algorithm while encryption can not be cracked with the just the algorithm (not that some don't have big holes). I have a similar encoding algorithm based on ROT13 and it rotates based on a password, it becomes increasingly more complex as the password increases in size but given enough time it could be easily cracked by hand.
  22. As an example of using kernel32 to do memory access, this is pretty neat. But as a minesweeper cheat, it's a bit slow. Here's a minesweeper that cheats really fast, 4 seconds on expert , but no memory access. #CS Computer Cheats at Minesweeper Works on any size grid (within reason) Computer plays minesweeper extremely fast Inspired by "Freekills Minesweeper Cheats" #CE Opt("MouseClickDelay",0) Opt("MouseClickDownDelay",0) Opt("WinTitleMatchMode", 3) ; Exit via Ctrl-Alt-X HotKeySet("^!x", "MyExit") ; MouseMove speed where applicable dim $speed = 0 dim $title = "Computer Cheats at Minesweeper" dim $win = "Minesweeper" dim $Width, $Height, $wX, $wY, $X, $Y, $X1, $Y1, $X2, $Y2 dim $i, $j, $color, $color1, $color2, $pos, $Cols, $Rows If WinExists($win) = 0 then Run(@SystemDir & "\winmine.exe") Sleep(500) endIf WinActivate($win) Sleep(50) ; Get Minesweeper info $size = WinGetPos($win) $wX = $size[0] $wY = $size[1] $Width = $size[2] $Height = $size[3] ; Start coords of mine grid -relative to window $X1 = 16 $Y1 = 97 ; End coords of mine grid -relative to window $X2 = $Width - 11 $Y2 = $Height - 11 ; size of each box;W=16;H=16 ; Determine Grid size from window size $Cols = int(($X2 - $X1 + 1) / 16) $Rows = int(($Y2 - $Y1 + 1) / 16) if MsgBox(4, $title, "Ready?" & @CR & @CR & "Cols: " & $Cols & @CR & "Rows: " & $Rows & @CR ) <> 6 then exit AutoItSetOption("MouseCoordMode", 0) AutoItSetOption("PixelCoordMode", 1) WinActivate($win) MouseClick("left", $Width / 2, 69, 0); click new game ; Send happy fun code Send("xyzzy{RSHIFT}{ENTER}") ;WinActivate($win) For $i = 1 to $Rows For $j = 1 to $Cols ; Center of each box $X = int($X1 + (($X2 - $X1) / $Cols * $j) - 8) $Y = int($Y1 + (($Y2 - $Y1) / $Rows * $i) - 8) AutoItSetOption("PixelCoordMode", 0) $color1 = PixelGetColor($X - 7, $Y) AutoItSetOption("PixelCoordMode", 1) ; Unclicked/Unknown color If $color1 = 16777215 then ; Waive the mouse around a bit to get the pixel ; Center MouseMove($X, $Y, 0) $color = PixelGetColor(0, 0) ;If NOT $color = 0 Then If $color = 16777215 Then ;tooltip("cheat pixel: " & $color, $wX, $wY - 20) MouseClick("left") ElseIf $color = 0 Then ;continueloop MouseClick("right") Else ;tooltip("cheat pixel: " & $color, $wX, $wY - 20) tooltip("cheat mode seems disabled...", $wX , $wY - 20) Send("xyzzy{RSHIfT}{ENTER}") EndIf EndIf Next;j Next;i
  23. I have a very similar UDF that I used in Winrunner. Case in-sensitive is irrelevant if used to sort, so my UDF is either ASCII sensitive or not. In effect it sorts (helps sort) just like AutoIt only that upper case comes 1st, consistantly. Func alphanum_compare ( $item1, $item2, $NotASCII = 0) local $rc = 0, $count = StringLen($item1), $i = StringLen($item2) if $count < $i then $count = $i $i = 0 if isnumber($item1) AND isnumber($item2) then $rc = $item1 - $item2 else while($rc == 0 AND $i < $count) $i = $i + 1 $rc = asc(StringMid($item1,$i,1)) - asc(StringMid($item2,$i,1)) wend if $NotASCII AND $rc <> 0 then;don't bother to compare exact duplicates $NotASCII = $rc; save the last $rc value $item1 = StringLower($item1) $item2 = StringLower($item2) $rc= 0 $i = 0 while($rc == 0 AND $i < $count) $i = $i + 1 $rc = asc(StringMid($item1,$i,1)) - asc(StringMid($item2,$i,1)) wend if $rc == 0 then $rc = $NotASCII;The difference must be due to case endif endif endif return $rc EndFunc No pretty return codes, just positive, negative or zero. I tacked on the NotASCII part just today to make it compatible with the built in stuff. So it's not just me that's noticed this problem. This is a defect, but is it the AutoIt operators or the Array.au3 UDF's?
  24. I've noticed, what could be a problem, with the overloaded operators when doing string comparisons. = and == are different in that one is case sensitive and the other is not, however there is no similar case sensitive operators for < and >.... This problem shows up when sorting and searching arrays. An array with similar multi-case strings will be sorted differently depending on the original array. I discovered this with a multi-dimensional array that stores font info for individual characters, that needs to be binary searched often. In this array, case is important, but the UDF _Array functions will not work. Even if the array is sorted manually, _ArrayBinarySearch() will not always return the correct value. After researching the issue I've noticed that many of the _Array search and sort functions are algorithms taken directly from example functions in C (strongly typed). These example functions are usually for integers only, since C doesn't (normally) do alphabetic string comparisons. So that leads me to the whole issue of sorting. I have always sorted by ASCII values which is vastly different from how AutoIt sorts. But AutoIt does not sort consistently ("A" and "a" sort different depending on when the sort algorithm gets to it, not based on value). So which is correct? ASCII sorting or AutoIt sorting? If AutoIt sorting is correct then AutoIt has either flawed operators or flawed use of those operators. I have found a way to use the existing operators to detect and properly sort (but not ASCII sort) an array. When sorting case-insensitive values, it must still be decided which value is greater when case is the only difference, otherwise the same data can be returned in an undefined sort. if $rc = $value Then ; A match (but maybe not a case sens match) if $rc == $value Then return $Mid ; a True case-sensitive match ;else not a case-sensitive match ; There is still a problem! endif In the above example the if the case does not match, where should the search resume high or low? In AutoIt this is undefined, so the sort and search functions must be coordinated in order to work properly, this could break other code that happens to do it differently. I had to create a bunch of ASCII sort and search UDF's that use quick and shell sorts. These work great but have an extra string compare UDF. I could post them once I figure out how and if anyone cares
  25. If I can dig up some DLL's I'll give it a try. I would like to get WinRunner screen text recognition working in AutoIt...
×
×
  • Create New...