By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,962 Members | 1,967 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,962 IT Pros & Developers. It's quick & easy.

What is wrong in this script

P: 24
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.
Expand|Select|Wrap|Line Numbers
  1. Windows Registry Editor Version 5.00
  2.  
  3. [HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt\Capture this page with html Capture]
  4. @="C:\\Program Files\\html Capture\\html Capture.htm"
  5. "Contexts"=dword:0000003f
  6. "Flags"=dword:00000000
  7.  
Also I create html file which contain the script to run the program.
Expand|Select|Wrap|Line Numbers
  1. <script language="vbscript">
  2.     Dim Shell
  3.     Set Shell = CreateObject("WScript.Shell")
  4.     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
  5.     Set Shell = Nothing
  6. </script>
  7.  
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
Jul 13 '10 #1
Share this Question
Share on Google+
1 Reply


P: 24
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_DocumentComplete 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.
Expand|Select|Wrap|Line Numbers
  1. Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
  2. GetImage()
  3. End Sub
  4.  
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”.
Expand|Select|Wrap|Line Numbers
  1. Private Sub WebBrowser1_ProgressChanged(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserProgressChangedEventArgs) Handles WebBrowser1.ProgressChanged
  2. If WebBrowser1.ReadyState = WebBrowserReadyState.Complete Then
  3. GetImage()
  4. End If
  5. End Sub
  6.  
Any help please.

Thanks and Best Regards
Jul 15 '10 #2

Post your reply

Sign in to post your reply or Sign up for a free account.