sgrey Posted June 1, 2010 Posted June 1, 2010 06-01-10 04:41 PM - Post#40777 First of all, my apologies for being dense about this, but I am just not getting it right. I’m pretty sure the answer is easy and obvious (just not to me). I have a layout with: 1. A container field with a picture of a school (School address::School Picture) 2. A text field with the name of the school (School address::School Name) I want to export the picture into a folder on my desktop and name it with the corresponding name. I have a Set Variable script to create a variable called “$schoolName” Set Variable: [$schoolName; Value: School address::School Name & “.jpg”] (I created a test field and a Set Field script to make sure that the variable is working. When I run the script, it correctly populates the test field with the results of the Set Variable script—the name of the school followed by “.jpg”.) The problem comes when I export the photo. I’ve used the Export Field Contents command to save the photo into a folder on my desktop. Export Field Contents [school address::School Picture; $schoolName] The photograph exports into the folder as expected, but does not pick up the name from the variable. Instead, it gives the photo the name of the variable—$schoolName I’ve tried putting quotes around the variable and the resulting name is—“$schoolName” I’ve tried adding a ‘’ before the variable and the resulting name is—$schoolName Obviously, the Export command is not seeing $schoolName as a variable, but as straight text. Any ideas would be appreciated. Thanks.
bruceR Posted June 1, 2010 Posted June 1, 2010 See Help for "Creating File Paths". You have dealt with the name of the file; but not the full path. Set variable $path; "file:" & get( desktopPath) & $schoolname Export field contents [ $path ]
sgrey Posted June 1, 2010 Author Posted June 1, 2010 Thanks, BruceR. I want to make sure I understand the logic here. In essence, within the Set Variable script, I need to not only define the variable, but also specify where the target file will be end up on my computer? Is that correct?
sgrey Posted June 1, 2010 Author Posted June 1, 2010 Got it! Thanks for your input. It put me on the right path (no pun intended) and I was able to find just what I needed.
bruceR Posted June 2, 2010 Posted June 2, 2010 Thanks, BruceR. I want to make sure I understand the logic here. In essence, within the Set Variable script, I need to not only define the variable, but also specify where the target file will be end up on my computer? Is that correct? That's a confusing way of putting it. You can put whatever you want in a variable. But if your purpose is to script the export of a file, then the variable used by the export action must be a complete and valid file path. How else is it going to go where you tell it to?
sgrey Posted June 2, 2010 Author Posted June 2, 2010 This clarifies things. How else is it going to go where you tell it to? My export script put the photo where I wanted it to go (and gave it a name). I'd assumed it could just pick up the name from the variable. Admittedly, my logic was wrong. Thanks again for your help. Much appreciated.
Recommended Posts
This topic is 5287 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 accountSign in
Already have an account? Sign in here.
Sign In Now