AgentsSka Posted January 2, 2013 Posted January 2, 2013 This seems like it should be very easy. But, I'm not seeing the solution here. I am creating a filemaker script that creates a variable of a list of files. a.jpg b.jpg c.jpg d.jpg e.jpg I need to be able to loop through that list and do something each time. is there a way within filemaker to specify item x of the list (similar to applescript)?
Lee Smith Posted January 2, 2013 Posted January 2, 2013 Loop through a list or a found set of records?
AgentsSka Posted January 2, 2013 Author Posted January 2, 2013 A list. For example, in Applescript, it would look something like this. set theList to {"a.jpg", "b.jpg", "c.jpg", "d.jpg", "e.jpg"} set theFile to item 2 of theList theFile = "b.jpg" I don't know how to extract item x from a filemaker list.
Lee Smith Posted January 2, 2013 Posted January 2, 2013 I don't think you can natively loop through a list of files. Are these files in a folder?
AgentsSka Posted January 2, 2013 Author Posted January 2, 2013 They are indeed in a folder. I could write the entire script in Applescript, but I was hoping to keep it native within Filemaker, so that I can schedule the script easily on FMServer. I have the Troi File Plug-in returning the files from a few different folders. Each folder has over 10,000 files in each. I just need the ability to extract a specific list item from the list. Then, I can iterate through the way I need to.
Christensen Design Posted January 2, 2013 Posted January 2, 2013 If all you are trying to do is loop through a list of items (called 'value list' in FM), try this example: #Loop Test # Set Variable [ $theList; Value:"a.jpg¶b.jpg¶c.jpg¶d.jpg¶e.jpg" ] # Set Variable [ $count; Value:ValueCount ( $theList ) // get the number of items on the list ] Set Variable [ $i; Value:1 ] # Loop # #Do something here... If [ $i = 2 ] Show Custom Dialog [ Title: "*** TEST ***"; Message: "Item " & $i & " on the list is: " & GetValue ( $theList ; $i ); Buttons: “OK” ] End If # Exit Loop If [ $i ≥ $count ] Set Variable [ $i; Value:$i + 1 ] # End Loop # #-- end --
AgentsSka Posted January 2, 2013 Author Posted January 2, 2013 Ah, GetValue. That's simple enough! Thanks!
skearton Posted January 3, 2013 Posted January 3, 2013 Hello, I have a similar situation but can't figure out how to make it work depending on the specifically selected items in a checkbox set. I want the user to be able to select which form(s) they need to print based on a value list. How do I loop through each value they have selected and print those particular forms? This is what I have now (without the loop): Perform Script [ “Allow User Abort” ]#Freeze Window#If [ z_RESOURCES::HazardAssessmentFormList = "Interior Standard" ] Go to Layout [ “Print_HazardAssess_IntStandard” (z_RESOURCES) ] Print Setup [ Orientation: Portrait; Paper size: 8.5" x 11" ] [ Restore; No dialog ]Print [ Current record; All Pages; Orientation: Landscape; Paper size: 8.5" x 11" ] [ Restore: Sharp Color; No dialog ] # Else If [ z_RESOURCES::HazardAssessmentFormList = "Exterior Standard" ] Go to Layout [ “Print_HazardAssess_ExtStandard” (z_RESOURCES) ] Print Setup [ Orientation: Portrait; Paper size: 8.5" x 11" ] [ Restore; No dialog ] Print [ Current record; All Pages; Orientation: Landscape; Paper size: 8.5" x 11" ] [ Restore: Sharp Color; No dialog ] # Else If [ z_RESOURCES::HazardAssessmentFormList = "Vinyl Standard" ] Go to Layout [ “Print_HazardAssess_VinylStandard” (z_RESOURCES) ] Print Setup [ Orientation: Portrait; Paper size: 8.5" x 11" ] [ Restore; No dialog ] Print [ Current record; All Pages; Orientation: Landscape; Paper size: 8.5" x 11" ] [ Restore: Sharp Color; No dialog ] # Else If [ z_RESOURCES::HazardAssessmentFormList = "Non Standard" ] Go to Layout [ “Print_HazardAssess_NonStandard” (z_RESOURCES) ] Print Setup [ Orientation: Portrait; Paper size: 8.5" x 11" ] [ Restore; No dialog ] Print [ Current record; All Pages; Orientation: Landscape; Paper size: 8.5" x 11" ] [ Restore: Sharp Color; No dialog ] # Else If [ z_RESOURCES::HazardAssessmentFormList = "Working Alone" ] Go to Layout [ “Print_HazardAssess_WorkAlone” (z_RESOURCES) ] Print Setup [ Orientation: Portrait; Paper size: 8.5" x 11" ] [ Restore; No dialog ] Print [ Current record; All Pages; Orientation: Landscape; Paper size: 8.5" x 11" ] [ Restore: Sharp Color; No dialog ] # End If Close Window [ Current Window ]
Recommended Posts
This topic is 4346 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