Jump to content
Sign in to follow this  
ciffer

Variables in GuiCtrlCreateListViewItem

Recommended Posts

ciffer

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

Share this post


Link to post
Share on other sites
PsaltyDS

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

Share this post


Link to post
Share on other sites
ciffer

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

Share this post


Link to post
Share on other sites
PsaltyDS

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

Share this post


Link to post
Share on other sites
ciffer

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 :D"

Share this post


Link to post
Share on other sites
PsaltyDS

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

Share this post


Link to post
Share on other sites
ciffer

Another 3 beers for you :D Tnx for help and sorry for kinda dumb questions ._.

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.