Source language: Translate to:

FileList

Questions about using NeoBook's scripting language

Moderator: Neosoft Support

FileList

Postby Alex » Sun Dec 10, 2006 5:20 am

Hi,

I have a problem, it's with the FileList, I don't understand how it's working.
I have a folder with a lot a history for children, and they have to select one of in the FileList.


Thanks

Alex
Alex
 
Posts: 745
Joined: Sat Mar 04, 2006 4:53 am

Postby Gaev » Sun Dec 10, 2006 7:00 am

Alex:
I have a folder with a lot a history for children, and they have to select one of in the FileList.
... any reason you don't want to use the FileOpenBox command ? ... from the Help file ...
Code: Select all
FileOpenBox

Purpose:
Allow the reader to select a file name using a standard Windows File Open dialog box.

I have a problem, it's with the FileList, I don't understand how it's working.
... also from the (really comprehensive) help file ...
Code: Select all
FileList

Purpose:
Generate a list of files and/or folders found in the specified path.
 
Syntax:
FileList "file mask" "options" "variable"

file mask:
The path and file name mask to search. The mask can include wildcard characters. For example, “C:\Sample\*.*” will list all files in the C:\Sample folder.

options:
Can include any combination of the following:

Files:
Include files in the list.
 
Folders:
Include folders in the list
 
NoExt:
Remove extensions from file names before adding them to the list.

variable:
The name of the variable to store the list. Multiple files will be separated by carriage returns.
 
Example:
The following example compiles a list of all JPEG images in the “C:\My Photos” folder and stores them in a variable called [Pics]:

FileList "C:\My Photos\*.jpg" "Files+NoExt" "[Pics]"
... can you tell us which part of this you don't understand ? ... unlike the FileOpenBox command, the list of files is not displayed to the user for selection ... but stored in the specified [variable] ... separated by carriage return characters ([#13]) ... so if you want to have user select one of them, you have to load this into a ListBox ... and do what you need to do when the user makes a selection in the ListBox's Selection Changed section.
User avatar
Gaev
 
Posts: 3734
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Postby Alex » Sun Dec 10, 2006 9:36 am

Look, I have a folder with 42 historys for children, when I push the button, it select one of and show one of history in the variable [Result] and the Neobook Team said to me, I need a Filebox to select the history what I want.

Thanks

Alex
Alex
 
Posts: 745
Joined: Sat Mar 04, 2006 4:53 am

Postby Gaev » Sun Dec 10, 2006 10:33 am

Alex:

In your first post you said ...
I have a folder with a lot a history for children, and they have to select one of in the FileList.
... and in your next post you said ...
when I push the button, it select one of and show one of history in the variable [Result]
... are you designing your application so ...

a) they (users) get to pick one of the 42 history files

or

b) your program picks a history file from the list ... either the next one in sequence or randomly


... the solutions for each are very different.

Look, I have a folder with 42 historys for children
... what are the file extensions of these "history" files ?
User avatar
Gaev
 
Posts: 3734
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Postby Alex » Sun Dec 10, 2006 11:40 am

First my idea was to have a push button with the variable [Result] to have the history, but the neobook Team said I need a FileList, also I need a FilList with all my history.
Alex
 
Posts: 745
Joined: Sat Mar 04, 2006 4:53 am

Postby Gaev » Sun Dec 10, 2006 1:02 pm

Alex:

I can't help you if you don't answer the questions I asked in my last post.

I realize that English may not be your first language ... but the language of problem solving is universal ...

Step #1 Define your problem/requirement

Step #2 Devise a solution

... I don't know what your Step #1 is ... (a) or (b) ? ... and (once again) ...

Question: What are the file extensions of these "history" files ?
User avatar
Gaev
 
Posts: 3734
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Postby Alex » Mon Dec 11, 2006 7:58 am

Hi,

New :

I have a pushbutton [PushButton1], a Text with the variable [Result] and 42 history for children extend by *.txt

When I have Pushed the button, one of the history (C:\History\) is read with the function FileToVar.

My problem is, I don't know how a program can take randomly a document.


Thanks

Alex
Alex
 
Posts: 745
Joined: Sat Mar 04, 2006 4:53 am

Postby Gaev » Mon Dec 11, 2006 8:48 am

Alex:

Try this in the Left Click section of your PushButton1 ...
Code: Select all
... get the list of files in the folder
FileList "!C:\History\*.txt" "Files" "[myHistoryFiles]"
... turn variable to array
StrParse "[myHistoryFiles]" "[#13]" "FileName" "[FileCount]"
... get random number
Random "[FileCount]-1" "[RandomFileNumber]"
SetVar "[RandomFileNumber]" "[RandomFileNumber]+1"
... load file into variable
FileToVar "!C:\History\[FileName[RandomFileNumber]]" "[Result]"
User avatar
Gaev
 
Posts: 3734
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Postby Alex » Mon Dec 11, 2006 9:45 am

Hi,

I never understand what is [#13] ?

Thanks

Alex
Alex
 
Posts: 745
Joined: Sat Mar 04, 2006 4:53 am

Postby HPW » Mon Dec 11, 2006 10:33 am

Neobook help file should be your first choice:

From help:
Note: The [#13] code above is used by NeoBook to indicate a carriage return.
Hans-Peter
User avatar
HPW
 
Posts: 2520
Joined: Fri Apr 01, 2005 11:24 pm
Location: Germany

Postby Alex » Mon Dec 11, 2006 10:57 am

Thank you very much Gaev and HPW

Alex
Alex
 
Posts: 745
Joined: Sat Mar 04, 2006 4:53 am

Postby smartmedia » Sat May 05, 2007 11:34 am

Hi...

I have the following problem with Filelist command...
This is my code

FolderBox "Select a Folder:" "[Folder]"
SetVar "[Folder]" "[Folder]\"
FileList "[Folder]*.mp3" "Files+Folders" "[FileList]"
FileWrite "[PubDir]temp.lst" "All" "[FileList]"

Now if i choose c:\program files\ from folder box then i don't get the mp3 that stay in C:\Program Files\NeoBook 4\Pub\Media Player\songs\
why...???
If i have mp3 on c:\program files\ or c:\program files\1\ i will get it...

The way i see it, is not searching in subfoders. If this is true can be fixed...???

Also the results in the temp file are like this:
ΑΚΟΜΑ Σ'ΑΓΑΠΑΩ.mp3(square)ΑΜΑΡΤΩΛΗ.mp3(square)ΑΝ ΣΕ ΘΥΜΗΘΩ.mp3

i need it in lines like this...
ΑΚΟΜΑ Σ'ΑΓΑΠΑΩ.mp3
ΑΜΑΡΤΩΛΗ.mp3
ΑΝ ΣΕ ΘΥΜΗΘΩ.mp3

Thanks
User avatar
smartmedia
 
Posts: 889
Joined: Fri Apr 01, 2005 6:50 am
Location: Hellas

Postby HPW » Sat May 05, 2007 3:08 pm

Also the results in the temp file are like this:
ΑΚΟΜΑ Σ'ΑΓΑΠΑΩ.mp3(square)ΑΜΑΡΤΩΛΗ.mp3(square)ΑΝ ΣΕ ΘΥΜΗΘΩ.mp3


From the help:
The name of the variable to store the list. Multiple files will be separated by carriage returns.

So the squares you see are [#13] which are CR.
So replace the [#13] with [#13][#10].
Hans-Peter
User avatar
HPW
 
Posts: 2520
Joined: Fri Apr 01, 2005 11:24 pm
Location: Germany


Return to NeoBook Action Commands

Who is online

Users browsing this forum: No registered users and 1 guest