Jump to content
jarmen

Creating records from tabbed data list in text box

Recommended Posts

I had a previous solution in Windows using Sendevent to select a folder, then create a text file of it's contents, then import that list into a field, one tabbed item per record.

"cmd /c cd " & $importdir & "&&" & "dir /b > filelist.txt"

Moving to a OS X, I'm trying to use the excellent BaseElement plugin. I've used BE_ListFilesInFolder to get the list of files in a folder and have it dropped into a text field. The output is tabbed, one item per line. I can't figure out how to create a script to get the contents of that field, and populate each line into a field, one per record. Any ideas?

Share this post


Link to post
Share on other sites
2 hours ago, jarmen said:

The output is tabbed, one item per line.

I am not sure what you mean by "tabbed". I believe the output is a return-separated list. To create a record for each item in the list, make your script do:

Set Variable [ $files; Value:BE_ListFilesInFolder ( "/Users/YourUserName/Documents/SomeFolder" ) ]
Go to Layout [ “Files” ]
Loop
  Set Variable [ $i; Value:$i + 1 ]
  Exit Loop If [ $i > ValueCount ( $files ) ]
  New Record/Request
  Set Field [ Files::Fielname; GetValue ( $files ; $i ) ]
End Loop
Commit Records/Requests 

where "Files" is the table you want to use in order to store these records.

 

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

  • Who Viewed the Topic

    2 members have viewed this topic:
    comment  arni 
×

Important Information

By using this site, you agree to our Terms of Use.