January 2, 201313 yr 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)?
January 2, 201313 yr Author 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.
January 2, 201313 yr I don't think you can natively loop through a list of files. Are these files in a folder?
January 2, 201313 yr Author 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.
January 2, 201313 yr Solution 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 --
January 3, 201313 yr 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 ]
Create an account or sign in to comment