Jump to content

Subscript used with non-Array variable


gosu
 Share

Recommended Posts

This is what I get when I run this code:

$asdf = PixelSearch(290,231,861,699,16738603)
   $x = $asdf[0]
   $y = $asdf[1]
   MouseMove($x,$y,0)
   MouseDown("left")
   MouseMove(180, 750, 0)
   MouseUp("left")

In the help file it says, PixelSearch returns an array. I am confused...

[quote name='d2hacker88' date='Jan 6 2005, 05:10 PM']Can someone please help me out with autoit like gimme a link on how to use it cause i have no experience with computer languages and i'd like to make a program with autoit in order to empress my computer teacher.[right][snapback]52215[/snapback][/right][/quote]

Link to comment
Share on other sites

  • Developers

This is what I get when I run this code:

In the help file it says, PixelSearch returns an array. I am confused...

<{POST_SNAPBACK}>

You need to test for Errors, because the there is only an array return when the function is successful.

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

You need to test for Errors, because the there is only an array return when the function is successful.

<{POST_SNAPBACK}>

Ah, thank you very much. Didn´t know it only returns an array on sucess.

[quote name='d2hacker88' date='Jan 6 2005, 05:10 PM']Can someone please help me out with autoit like gimme a link on how to use it cause i have no experience with computer languages and i'd like to make a program with autoit in order to empress my computer teacher.[right][snapback]52215[/snapback][/right][/quote]

Link to comment
Share on other sites

E.g.

$asdf = PixelSearch(290,231,861,699,16738603)
If not @error then
  $x = $asdf[0]
  $y = $asdf[1]
  MouseMove($x,$y,0)
  MouseDown("left")
  MouseMove(180, 750, 0)
  MouseUp("left")
Else
  msgbox(0,'','Not found')
EndIf
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...