Hi Jarmo,
Thank you! This worked a treat! However, I have now run into two further issues. If I may describe them:
// Defining firstname and lastname string
userFirstName = "XXXX";
userLastName = "YYYY";
//changing username variables based on user input
w = New Window( "prototype", <<Modal, // opens a window with a title and this content...
Border Box( top( 20 ), bottom( 20 ), Left( 20 ), Right( 20 ), // window dressing
V List Box( // V and H lists nest to organize the display boxes
H Center Box( Text Box( "Report Generator" ) ), // a second title, centered
Spacer Box( size( 1, 30 ) ), // a little vertical space
H List Box( Text Box( "First Name: " ), b1=Text Edit Box( userFirstName ) ), // data entry
Spacer Box( size( 1, 10 ) ), // a little vertical space
H List Box( Text Box( "Last Name: " ), b2=Text Edit Box( userLastName ) ), // more data entry
Spacer Box( size( 1, 30 ) ), // a little vertical space
H Center Box( // center the button
Button Box( "Update Strings", // this script runs when the button is pressed...
// make a new table with the values...
dt = New Table( "StringCheck",
New Column( "Name",
Character,
Set Values(Eval List({b1 << get text(), b2 << get text()}))
)
);
// optionally, close the dialog. Or, you might want to run it again...
w << closeWindow; // just the dialog, not the report
)
)
)
)
);
// Defining filepath string
filePathString = Concat Items( {"C:\Users\", userFirstName, userLastName, "\File\Path\Example\etc\"}, "" );
//Import multiple files
Multiple File Import(
<<Set Folder(
filePathString
),
<<Set Show Hidden( 0 ),
First of all, pressing update strings does spit out the correct table, but it also throws an error:
Secondly, the script "works", i.e., carries out the multiple file import, if I use the variables userFirstName & userLastName, but does not work if I use b1, b2 in the concatanate string. My guess as to why is that the part I am using to define the b1, b2 variables (using the Text Edit Box) is local. Do the b1,b2 variables not continue on to exist in the remaining script? If that is the case, how do I make them exist as global variables.
How do I get rid of the error? It seems to be caused by me adding a << modal clause to the window. But I need to do this in order to pause the script and allow the operator to check that their name input was correct.
Ideally the workflow I am trying to build is:
user runs the script
The script throws up a pop-up box, asking the user to define their first name and last name
The script allows the user to check that their entry is correct (showing the filePathString would be better than the current output)
The script, after the user clicks ok, continues, and uses the new variables in several different filePathStrings.
There are many other ways I could incorporate a data entry text box into this script for my purpose, so any help would be greatly appreciated.
Thanks,
Late