Jump to content

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” ]
  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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

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