Jump to content

Variables in GuiCtrlCreateListViewItem


ciffer
 Share

Recommended Posts

Hi!

I am trying to make a bot that looks for pixels colors and such but i cant finish my work because of this error:

CODE

...

Func szukaj()

MsgBox(0, "", "Umieść kursor nad danym kolorem i naciśnij ENTER")

Kolor()

$opis=">.<"

$kolor_hex=hex($kolor)

GuiCtrlCreateListViewItem($kolor & '|' & $kolor_hex & '|' & $opis, $lista)

EndFunc

...

And error is:

D:\Documents and Settings\User\Pulpit\Skrypt\Centrum.au3 (22) : ==> Variable used without being declared.:

$kolor_hex=hex($kolor)

$kolor_hex=hex(^ ERROR

And if i will temporarily delete 'k$olor_hex' var and change it to '$kolor' it makes another error:

D:\Documents and Settings\User\Pulpit\Skrypt\Centrum.au3 (21) : ==> Variable used without being declared.:

GuiCtrlCreateListViewItem($kolor & '|' & $kolor & '|' & $opis, $lista)

GuiCtrlCreateListViewItem(^ ERROR

Function 'Kolor' and '$kolor' var works fine for sure. So can anyone help me? T_T

Edited by ciffer
Link to comment
Share on other sites

Is $kolor a local varible within one of you functions? If so, it is only visible to code running inside that function, not in the szukaj() function.

:D

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

I will check this out and post the result :D

@edit

Gimme a hug man @_@

It works like i wanted it to ;) Beer for you :P

@edit 2

Is there anything that i can do to save contents of list? Some button or such ;p

Edited by ciffer
Link to comment
Share on other sites

I will check this out and post the result :D

@edit

Gimme a hug man @_@

It works like i wanted it to :P Beer for you :P

@edit 2

Is there anything that i can do to save contents of list? Some button or such ;p

If you are still talking about your $kolor variable, just declare it Global near the top of the script (outside of any function). Then the value will be, well... Global.

;)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Yeah i did it and it works just as i wanted ;] But when i close script i lose all the records in list, so i want to save it somehow... but im a total newbie :P"

You could save it to an ini file with IniWrite().

You could save it to another file with FileWrite() or FileWriteLine().

You could save it to a registry key with RegWrite().

You could spend a little time reading the help file and trying out the example scripts for all the above...

:D

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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...