Jump to content

Creating records from tabbed data list in text box


This topic is 2645 days old. Please don't post here. Open a new topic instead.

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?

Link to comment
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.

 

Link to comment
Share on other sites

This topic is 2645 days old. Please don't post here. Open a new topic instead.

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
×
×
  • Create New...

Important Information

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