Source language: Translate to:

Listbox to log file?

Questions about using NeoBook's scripting language

Moderator: Neosoft Support

Listbox to log file?

Postby fkapnist » Mon Dec 29, 2014 9:00 pm

.
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.
:?:
.
User avatar
fkapnist
 
Posts: 348
Joined: Mon Nov 17, 2014 4:24 pm
Location: Greece

Re: Listbox to log file?

Postby AsleyCruz » Mon Dec 29, 2014 9:35 pm

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
AsleyCruz
Freelancer - Graphic & Type Designer

FREE NEOBOOK APPS: See Website

.
User avatar
AsleyCruz
 
Posts: 106
Joined: Fri Sep 16, 2011 2:12 pm

Re: Listbox to log file?

Postby fkapnist » Tue Dec 30, 2014 9:47 am

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
.
User avatar
fkapnist
 
Posts: 348
Joined: Mon Nov 17, 2014 4:24 pm
Location: Greece

Re: Listbox to log file?

Postby Gaev » Tue Dec 30, 2014 11:06 am

Ernesto, fkapnist:

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

Not necessary ...the code works just as well when Item Text is selected.
User avatar
Gaev
 
Posts: 3718
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: Listbox to log file?

Postby AsleyCruz » Tue Dec 30, 2014 11:13 am

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!
AsleyCruz
Freelancer - Graphic & Type Designer

FREE NEOBOOK APPS: See Website

.
User avatar
AsleyCruz
 
Posts: 106
Joined: Fri Sep 16, 2011 2:12 pm

Re: Listbox to log file?

Postby Danito » Tue Dec 30, 2014 3:51 pm

ListBoxGetItem "ListBox1" "all" "[data]"
FileWrite "[PubDir]log.txt" "All" "[data]"
User avatar
Danito
 
Posts: 51
Joined: Thu Mar 11, 2010 7:07 pm

Re: Listbox to log file?

Postby AsleyCruz » Tue Dec 30, 2014 4:07 pm

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!
AsleyCruz
Freelancer - Graphic & Type Designer

FREE NEOBOOK APPS: See Website

.
User avatar
AsleyCruz
 
Posts: 106
Joined: Fri Sep 16, 2011 2:12 pm


Return to NeoBook Action Commands

Who is online

Users browsing this forum: No registered users and 2 guests