June 3, 201213 yr Newbies Hello, i want to start a script after the webviewer has finished loading, because i have to read out some summarys from the Webviewer. Is there any way to trigger a script after loading completed? Thank you!
June 4, 201213 yr This is the script that I came up with in my solution: ## # Load URL Script # Set Error Capture [ On ] Set Variable [ $webviewer; Value:"webviewer" ] Set Variable [ $url; Value:"http://www.fmforums.com/" ] Set Variable [ $lastTag; Value:"</html>" ] Set Variable [ $timeout; Value:30 ] ## # Load the URL # Set Web Viewer [ Object Name: $webviewer; URL: $url ] If [ Get(LastError) ] # Error: Either the webviewer is missing or did not load properly Exit Script [ Result: False ] End If ## # Wait for the URL to load # Loop Pause/Resume Script [ Duration (seconds): 1 ] If [ GetLayoutObjectAttribute ( $webviewer ; "content" ) <> "<HTML></HTML>" ] Exit Loop If [ PatternCount ( GetLayoutObjectAttribute ( $webviewer ; "content" ) ; $lastTag ) ] End If Set Variable [ $timer; Value:$timer + 1 ] If [ $timer = $timeout ] # Error: Url did not load in time Exit Script [ Result: False ] End If End Loop Note: The "<>" symbol should be a "Not Equals" symbol. I hope that helps!
June 4, 201213 yr Is there any way to trigger a script after loading completed? No, but you can put a script in a looped pause and exit the loop when the page has loaded. Usually, you can tell a page has loaded when the web viewer's content contains the string "</html>", but it really depends on the specific page.
Create an account or sign in to comment