What I'd like a script to do is:
If an image is 'located' by a URL then it saves that image file (off the internet) into a folder.
If the image file is nonexistant at that URL, (ie result is "404 Not Found") then it simply copies the "404 not found" message (or some error message) into a field.
So my question is, can Filemaker return any (found/not found) information from the web viewer?
I'm still trying to work this out.
Here are the script steps that I created to try to find out what is happening.
(Script steps that do NOT return what I want)
Script name: web viewer error capture
Go to Object [ Object Name: "web_image" ]
Set Error Capture [ On ]
Set Web Viewer [ Action: Reload ]
(here, I expect that upon 'reload' the web viewer will find no image, so it should capture the "LastError" and put it into z_searchfield so I can read it)
Set Field [ Product Inventory::z_searchﬁeld; "Web viewer error " & Get ( LastError ) ]
Error capture puts "Web viewer error 5" into z_searchfield. error 5 = "Command is invalid (for example Set Field script step does not have a calculation specified."
I was HOPING that it would say something related to the "404 Not Found" that the browser returns.
Is it more clear what I am trying to do? I am trying to flag every record where the "web viewer" gets a "404 not found" so I can then go in and fix the information on those records.
Thanks for any help!
try this one:
Show All Records
Go to Record [ first ]
Set Field [ Product Inventory::z_searchﬁeld; If ( PatternCount ( GetLayoutObjectAttribute ( "web_image" ; "content" ) ; "error" ) ; "error" ) ]
Go to Record [ exit after last ; next ]
Perform Find [ criteria : Product Inventory::z_searchﬁeld =error ]