Guest BenE223 Posted July 17, 2004 Share Posted July 17, 2004 (edited) Hi, I was trying to make a complex variable, I'll just say it rather than explain it.. it might make more sense of what I'm trying to do. so lets say i have a variable called gpix and I'm wanting it to do a Function inside it like so, kind of like IRC scripting if you've ever done it. $gpixel = 2983299 $gpix = { If PixelGetColor( 395 , 602 ) = $gpixel Then Send("{ENTER}") Else Send("H") EndIf } AutoIt doesn't like using {} so I instead replaced the {} with (). Again I had no luck. Is there something I can do to accomplish doing this? Edited July 17, 2004 by BenE223 Link to comment Share on other sites More sharing options...
pekster Posted July 17, 2004 Share Posted July 17, 2004 A variable holds data and a function executes the code that is inside of the function. A function can contain, create, use, and manipulate variables. Have you taken a look at the helpfile for examples on what variables and functions are? It gives you examples of defining variables, and using functions that will probably help you out a lot. [font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes. Link to comment Share on other sites More sharing options...
Guest BenE223 Posted July 17, 2004 Share Posted July 17, 2004 Thanks, I had read the variable/function in the help file after I couldn't do it but I must of went over it... then I came here, i searched everywhere in the function category including the links (which got me my answer) thanks again. Link to comment Share on other sites More sharing options...
Nutster Posted July 20, 2004 Share Posted July 20, 2004 Hi, I was trying to make a complex variable, I'll just say it rather than explain it.. it might make more sense of what I'm trying to do. so lets say i have a variable called gpix and I'm wanting it to do a Function inside it like so, kind of like IRC scripting if you've ever done it. $gpixel = 2983299 $gpix = { If PixelGetColor( 395 , 602 ) = $gpixel Then Send("{ENTER}") Else Send("H") EndIf } AutoIt doesn't like using {} so I instead replaced the {} with (). Again I had no luck. Is there something I can do to accomplish doing this?What you want is to create a function. The function that will do what you want (I think) would be something like: Func GetKey($colour) If PixelGetColor( 395 , 602 ) = $colour Then Return "{ENTER}" Else Return "H" EndIf EndFunc $gpixel = 2983299 $gpix = GetKey($gpixel) Send($gpix) Notice that the function is told what to find and it determines the key to send. It returns the value to the expression where it was called using the Return keyword. Read the help for Func keyword. David NuttallNuttall Computer Consulting An Aquarius born during the Age of Aquarius AutoIt allows me to re-invent the wheel so much faster. I'm off to write a wizard, a wonderful wizard of odd... 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