Salomonsson Posted January 21, 2006 Share Posted January 21, 2006 Hi everybody... All new in this forum, but looking for some help with the amazing program called AutoIT that I downloaded today- together with some scripts. When I try to run a script, say the example calculator¬epad&count-while, they do not work. I will see the calculator, but nothing is being typed.... or the notepad will come up but no text is being auto writed in there.... im running a danish version of windows xp if that does matter... I will offcourse respond in this topic... looking forward to some assistance cheers! Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 21, 2006 Moderators Share Posted January 21, 2006 Welcome to the forums. Want to post the code that isn't working for you that you've tried? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Salomonsson Posted January 21, 2006 Author Share Posted January 21, 2006 offcourse... these are the standards examples and when I run them nothing happens besides calc.exe & notepad.exe opens ?calculator.au3notepad1.au3 Link to comment Share on other sites More sharing options...
MadBoy Posted January 21, 2006 Share Posted January 21, 2006 (edited) Programs don't work because your Windows is Danish. You gotta see what's the title of window when you start Calculator or Notepad. In polish version you would have to change Calculator to Kalkulator, and Notepad to Notatnik and it would work. So all: WinWaitActive("Calculator") WinClose("Calculator") WinWaitClose("Calculator") have to be modified to your language version. Everything should work then. Most AutoIT scripts are based on English version so you gotta check them before running. Edited January 21, 2006 by MadBoy My little company: Evotec (PL version: Evotec) Link to comment Share on other sites More sharing options...
herewasplato Posted January 21, 2006 Share Posted January 21, 2006 Welcome.... It is best to copy/paste the window title (and other info) directly from the AutoIt windows info tool: Start > Programs > AutoIt v3 > AutoIt Window Info later... [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
rudika Posted January 21, 2006 Share Posted January 21, 2006 (edited) offcourse...these are the standards examples and when I run them nothing happens besides calc.exe & notepad.exe opens ?Hi, I`ve modifited your scripts to my language and it realy works - is your windows title realy "Untitled - Notepad"? Edited January 21, 2006 by rudika [font="Comic Sans Ms"][center]Powered by AutoIt3http://www.wik-eric.de/zips/Synchro2.2.2-4free.zip[/center][/font] Link to comment Share on other sites More sharing options...
Salomonsson Posted January 21, 2006 Author Share Posted January 21, 2006 Hi, I`ve modifited your scripts to my language and it realy works - is your windows title realy "Untitled - Notepad"?Thanks for your answers... I works now ) and copying from the AutoIT window is great...Have a new problem now, hope you can help. Get the error "AutoIt ErrorLine 51 (File "C:\.......\....\script.au3"):elseif $action = 4 thenelseif ^ ERRORError: Variable used without being declared"and here are my text from line 51 and 4 sentence downelseif $action = 4 thenControlClick($tablename, "", $RaiseButton);endifWEndanyone know whats wrong? I can give you more info if you need it :"> Link to comment Share on other sites More sharing options...
rudika Posted January 21, 2006 Share Posted January 21, 2006 (edited) Thanks for your answers... I works now ) and copying from the AutoIT window is great...Have a new problem now, hope you can help. Get the error "AutoIt ErrorLine 51 (File "C:\.......\....\script.au3"):elseif $action = 4 thenelseif ^ ERRORError: Variable used without being declared"Did you declare this variable before line 51 - the error message is indicate for it... Edited January 21, 2006 by rudika [font="Comic Sans Ms"][center]Powered by AutoIt3http://www.wik-eric.de/zips/Synchro2.2.2-4free.zip[/center][/font] Link to comment Share on other sites More sharing options...
Salomonsson Posted January 21, 2006 Author Share Posted January 21, 2006 Did you declare this variable before line 51 - the error message is indicate for it...I havent declared"elseif $action = 4 thenControlClick($tablename, "", $RaiseButton);endif"beforebut later in the script I have a line saying"$color = PixelGetColor (338, 88);if $color = 65280 thenWinActivate($tablename);return 4;endifWinActivate($tablename);return 1;EndFunc" Link to comment Share on other sites More sharing options...
greenmachine Posted January 21, 2006 Share Posted January 21, 2006 Since I have a really good idea of what your script is (because it's been on these forums half a million times already), it would be simplest just to put a "global $action" statement at the top with the rest of the globals. Link to comment Share on other sites More sharing options...
Salomonsson Posted January 21, 2006 Author Share Posted January 21, 2006 Since I have a really good idea of what your script is (because it's been on these forums half a million times already), it would be simplest just to put a "global $action" statement at the top with the rest of the globals.there is only one other global action on top....I have all together four of these $action = 1,2,3,4 with some lines under them. Should they all go into global actions?anyone on messenger? write pm perhaps Link to comment Share on other sites More sharing options...
greenmachine Posted January 21, 2006 Share Posted January 21, 2006 $action is a variable. Anything with the $ in front of it is a variable in AutoIt. Variables store data, in this case a number. So $action can be either 1, 2, 3, 4, or none of them. By putting "global $action" at the top of the script, you are saying the $action variable will be used throughout the whole script. I suggest you read this threadhttp://www.autoitscript.com/forum/index.php?showtopic=19434 and the helpfile.Other topics related to your script:http://www.autoitscript.com/forum/index.php?showtopic=20534http://www.autoitscript.com/forum/index.php?showtopic=19764 Link to comment Share on other sites More sharing options...
Salomonsson Posted January 21, 2006 Author Share Posted January 21, 2006 (edited) $action is a variable. Anything with the $ in front of it is a variable in AutoIt. Variables store data, in this case a number. So $action can be either 1, 2, 3, 4, or none of them. By putting "global $action" at the top of the script, you are saying the $action variable will be used throughout the whole script. Other topics related to your script:http://www.autoitscript.com/forum/index.php?showtopic=20534Having the exact same problem as topic 20534. Do you know how this guy figured it out ? have tried to read the post... hmm Edited January 21, 2006 by Salomonsson Link to comment Share on other sites More sharing options...
greenmachine Posted January 21, 2006 Share Posted January 21, 2006 Just post the damn code in here, and I'll edit it the way I've been telling you. Link to comment Share on other sites More sharing options...
Salomonsson Posted January 21, 2006 Author Share Posted January 21, 2006 Just post the damn code in here, and I'll edit it the way I've been telling you.sorry, here you go champ,1_edition.au3 Link to comment Share on other sites More sharing options...
greenmachine Posted January 21, 2006 Share Posted January 21, 2006 Ok, you didn't need to make action a global variable. What you needed to do was fix the indenting and the If/Endif ratio. expandcollapse popup; Pre-initialization : Set Name of Table Global $tablename = "Play money 4014630" ; Initialize Buttons ; These are the button names you might have to change these for different poker clients $FoldButton = "AfxWnd42s20" $CheckButton = "AfxWnd42s20" $CallButton = "AfxWnd42s22" $BetButton = "AfxWnd42s22" $RaiseButton = "AfxWnd42s23" ; Set Coordinate mode to relative to window AutoItSetOption("PixelCoordMode", 0) ; Wait for the window of table to become active WinWaitActive($tablename) ; Main Loop While WinExists($tablename) Sleep(300); $FoldVisible = ControlCommand($tablename, "", $FoldButton, "IsVisible", ""); $RaiseVisible = ControlCommand($tablename, "", $RaiseButton, "IsVisible", ""); If $FoldVisible = 1 Then Sleep(Random(1500, 2500)) $action = GetAction(); ; Fold/Check ; if we can check for free, then do that instead of folding If $action = 1 Then If StringInStr(ControlGetText($tablename, "", $CheckButton), "Check") = 1 Then ControlClick($tablename, "", $CheckButton); Else ControlClick($tablename, "", $FoldButton); EndIf ; Check/Call ;Sleep(Random(0, 2000)); ElseIf $action = 2 Then ControlClick($tablename, "", $CallButton); ; Call/Bet ; if we can call then call otherwise bet ElseIf $action = 3 Then If StringInStr(ControlGetText($tablename, "", $CallButton), "Call") = 1 Then ControlClick($tablename, "", $CallButton); Else ControlClick($tablename, "", $BetButton); EndIf ; Bet/Raise ;Sleep(Random(0, 2000)); ElseIf $action = 4 Then ControlClick($tablename, "", $RaiseButton); EndIf EndIf WEnd ; Poker Inspector Actions Func GetAction() WinActivate("Connected to """ & $tablename); ; red - fold $color = PixelGetColor(338, 55); If $color = 255 Then WinActivate($tablename); Return 1; EndIf ;yellow $color = PixelGetColor(338, 67); If $color = 65535 Then WinActivate($tablename); Return 2; EndIf ; blue $color = PixelGetColor(338, 79); If $color = 16776960 Then ; sometimes bet or just call 50% of the time WinActivate($tablename); Return 3; EndIf ; green $color = PixelGetColor(338, 88); If $color = 65280 Then ; If we've got the nuts or close to then sometimes just check 20% of the time ; otherwise raise or reraise WinActivate($tablename); Return 4; EndIf WinActivate($tablename); Return 1; EndFunc ;==>GetAction ; Checks how many empty seats there are Func OccupiedSeats() Local $Count = 0 Local $SeatOpenColor = 3246765 ;Seat 1 If (PixelGetColor(517, 96) == $SeatOpenColor) Then $Count = $Count + 1; EndIf ;Seat 2 If (PixelGetColor(665, 133) == $SeatOpenColor) Then $Count = $Count + 1; EndIf ;Seat 3 If (PixelGetColor(735, 251) == $SeatOpenColor) Then $Count = $Count + 1; EndIf ; Seat 4 If (PixelGetColor(660, 378) == $SeatOpenColor) Then $Count = $Count + 1; EndIf ; Seat 5 If (PixelGetColor(493, 413) == $SeatOpenColor) Then $Count = $Count + 1; EndIf ; Seat 6 If (PixelGetColor(262, 413) == $SeatOpenColor) Then $Count = $Count + 1; EndIf ; Seat 7 If (PixelGetColor(108, 378) == $SeatOpenColor) Then $Count = $Count + 1; EndIf ; Seat 8 If (PixelGetColor(53, 247) == $SeatOpenColor) Then $Count = $Count + 1; EndIf ; Seat 9 If (PixelGetColor(126, 133) == $SeatOpenColor) Then $Count = $Count + 1; EndIf ; Seat 10 If (PixelGetColor(264, 96) == $SeatOpenColor) Then $Count = $Count + 1; EndIf Return $Count; EndFunc ;==>OccupiedSeats Get Scite if you don't already have it. With Scite is Tidy. Use it often. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now