What is wrong in this script

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hdbbdh
    New Member
    • Dec 2008
    • 24

    What is wrong in this script

    Dear All,

    First I am sorry to put this question here.
    I have just finish one program using VB.NET to capture html file and convert it to image file, and I put it in IE context menu using the following registration code.
    Code:
    Windows Registry Editor Version 5.00
    
    [HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt\Capture this page with html Capture]
    @="C:\\Program Files\\html Capture\\html Capture.htm"
    "Contexts"=dword:0000003f
    "Flags"=dword:00000000
    Also I create html file which contain the script to run the program.
    Code:
    <script language="vbscript">
    	Dim Shell
    	Set Shell = CreateObject("WScript.Shell")
    	Shell.run Chr(34) & "C:\Program Files\html Capture\html Capture.exe" & Chr(34) & " " & Chr(34) & window.external.menuArguments.location.href & Chr(34), 1, False
    	Set Shell = Nothing
    </script>
    But finally when I start the program from IE menu it halts just before saving the file, but it works perfectly if I start it manually.
    Do you have any Ideas regarding this issue please?
    Finally, I am sorry about my bad English.

    Thanks and Best Regards
  • hdbbdh
    New Member
    • Dec 2008
    • 24

    #2
    Dear Friends,

    I found the problem, actually the script sends URL as “http://bytes.com” not as http://bytes.com, so the URL becomes invalid.
    But unfortunately, I stuck in other problem which is that WebBrowser_Docu mentComplete is not fired when the URL is invalid.
    Then my new question is:
    What is the event which is fired when WebBrowser complete loading the page or showing “This program connot display the webpage”.
    Please find below what I tried.

    The following code will be fired if the webpage is found.
    Code:
    Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
    GetImage()
    End Sub
    The following code will be fired if the webpage is found but before complete view, and also it will fired if the webpage is not found, the case of “This program cannot display the webpage”.
    Code:
    Private Sub WebBrowser1_ProgressChanged(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserProgressChangedEventArgs) Handles WebBrowser1.ProgressChanged
    If WebBrowser1.ReadyState = WebBrowserReadyState.Complete Then
    GetImage()
    End If
    End Sub
    Any help please.

    Thanks and Best Regards

    Comment

    Working...