If I understand, you would need a looping script with insert file command with its (insert file) file name parameter defined as a variable.
The $file variable must be formatted correctly, i.e. "filewin://...the full path.../the filename.ext"
I would suggest using global variables as one learns, i.e. $$file ...
Go To Record [First]
Set Variable[ $$file ;Value:"filewin://C:/PIC-01/" & If ( RECORD ID < 100; "PIC-01-00" & RECORD ID & "A.jpg"; "PIC-01-0" & RECORD ID & "A.jpg" )]
Insert File[ target::field ; "$$file" ]
Go To Record [Next;Exit After Last]
Of course values could vary depending on requirements.
Thank you for your speedy reply. I know that I have to loop the script, but before that I had wanted to get the script to work! What I don't know is the info you had written: "I would suggest using global variables as one learns, i.e. $$file ...." What do the dollar signs mean? I'm not that expert on programming at a higher level, so any help would be greatly appreciated. Thanks again.
Not a problem.
The variable is about the only way to accomplish the task.
A quick explanation is a
$ variable is local to the current script execution - it releases from memory when script exits, e.g. $myname = Marx;
and a $$ variable is global to the session and lives on after the completion of a script, e.g. $$myname = Marx
we use these to pass information, settings, data etc. during FileMaker sessions.
For details see FileMaker Help File "Designing and creating databases -> Using variables"
You can start with just two steps from previous email to test:
Set Variable [...
Insert File [ ...
This will allow you to test your variable setting and if the insert file step will work.
Hope this helps.
Thanks again. I'm still not sure if I understand completely, but I'll work on it. If I run into a problem, you'll be hearing from me!
The insert file script allows only number results, so the "; "$$file" doesn't work. I still don't understand how the script you provided allows the matching of the Filemaker record to the image in the folder.
I think you might have entered quotes rather than a variable reference - when you specify the file on the insert file script step you would type $varname NOT "$varname" or "$$varname" quotes around the variable name would cause double quoting and filemaker would error out on the syntax.
The work of assuring that the content of that variable is a valid path and conforms to an existing file is something you have to be sure of - the help file has extensive notes about file path use as a variable.
If scripting is not the way you want to proceed, you could approach a solution from another direction - i.e. "Import Folder" command will collect all image files in separate records into a new table which you could then match up by some text manipulations to their appropriate record.
Thank you for your feedback. In the interim I've made a very elementary script which is working quite well. I'll study your notes some more so that I could learn how to do scripting properly! Thank you again.