![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Capturing IE events in WSC??? Can someone please tell me what I am doing wrong, I cannot seem to trigger the IE events in my code. GUIForm.vbs ----------------------------------------------------------------------------------------------------------------------------------------------------- Dim GForm Set GForm = CreateObject("GUI.Form") GForm.DisplayForm "My Form Title","My Form Message" Set GForm = Nothing GUI.Form.wsc ------------------------------------------------------------------------------------------------------------------------------------------------------- <?xml version="1.0"?> <package> <component> <object id="o_filesys" progid="Scripting.FileSystemObject"/> <object id="o_shell" progid="WScript.Shell"/> <object id="o_app" progid="Shell.Application"/> <object id="o_net" progid="WScript.NetWork"/> <object id='oIE' progid='InternetExplorer.Application' events="true"/ Quote: > <registration description="GUI" progid="GUI.Form" version="1.00" classid="{f834660d-4b02-44db-9cee-b6b202d178ab}"> <script language="VBScript"> <![CDATA[ Function register() 'Code for handling register event can go here End Function Function unregister() 'Code for handling unregister event can go here End Function ]]> </script> </registration> <public> <method name="DisplayForm"> <PARAMETER name="title"/> <PARAMETER name="message"/> </method> </public> <implements type="Behavior" id="Behavior"/> <script language="VBScript"> <![CDATA[ function DisplayForm(title, message) With oIE .navigate "About:Blank" .left=200 .top=200 .height=400 .width=400 .menubar=0 .toolbar=0 .statusBar=0 .Resizable=0 .visible=0 End With oIE.Document.Title = ""& title &" ." oIE.Document.Body.Scroll = "no" With oIE.Document.ParentWindow.Screen oIE.Left = (.AvailWidth - oIE.Width ) \ 2 oIE.Top = (.Availheight - oIE.Height) \ 2 End With Do While oIE.Busy WScript.Sleep 200 Loop oIE.Document.Body.InnerHTML = "<DIV align=""center""><P>" & message & "</P></DIV>" _ & "<a href=""http://www.google.com"">Go To Google</a>" oIE.visible=1 Do While NOT (oIE is nothing) Sleep 200 Loop end function Sub oIE_BeforeNavigate2(pDisp, URL, Flags, TargetFrameName, PostData, Headers, Cancel) Msgbox "Going to:", URL Cancel = True oIE.Quit Set oIE = Nothing End Sub Sub oIE_OnQuit() Msgbox "QUITING" oIE.Quit Set oIE = Nothing End Sub Sub Sleep(intDuration) dblSeconds = intDuration / 1000 If dblSeconds < 1 Then dblSeconds = 1 dteStart = Now() dteEnd = DateAdd("s", dblSeconds, dteStart) While dteEnd > Now() DoNothing Wend End Sub Sub DoNothing 'While/Wend has quirks when it is empty End Sub ]]> </script> </component> </package> |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Capturing IE events in WSC??? This is a really messy problem to solve, as you understand by now. ![]() I'm having problems with getting your WSC to work - partially due to the unavoidable mangling on post for the longish WSC lines - but more to the point, I can't currently find ANY working demos of event sinking _within_ a WSC. I tried tweaking your code a bit (including passing a reference to WScript into the component to handle sleeps properly), but cannot get events working in it as-is. I do recall there being some oddities with making events work properly inside WSCs, but it's been years since I've played with it so I'm coming up empty on solutions. :/ By any chance, do you have info on a working example of internal event hooking in a WSC? If you can point me at a reference, it might narrow down the problem in hookup. <billymyersiii@xxxxxx> wrote in message news:f938b587-b675-4716-8a2a-257959617920@xxxxxx Quote: > Can someone please tell me what I am doing wrong, I cannot seem to > trigger the IE events in my code. > > > > GUIForm.vbs > ----------------------------------------------------------------------------------------------------------------------------------------------------- > Dim GForm > > Set GForm = CreateObject("GUI.Form") > GForm.DisplayForm "My Form Title","My Form Message" > > Set GForm = Nothing > > > > > > GUI.Form.wsc > ------------------------------------------------------------------------------------------------------------------------------------------------------- > <?xml version="1.0"?> > <package> > <component> > <object id="o_filesys" progid="Scripting.FileSystemObject"/> > <object id="o_shell" progid="WScript.Shell"/> > <object id="o_app" progid="Shell.Application"/> > <object id="o_net" progid="WScript.NetWork"/> > <object id='oIE' progid='InternetExplorer.Application' events="true"/ Quote: >> > <registration description="GUI" progid="GUI.Form" version="1.00" > classid="{f834660d-4b02-44db-9cee-b6b202d178ab}"> > <script language="VBScript"> > <![CDATA[ > Function register() > 'Code for handling register event can go here > End Function > Function unregister() > 'Code for handling unregister event can go here > End Function > ]]> > </script> > </registration> > <public> > <method name="DisplayForm"> > <PARAMETER name="title"/> > <PARAMETER name="message"/> > </method> > </public> > <implements type="Behavior" id="Behavior"/> > <script language="VBScript"> > <![CDATA[ > function DisplayForm(title, message) > With oIE > .navigate "About:Blank" > .left=200 > .top=200 > .height=400 > .width=400 > .menubar=0 > .toolbar=0 > .statusBar=0 > .Resizable=0 > .visible=0 > End With > oIE.Document.Title = ""& title > &" ." > oIE.Document.Body.Scroll = "no" > With oIE.Document.ParentWindow.Screen > oIE.Left = (.AvailWidth - oIE.Width ) \ 2 > oIE.Top = (.Availheight - oIE.Height) \ 2 > End With > Do While oIE.Busy > WScript.Sleep 200 > Loop > oIE.Document.Body.InnerHTML = "<DIV align=""center""><P>" & message > & "</P></DIV>" _ > & "<a href=""http://www.google.com"">Go To Google</a>" > oIE.visible=1 > Do While NOT (oIE is nothing) > Sleep 200 > Loop > end function > > Sub oIE_BeforeNavigate2(pDisp, URL, Flags, TargetFrameName, > PostData, Headers, Cancel) > Msgbox "Going to:", URL > Cancel = True > oIE.Quit > Set oIE = Nothing > End Sub > > Sub oIE_OnQuit() > Msgbox "QUITING" > oIE.Quit > Set oIE = Nothing > End Sub > > Sub Sleep(intDuration) > dblSeconds = intDuration / 1000 > If dblSeconds < 1 Then dblSeconds = 1 > dteStart = Now() > dteEnd = DateAdd("s", dblSeconds, dteStart) > > While dteEnd > Now() > DoNothing > Wend > End Sub > > Sub DoNothing > 'While/Wend has quirks when it is empty > End Sub > ]]> > </script> > </component> > </package> |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Capturing IE events in WSC??? Hi, Alex Have you looked at http://msdn.microsoft.com/en-us/library/ms974564.aspx? http://msdn.microsoft.com/en-us/library/ms531079.aspx might be applicable too. -Paul Randall "Alex K. Angelopoulos" <alex(dot) k(dot again)angelopoulos(at)gmail.com> wrote in message news:uYFd0YS5JHA.1420@xxxxxx Quote: > This is a really messy problem to solve, as you understand by now. ![]() > > I'm having problems with getting your WSC to work - partially due to the > unavoidable mangling on post for the longish WSC lines - but more to the > point, I can't currently find ANY working demos of event sinking _within_ > a WSC. I tried tweaking your code a bit (including passing a reference to > WScript into the component to handle sleeps properly), but cannot get > events working in it as-is. I do recall there being some oddities with > making events work properly inside WSCs, but it's been years since I've > played with it so I'm coming up empty on solutions. :/ > > By any chance, do you have info on a working example of internal event > hooking in a WSC? If you can point me at a reference, it might narrow down > the problem in hookup. > > <billymyersiii@xxxxxx> wrote in message > news:f938b587-b675-4716-8a2a-257959617920@xxxxxx Quote: >> Can someone please tell me what I am doing wrong, I cannot seem to >> trigger the IE events in my code. >> >> >> >> GUIForm.vbs >> ----------------------------------------------------------------------------------------------------------------------------------------------------- >> Dim GForm >> >> Set GForm = CreateObject("GUI.Form") >> GForm.DisplayForm "My Form Title","My Form Message" >> >> Set GForm = Nothing >> >> >> >> >> >> GUI.Form.wsc >> ------------------------------------------------------------------------------------------------------------------------------------------------------- >> <?xml version="1.0"?> >> <package> >> <component> >> <object id="o_filesys" progid="Scripting.FileSystemObject"/> >> <object id="o_shell" progid="WScript.Shell"/> >> <object id="o_app" progid="Shell.Application"/> >> <object id="o_net" progid="WScript.NetWork"/> >> <object id='oIE' progid='InternetExplorer.Application' events="true"/ Quote: >>> >> <registration description="GUI" progid="GUI.Form" version="1.00" >> classid="{f834660d-4b02-44db-9cee-b6b202d178ab}"> >> <script language="VBScript"> >> <![CDATA[ >> Function register() >> 'Code for handling register event can go here >> End Function >> Function unregister() >> 'Code for handling unregister event can go here >> End Function >> ]]> >> </script> >> </registration> >> <public> >> <method name="DisplayForm"> >> <PARAMETER name="title"/> >> <PARAMETER name="message"/> >> </method> >> </public> >> <implements type="Behavior" id="Behavior"/> >> <script language="VBScript"> >> <![CDATA[ >> function DisplayForm(title, message) >> With oIE >> .navigate "About:Blank" >> .left=200 >> .top=200 >> .height=400 >> .width=400 >> .menubar=0 >> .toolbar=0 >> .statusBar=0 >> .Resizable=0 >> .visible=0 >> End With >> oIE.Document.Title = ""& title >> &" ." >> oIE.Document.Body.Scroll = "no" >> With oIE.Document.ParentWindow.Screen >> oIE.Left = (.AvailWidth - oIE.Width ) \ 2 >> oIE.Top = (.Availheight - oIE.Height) \ 2 >> End With >> Do While oIE.Busy >> WScript.Sleep 200 >> Loop >> oIE.Document.Body.InnerHTML = "<DIV align=""center""><P>" & message >> & "</P></DIV>" _ >> & "<a href=""http://www.google.com"">Go To Google</a>" >> oIE.visible=1 >> Do While NOT (oIE is nothing) >> Sleep 200 >> Loop >> end function >> >> Sub oIE_BeforeNavigate2(pDisp, URL, Flags, TargetFrameName, >> PostData, Headers, Cancel) >> Msgbox "Going to:", URL >> Cancel = True >> oIE.Quit >> Set oIE = Nothing >> End Sub >> >> Sub oIE_OnQuit() >> Msgbox "QUITING" >> oIE.Quit >> Set oIE = Nothing >> End Sub >> >> Sub Sleep(intDuration) >> dblSeconds = intDuration / 1000 >> If dblSeconds < 1 Then dblSeconds = 1 >> dteStart = Now() >> dteEnd = DateAdd("s", dblSeconds, dteStart) >> >> While dteEnd > Now() >> DoNothing >> Wend >> End Sub >> >> Sub DoNothing >> 'While/Wend has quirks when it is empty >> End Sub >> ]]> >> </script> >> </component> >> </package> |
My System Specs![]() |
| | #4 (permalink) |
| | Re: Capturing IE events in WSC??? Ooh, glad you had those links. I backed up on this problem and tried GetRef directly in a WSH script, tested on both Win7 and Windows 2000 with the script below; it chokes in both cases on the GetRef: Set ie = CreateObject("InternetExplorer.Application") ie.navigate "about:blank" Do while ie.readystate <> 4 WScript.Sleep 20 loop set ie.OnQuit = GetRef("Quitting") do while true WScript.Sleep 20 loop function Quitting MsgBox "IE is quitting" WScript.Quit end function "Paul Randall" <paulr90@xxxxxx> wrote in message news:eh38LcT5JHA.1420@xxxxxx Quote: > Hi, Alex > Have you looked at http://msdn.microsoft.com/en-us/library/ms974564.aspx? > http://msdn.microsoft.com/en-us/library/ms531079.aspx might be applicable > too. > > -Paul Randall > > "Alex K. Angelopoulos" <alex(dot) k(dot again)angelopoulos(at)gmail.com> > wrote in message news:uYFd0YS5JHA.1420@xxxxxx Quote: >> This is a really messy problem to solve, as you understand by now. ![]() >> >> I'm having problems with getting your WSC to work - partially due to the >> unavoidable mangling on post for the longish WSC lines - but more to the >> point, I can't currently find ANY working demos of event sinking _within_ >> a WSC. I tried tweaking your code a bit (including passing a reference to >> WScript into the component to handle sleeps properly), but cannot get >> events working in it as-is. I do recall there being some oddities with >> making events work properly inside WSCs, but it's been years since I've >> played with it so I'm coming up empty on solutions. :/ >> >> By any chance, do you have info on a working example of internal event >> hooking in a WSC? If you can point me at a reference, it might narrow >> down the problem in hookup. >> >> <billymyersiii@xxxxxx> wrote in message >> news:f938b587-b675-4716-8a2a-257959617920@xxxxxx Quote: >>> Can someone please tell me what I am doing wrong, I cannot seem to >>> trigger the IE events in my code. >>> >>> >>> >>> GUIForm.vbs >>> ----------------------------------------------------------------------------------------------------------------------------------------------------- >>> Dim GForm >>> >>> Set GForm = CreateObject("GUI.Form") >>> GForm.DisplayForm "My Form Title","My Form Message" >>> >>> Set GForm = Nothing >>> >>> >>> >>> >>> >>> GUI.Form.wsc >>> ------------------------------------------------------------------------------------------------------------------------------------------------------- >>> <?xml version="1.0"?> >>> <package> >>> <component> >>> <object id="o_filesys" progid="Scripting.FileSystemObject"/> >>> <object id="o_shell" progid="WScript.Shell"/> >>> <object id="o_app" progid="Shell.Application"/> >>> <object id="o_net" progid="WScript.NetWork"/> >>> <object id='oIE' progid='InternetExplorer.Application' events="true"/ >>>> >>> <?component error="true" debug="true"?> >>> <registration description="GUI" progid="GUI.Form" version="1.00" >>> classid="{f834660d-4b02-44db-9cee-b6b202d178ab}"> >>> <script language="VBScript"> >>> <![CDATA[ >>> Function register() >>> 'Code for handling register event can go here >>> End Function >>> Function unregister() >>> 'Code for handling unregister event can go here >>> End Function >>> ]]> >>> </script> >>> </registration> >>> <public> >>> <method name="DisplayForm"> >>> <PARAMETER name="title"/> >>> <PARAMETER name="message"/> >>> </method> >>> </public> >>> <implements type="Behavior" id="Behavior"/> >>> <script language="VBScript"> >>> <![CDATA[ >>> function DisplayForm(title, message) >>> With oIE >>> .navigate "About:Blank" >>> .left=200 >>> .top=200 >>> .height=400 >>> .width=400 >>> .menubar=0 >>> .toolbar=0 >>> .statusBar=0 >>> .Resizable=0 >>> .visible=0 >>> End With >>> oIE.Document.Title = ""& title >>> &" ." >>> oIE.Document.Body.Scroll = "no" >>> With oIE.Document.ParentWindow.Screen >>> oIE.Left = (.AvailWidth - oIE.Width ) \ 2 >>> oIE.Top = (.Availheight - oIE.Height) \ 2 >>> End With >>> Do While oIE.Busy >>> WScript.Sleep 200 >>> Loop >>> oIE.Document.Body.InnerHTML = "<DIV align=""center""><P>" & message >>> & "</P></DIV>" _ >>> & "<a href=""http://www.google.com"">Go To Google</a>" >>> oIE.visible=1 >>> Do While NOT (oIE is nothing) >>> Sleep 200 >>> Loop >>> end function >>> >>> Sub oIE_BeforeNavigate2(pDisp, URL, Flags, TargetFrameName, >>> PostData, Headers, Cancel) >>> Msgbox "Going to:", URL >>> Cancel = True >>> oIE.Quit >>> Set oIE = Nothing >>> End Sub >>> >>> Sub oIE_OnQuit() >>> Msgbox "QUITING" >>> oIE.Quit >>> Set oIE = Nothing >>> End Sub >>> >>> Sub Sleep(intDuration) >>> dblSeconds = intDuration / 1000 >>> If dblSeconds < 1 Then dblSeconds = 1 >>> dteStart = Now() >>> dteEnd = DateAdd("s", dblSeconds, dteStart) >>> >>> While dteEnd > Now() >>> DoNothing >>> Wend >>> End Sub >>> >>> Sub DoNothing >>> 'While/Wend has quirks when it is empty >>> End Sub >>> ]]> >>> </script> >>> </component> >>> </package> > |
My System Specs![]() |
| | #5 (permalink) |
| | Re: Capturing IE events in WSC??? Bad posting. Take 2. ![]() I backed up on this problem and tried GetRef directly in a WSH script, tested on both Win7 and Windows 2000 with the script below; it chokes in both cases on the GetRef: Error: Object doesn't support this property or method: 'ie.OnQuit' Code: 800A01B6 Paul, do you see where I might be making a mistake? The event is definitely there in TLViewer on InternetExplorer.Application... Set ie = CreateObject("InternetExplorer.Application") ie.navigate "about:blank" Do while ie.readystate <> 4 WScript.Sleep 20 loop set ie.OnQuit = GetRef("Quitting") do while true WScript.Sleep 20 loop function Quitting MsgBox "IE is quitting" WScript.Quit end function "Paul Randall" <paulr90@xxxxxx> wrote in message news:eh38LcT5JHA.1420@xxxxxx Quote: > Hi, Alex > Have you looked at http://msdn.microsoft.com/en-us/library/ms974564.aspx? > http://msdn.microsoft.com/en-us/library/ms531079.aspx might be applicable > too. > > -Paul Randall > > "Alex K. Angelopoulos" <alex(dot) k(dot again)angelopoulos(at)gmail.com> > wrote in message news:uYFd0YS5JHA.1420@xxxxxx Quote: >> This is a really messy problem to solve, as you understand by now. ![]() >> >> I'm having problems with getting your WSC to work - partially due to the >> unavoidable mangling on post for the longish WSC lines - but more to the >> point, I can't currently find ANY working demos of event sinking _within_ >> a WSC. I tried tweaking your code a bit (including passing a reference to >> WScript into the component to handle sleeps properly), but cannot get >> events working in it as-is. I do recall there being some oddities with >> making events work properly inside WSCs, but it's been years since I've >> played with it so I'm coming up empty on solutions. :/ >> >> By any chance, do you have info on a working example of internal event >> hooking in a WSC? If you can point me at a reference, it might narrow >> down the problem in hookup. >> >> <billymyersiii@xxxxxx> wrote in message >> news:f938b587-b675-4716-8a2a-257959617920@xxxxxx Quote: >>> Can someone please tell me what I am doing wrong, I cannot seem to >>> trigger the IE events in my code. >>> >>> >>> >>> GUIForm.vbs >>> ----------------------------------------------------------------------------------------------------------------------------------------------------- >>> Dim GForm >>> >>> Set GForm = CreateObject("GUI.Form") >>> GForm.DisplayForm "My Form Title","My Form Message" >>> >>> Set GForm = Nothing >>> >>> >>> >>> >>> >>> GUI.Form.wsc >>> ------------------------------------------------------------------------------------------------------------------------------------------------------- >>> <?xml version="1.0"?> >>> <package> >>> <component> >>> <object id="o_filesys" progid="Scripting.FileSystemObject"/> >>> <object id="o_shell" progid="WScript.Shell"/> >>> <object id="o_app" progid="Shell.Application"/> >>> <object id="o_net" progid="WScript.NetWork"/> >>> <object id='oIE' progid='InternetExplorer.Application' events="true"/ >>>> >>> <?component error="true" debug="true"?> >>> <registration description="GUI" progid="GUI.Form" version="1.00" >>> classid="{f834660d-4b02-44db-9cee-b6b202d178ab}"> >>> <script language="VBScript"> >>> <![CDATA[ >>> Function register() >>> 'Code for handling register event can go here >>> End Function >>> Function unregister() >>> 'Code for handling unregister event can go here >>> End Function >>> ]]> >>> </script> >>> </registration> >>> <public> >>> <method name="DisplayForm"> >>> <PARAMETER name="title"/> >>> <PARAMETER name="message"/> >>> </method> >>> </public> >>> <implements type="Behavior" id="Behavior"/> >>> <script language="VBScript"> >>> <![CDATA[ >>> function DisplayForm(title, message) >>> With oIE >>> .navigate "About:Blank" >>> .left=200 >>> .top=200 >>> .height=400 >>> .width=400 >>> .menubar=0 >>> .toolbar=0 >>> .statusBar=0 >>> .Resizable=0 >>> .visible=0 >>> End With >>> oIE.Document.Title = ""& title >>> &" ." >>> oIE.Document.Body.Scroll = "no" >>> With oIE.Document.ParentWindow.Screen >>> oIE.Left = (.AvailWidth - oIE.Width ) \ 2 >>> oIE.Top = (.Availheight - oIE.Height) \ 2 >>> End With >>> Do While oIE.Busy >>> WScript.Sleep 200 >>> Loop >>> oIE.Document.Body.InnerHTML = "<DIV align=""center""><P>" & message >>> & "</P></DIV>" _ >>> & "<a href=""http://www.google.com"">Go To Google</a>" >>> oIE.visible=1 >>> Do While NOT (oIE is nothing) >>> Sleep 200 >>> Loop >>> end function >>> >>> Sub oIE_BeforeNavigate2(pDisp, URL, Flags, TargetFrameName, >>> PostData, Headers, Cancel) >>> Msgbox "Going to:", URL >>> Cancel = True >>> oIE.Quit >>> Set oIE = Nothing >>> End Sub >>> >>> Sub oIE_OnQuit() >>> Msgbox "QUITING" >>> oIE.Quit >>> Set oIE = Nothing >>> End Sub >>> >>> Sub Sleep(intDuration) >>> dblSeconds = intDuration / 1000 >>> If dblSeconds < 1 Then dblSeconds = 1 >>> dteStart = Now() >>> dteEnd = DateAdd("s", dblSeconds, dteStart) >>> >>> While dteEnd > Now() >>> DoNothing >>> Wend >>> End Sub >>> >>> Sub DoNothing >>> 'While/Wend has quirks when it is empty >>> End Sub >>> ]]> >>> </script> >>> </component> >>> </package> > |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Capturing First Few Ke Down Events | .NET General | |||
| vcr capturing | Vista music pictures video | |||
| Capturing PAL DV | Vista music pictures video | |||
| !!VISTA RC2!! Audio capturing while Video capturing | Vista music pictures video | |||