Page 1 of 1

Listbox to log file?

PostPosted: Mon Dec 29, 2014 9:00 pm
by fkapnist
.
I want to be able write the entire contents of a listbox to a flat text file (as a log file)...
Is there an easy way to do it? I checked all the utility plugins but didn't find anything.
:?:
.

Re: Listbox to log file?

PostPosted: Mon Dec 29, 2014 9:35 pm
by AsleyCruz
Hi_

"Item Number (1,2,3,...)" must be selected!
Regards!

Image

Code: Select all
.COUNT TOTAL ITEMS
ListBoxSize "ListBox1" "[NumItems]"

.LOOP EVERY LISTBOX ITEMS
Loop "1" "[NumItems]" "[VarPos]"

  .GET CURRENT ITEM TEXT
  ListBoxGetItem "ListBox1" "[VarPos]" "[CurItem]"

  .SAVE CURRENT ITEM IN A TEXT FILE
  FileWrite "C:\SaveToTextFile\File.txt" "Append" "[CurItem]"
EndLoop

Re: Listbox to log file?

PostPosted: Tue Dec 30, 2014 9:47 am
by fkapnist
ernesto wrote:Hi_

"Item Number (1,2,3,...)" must be selected!
Regards!

Image

Code: Select all
.COUNT TOTAL ITEMS
ListBoxSize "ListBox1" "[NumItems]"

.LOOP EVERY LISTBOX ITEMS
Loop "1" "[NumItems]" "[VarPos]"

  .GET CURRENT ITEM TEXT
  ListBoxGetItem "ListBox1" "[VarPos]" "[CurItem]"

  .SAVE CURRENT ITEM IN A TEXT FILE
  FileWrite "C:\SaveToTextFile\File.txt" "Append" "[CurItem]"
EndLoop


Thank you ernesto!

:P
.

Re: Listbox to log file?

PostPosted: Tue Dec 30, 2014 11:06 am
by Gaev
Ernesto, fkapnist:

"Item Number (1,2,3,...)" must be selected!

Not necessary ...the code works just as well when Item Text is selected.

Re: Listbox to log file?

PostPosted: Tue Dec 30, 2014 11:13 am
by AsleyCruz
Gaev wrote:Ernesto, fkapnist:

"Item Number (1,2,3,...)" must be selected!

Not necessary ...the code works just as well when Item Text is selected.


That's true, you right Gaev!

Re: Listbox to log file?

PostPosted: Tue Dec 30, 2014 3:51 pm
by Danito
ListBoxGetItem "ListBox1" "all" "[data]"
FileWrite "[PubDir]log.txt" "All" "[data]"

Re: Listbox to log file?

PostPosted: Tue Dec 30, 2014 4:07 pm
by AsleyCruz
Danito wrote:ListBoxGetItem "ListBox1" "all" "[data]"
FileWrite "[PubDir]log.txt" "All" "[data]"


Many thanks Danito
This is easier than my way to do it!

Regards!