I'd like to script capturing a picture from a web view window and save it to disk.
Easy to do manually via right click and save image; but with hundreds of records, needs to be scripted.
This can get complicated and become un reliable, but its possible. First you need to pull apart the source code from the web viewer and build a URL to the image file. Next your script will use the URL in the Insert from URL script step to put the image in a container field. If you want the file saved to the desktop or elsewhere just export the container contents.
For parsing the HTML code I use this custom function:
// ParseData ( theText; theStartTag; theEndTag; theOccurance)
// Extract the text between two strings.
// theText = the text to parse
// theStartTag = the string that comes before the text to extract
// theEndTag = the string that comes after the text to extract
// theOccurance = the instance of the text to extract
// Return Value:
// the instance of text found in theText beween theStartTag and theEndTag based on theOccurance
Let ( [
theStartPos = Position ( theText ; theStartTag ; 1 ; theOccurance ) ;
theResult = Case (
// If theStartTag was not found, return an empty string.
theStartPos = 0 ; "" ;
// If theStartTag was found, get the string we are looking for.
theStartPos > 0 ;
theStartPos = theStartPos + Length ( theStartTag ) ;
theEndPos = Position ( theText ; theEndTag ; theStartPos ; 1 ) ;
theLengthToKeep = theEndPos - theStartPos;
theResult = Middle ( theText ; theStartPos ; theLengthToKeep )
) // End case
You will use the the following function to grab the source code from the webview.
GetLayoutObjectAttribute ( "Name of Web Viewer" ; "content" ) ;
Again this is not simple and if you dont have control over the web page it can break at any time.
Use fmp as a data source to generate the urls and pass the job to cURL.
I downloaded the trial for FM 12.
IN FM 12, Insert URL script step is a piece of cake.
As I build the url from other info then hand off to Google maps API, I get a map image and then place it into a container field.
Insert URL (url_field)
url_field is built from addresses and user defined mapping variables=
"zoom=" & Assets::Map Size
Parsing a url to extract an image is not the issue.
THANKS FOR THE RESPONSE
created by nsabel in General - View the full discussion
My misunderstanding I didn't realize you already knew the URL. In that case yes it is quite easy and simple.
but not with earlier than 12... that is a new function... thankfully.
Retrieving data ...