Board index » Visual Studio » Re: Problems in Waiting for Web page to Open

Re: Problems in Waiting for Web page to Open

Visual Studio344
"PaulFXH"



Quote
As you can imagine, I have some questions about exaclty what you did:

1) Why do you navigate to a HTML page rather than the .COM page I was

using?



if you click on>>KasperskyOnlineScanner vou will be redirdct to thr Html page



Quote
2) Can I assume that "item(58)" in "objIE.Document.all.item(58).click"

refers to the Button to be clicked? If so, how did you get that number (58)?



[1]



Quote
Note that I tried to save the page concerned (in order to look for

relevant HTML information) but found that Right-Click did not bring up

any context menu on any of the pages I would have liked to have

searched for HTML information (such as item number, or ID, for Buttons

to be clicked).



I have a Italian OS .. but i desume HTML view is disabled but vou can

APPSKEY>>>html or select View>>html on the ToolbarWindow



[1]

As I said ... Autoit can simplifying your live :

I upload also the source but you can use the exe without installing

autoit .. it's fron DaleHohm : www.filegone.com/7va1

click on Wowww.exe and wait 30 sec/ 1 min :



in the first page>>Characteristics of all HTML Elements on page

you have

Element Characteristics Index Tag Name Id Extra Information



58 INPUT Form Input Type: button Value: Accept



--

Fosco


-
 

Re:Re: Problems in Waiting for Web page to Open

"Fosco"

Quote
"PaulFXH"



The simpliest (sorry for my English .. simplest ?) for a begginner

is playing with



Generic test : Watch for word wrap (Url wrap)





Set objIE = CreateObject("InternetExplorer.application")



' IE security settings MUST be set on LOW









Set objIE = CreateObject("InternetExplorer.application")



' IE security settings MUST be set on LOW



objIE.Visible = True

objIE.Navigate "snipurl.com/index.php"">snipurl.com/index.php"

' objIE.document.parentwindow.clipboardData.SetData"text",""

'''objIE.document.parentwindow.clipboardData.SetData"text","www.google.it/search?">www.google.it/search?

'''hl=it&q=internetexplorer.application%2Bclick&btnG=Cerca+con+Google&meta="

WScript.Sleep 2000

Do While objIE.Busy = True

WScript.Sleep 50

Loop





objIE.document.forms.item(0).link.Value="http://www.google.it/search?hl" rel="nofollow" target="_blank">www.google.it/search=it&q=internetexplorer.application%2Bclick&btnG=C

erca+con+Google&meta="



objIE.Document.all.item(106).click



WScript.Sleep 2000

GetText = objIE.document.parentwindow.clipboardData.GetData("text")

msgbox GetText



--

Fosco





-

Re:Re: Problems in Waiting for Web page to Open

"Fosco"

Quote
"Fosco"

>"PaulFXH"

Generic test : Watch for word wrap (Url wrap)



arrrghhh .. hier ist es einfacher .. my os settings pops up the

German-English page ... lol



Set objIE = CreateObject("InternetExplorer.application")



' IE security settings MUST be set on LOW



objIE.Visible = True

objIE.Navigate "snipurl.com/index.php"">snipurl.com/index.php"



WScript.Sleep 2000

Do While objIE.Busy = True

WScript.Sleep 50

Loop





objIE.document.forms.item(0).link.Value="translate.google.com/translate_t"">translate.google.com/translate_t"



objIE.Document.all.item(106).click



WScript.Sleep 2000

GetText = objIE.document.parentwindow.clipboardData.GetData("text")

'msgbox GetText



objIE.Navigate GetText



WScript.Sleep 2000

Do While objIE.Busy = True

WScript.Sleep 50

Loop

objIE.document.forms.item(0).text.Value="hier ist es einfacher"

objIE.Document.all.item(66).click



'set oShell = CreateObject("WScript.Shell")

'oShell.run"C:\PROGRA~1\INTERN~1\IEXPLORE.EXE -new "& GetText

--

Fosco





-

Re:Re: Problems in Waiting for Web page to Open



Fosco escreveu:



Quote
"PaulFXH"



>As you can imagine, I have some questions about exaclty what you did:

>1) Why do you navigate to a HTML page rather than the .COM page I was

>using?



Hi Fosco

I didn't see your reply of yesterday until today as you started a new

thread with the same name. My newsreader, therefore, failed to notice

that you had replied.



Quote


if you click on>>KasperskyOnlineScanner vou will be redirdct to thr Html page



OK, I see that now, but only if I open this in IE. Firefox is my

default browser and I had been forgetting during thee investigations to

open Kaspersky ONLY in IE.

Nevertheless, I still don't get any toolbar showing up in the EULA page

which would allow me to view HTML information. Also, right-click does

NOTHING on this page.



Quote


>2) Can I assume that "item(58)" in "objIE.Document.all.item(58).click"

>refers to the Button to be clicked? If so, how did you get that number (58)?



[1]



>Note that I tried to save the page concerned (in order to look for

>relevant HTML information) but found that Right-Click did not bring up

>any context menu on any of the pages I would have liked to have

>searched for HTML information (such as item number, or ID, for Buttons

>to be clicked).



I have a Italian OS .. but i desume HTML view is disabled but vou can

APPSKEY>>>html or select View>>html on the ToolbarWindow



As I mentioned above, no TOOLBAR whatsoever shows up on the EULA page.

What is APPSKEY?

Quote


[1]

As I said ... Autoit can simplifying your live :

I upload also the source but you can use the exe without installing

autoit .. it's fron DaleHohm : www.filegone.com/7va1">www.filegone.com/7va1

click on Wowww.exe and wait 30 sec/ 1 min :



in the first page>>Characteristics of all HTML Elements on page

you have

Element Characteristics Index Tag Name Id Extra Information



58 INPUT Form Input Type: button Value: Accept



Ahhh, this is very interesting (and useful). However, it would be

useful for a beginner like me to have some kind of README or manual for

this tool. A Google search showed up absolutely nothing for wowww.exe.



However, I have been unable to deduce anything about the Index number

of the NEXT button on the following page (Scanner Update) using

wowww.exe. If I had this Index number, I believe I could probably

eliminate the last Wscript.Sleep command in my script.



Thanks again for your excellent help

Paul

Quote


--

Fosco



-

Re:Re: Problems in Waiting for Web page to Open



Fosco escreveu:



Quote
"Fosco"

>"PaulFXH"



Hi Fosco



Quote
The simpliest (sorry for my English .. simplest ?) for a begginner



"simplest" is both correct and very much what I need right now



Quote
is playing with



Generic test : Watch for word wrap (Url wrap)



I very much agree. Generic scripts are extremely useful for a beginner

like me. The MicroSoft WSH/VBS "manual" is, in my view, excessively

turgid to be of real value to a newbie.

My preference is to find "example" scripts and "cannibalize" them to

put my own script together....which is where the generic scripts come

in very handy.



Quote




Set objIE = CreateObject("InternetExplorer.application")



' IE security settings MUST be set on LOW









Set objIE = CreateObject("InternetExplorer.application")



' IE security settings MUST be set on LOW



objIE.Visible = True

objIE.Navigate "snipurl.com/index.php"">snipurl.com/index.php"

' objIE.document.parentwindow.clipboardData.SetData"text",""

'''objIE.document.parentwindow.clipboardData.SetData"text","www.google.it/search?">www.google.it/search?

'''hl=it&q=internetexplorer.application%2Bclick&btnG=Cerca+con+Google&meta="

WScript.Sleep 2000

Do While objIE.Busy = True

WScript.Sleep 50

Loop





objIE.document.forms.item(0).link.Value="http://www.google.it/search?hl" rel="nofollow" target="_blank">www.google.it/search=it&q=internetexplorer.application%2Bclick&btnG=C

erca+con+Google&meta="



objIE.Document.all.item(106).click



WScript.Sleep 2000

GetText = objIE.document.parentwindow.clipboardData.GetData("text")

msgbox GetText



OK, this works fine for me. However, it just seems to illustrate the

value of having the Index Number for the button (or Object) to be

"clicked".

As things stand, and dsepite having been introduced to the wowww.exe

tool, I still cannot see how to discover the Index Number for the NEXT

Button on the Scanner Update page.



Paul

Quote
--

Fosco



-

Re:Re: Problems in Waiting for Web page to Open



Fosco escreveu:



Quote
"Fosco"

>"Fosco"

>>"PaulFXH"

>Generic test : Watch for word wrap (Url wrap)





Once again, Hi Fosco



Quote
arrrghhh .. hier ist es einfacher .. my os settings pops up the

German-English page ... lol



Set objIE = CreateObject("InternetExplorer.application")



' IE security settings MUST be set on LOW



objIE.Visible = True

objIE.Navigate "snipurl.com/index.php"">snipurl.com/index.php"



WScript.Sleep 2000

Do While objIE.Busy = True

WScript.Sleep 50

Loop





objIE.document.forms.item(0).link.Value="translate.google.com/translate_t"">translate.google.com/translate_t"



objIE.Document.all.item(106).click



WScript.Sleep 2000

GetText = objIE.document.parentwindow.clipboardData.GetData("text")

'msgbox GetText



objIE.Navigate GetText



WScript.Sleep 2000

Do While objIE.Busy = True

WScript.Sleep 50

Loop

objIE.document.forms.item(0).text.Value="hier ist es einfacher"

objIE.Document.all.item(66).click





I presume this example is once more to show how a button can be clicked

once the Index Number is known.

Actually, this script doesn't function for me as I get a run-time error

in the line "objIE.document.forms.item(0).text.Value="hier ist es

einfacher"". I think this is because the German expression is not

present as a document (or whatever) on my computer.



Best wishes

Paul

Quote
'set oShell = CreateObject("WScript.Shell")

'oShell.run"C:\PROGRA~1\INTERN~1\IEXPLORE.EXE -new "& GetText

--

Fosco



-

Re:Re: Problems in Waiting for Web page to Open

"PaulFXH"

Quote
I didn't see your reply of yesterday until today as you started a new

thread with the same name.



Sometimes yuor replies are to long and I have set my OE to

NOT download post that are longer than 75 lines

I must go to google groups .. read your post .. copy .. answer and reply

on an older post here



Quote
OK, I see that now, but only if I open this in IE. Firefox is my

default browser



I use Internet Explorer



Quote
As I mentioned above, no TOOLBAR whatsoever shows up on the EULA page.



www.filegone.com/jrej">www.filegone.com/jrej



Quote
What is APPSKEY?



first left on RightCtrL i.e from right>>Left arrow .. CTRL ... Appskey

from left>>Alt Gr .. WinKey .. Appskey

(the same of right Click with the mouse)



i uploaded the html source www.filegone.com/jrej">www.filegone.com/jrej



Quote
>As I said ... Autoit can simplifying your live :

>I upload also the source



Ahhh, this is very interesting (and useful). However, it would be

useful for a beginner like me to have some kind of README or manual for

this tool. A Google search showed up absolutely nothing for wowww.exe.



I have made the exe from a *.au3 file

http://www.autoitscript.com/forum/index.php?showtopic" rel="nofollow" target="_blank">www.autoitscript.com/forum/index.php=13398

i think the source and various help/tips are here

http://www.autoitscript.com/forum/index.php?s" rel="nofollow" target="_blank">www.autoitscript.com/forum/index.php=2aa2e727f856b1fe68cedae56dd64c01&showtopic=13398&st=30



Quote
However, I have been unable to deduce anything about the Index number

of the NEXT button on the following page (Scanner Update) using

wowww.exe.



You can NOT use wowww.exe for that must compile the included *.au3 file

with the new url



Quote
If I had this Index number, I believe I could probably

eliminate the last Wscript.Sleep command in my script.



I can not help you in that .. I don't want to download the activeX to continue

2 ways .. you compile the Wowww.au3 yourself or give me the url and I will

upgrade the Wowww.exe



Wait ..try this : (Wowww2.exe and au3 source) just input the

url needed and click ok : www.filegone.com/2r6b">www.filegone.com/2r6b



--

Fosco







-

Re:Re: Problems in Waiting for Web page to Open

"PaulFXH"

Quote
As things stand, and dsepite having been introduced to the wowww.exe

tool, I still cannot see how to discover the Index Number for the NEXT

Button on the Scanner Update page.



Cut up (quote)[1] the posts a little to stay under the 75 lines

(i.e. no need to quote ALL the sample script again maybe just a part to

know what you are referencing)

[1]

learn.to/edit_messages">learn.to/edit_messages

www.guckes.net/mail/edit.html">www.guckes.net/mail/edit.html





I just replied your first post .. again here>>try this :

www.filegone.com/2r6b">www.filegone.com/2r6b



--

Fosco





-

Re:Re: Problems in Waiting for Web page to Open

"PaulFXH"

Quote
I presume this example is once more to show how a button can be clicked

once the Index Number is known.

Actually, this script doesn't function for me as I get a run-time error

in the line "objIE.document.forms.item(0).text.Value="hier ist es

einfacher"". I think this is because the German expression is not

present as a document (or whatever) on my computer.



Try this with Internet Explorer default browser :



Set objIE = CreateObject("InternetExplorer.application")

objIE.Visible = True

objIE.Navigate "translate.google.com/translate_t"">translate.google.com/translate_t"

WScript.Sleep 2000

Do While objIE.Busy = True

WScript.Sleep 50

Loop

objIE.document.forms.item(0).langpair.Value="de|en"

objIE.document.forms.item(0).text.Value="hier ist es einfacher"

objIE.Document.all.item(66).click

WScript.Sleep 5000

objIE.quit



Set objIE = CreateObject("InternetExplorer.application")

objIE.Visible = True

objIE.Navigate "translate.google.com/translate_t"">translate.google.com/translate_t"

Do While objIE.Busy = True

WScript.Sleep 50

Loop

WScript.Sleep 1000

objIE.document.forms.item(0).langpair.Value="it|en"

objIE.document.forms.item(0).text.Value="martello"

objIE.Document.all.item(66).click

WScript.Sleep 5000

objIE.quit



Set objIE = CreateObject("InternetExplorer.application")

objIE.Visible = True

objIE.Navigate "translate.google.com/translate_t"">translate.google.com/translate_t"

Do While objIE.Busy = True

WScript.Sleep 50

Loop

WScript.Sleep 1000

objIE.document.forms.item(0).langpair.Value="en|it"

objIE.document.forms.item(0).text.Value="bye"

objIE.Document.all.item(66).click



--

Fosco





-

Re:Re: Problems in Waiting for Web page to Open

"Fosco"

Quote
>What is APPSKEY?



But it was ONLY for Internet explorer browser .. if I recall firefox

has an internal option to view source/html



snipurl.com/rstr">snipurl.com/rstr

ecc

http://www.google.it/search?hl" rel="nofollow" target="_blank">www.google.it/search=it&q=firefox%2Bview+source%2Fhtml&meta=



--

Fosco





-

Re:Re: Problems in Waiting for Web page to Open

"PaulFXH"



FYA



You can use the info obtained with wowww.exe also directly .. i.e. :



http://translate.google.com/translate_t?langpair" rel="nofollow" target="_blank">translate.google.com/translate_t=por|en&text=escreveu



--

Fosco







-

Re:Re: Problems in Waiting for Web page to Open

"PaulFXH"



Quote
As I mentioned above, no TOOLBAR whatsoever shows up on the EULA page.



I have understand .... you must navigate the html page

www.kaspersky.com/kos/english/kavwebscan.html">www.kaspersky.com/kos/english/kavwebscan.html



better with Internet Explorer and>>>>>Apskey ecc or View ecc



--

Fosco





-

Re:Re: Problems in Waiting for Web page to Open



Fosco escreveu:





Quote
Sometimes yuor replies are to long and I have set my OE to

NOT download post that are longer than 75 lines

I must go to google groups .. read your post .. copy .. answer and reply

on an older post here



Hi Fosco,

Thanks for your replies.

OK, sorry about the length of my posts. I'm going to trim them right

back tonight so they should all come in well under the 75 line limit.



Quote


>What is APPSKEY?



first left on RightCtrL i.e from right>>Left arrow .. CTRL ... Appskey

from left>>Alt Gr .. WinKey .. Appskey

(the same of right Click with the mouse)



You know, I'm amazed that I never knew what that key was for. Indeed, I

didn't even know its name. Thanks for eductaing me here.





Quote


Wait ..try this : (Wowww2.exe and au3 source) just input the

url needed and click ok : www.filegone.com/2r6b">www.filegone.com/2r6b



OK, this looks a lot more useful as a tool for me.

Nevertheless, even with the wowww2.exe tool and the APPSKEY, I am

unable to discover the Index number of the NEXT button on the Kaspersky

Scanner Update Page.

However, having read the links you provided (AutoIt forum), it seems

that anomalies of this nature are by no means unknown.



Paul



Quote


--

Fosco



-

Re:Re: Problems in Waiting for Web page to Open



Fosco escreveu:





Quote
Cut up (quote)[1] the posts a little to stay under the 75 lines

(i.e. no need to quote ALL the sample script again maybe just a part to

know what you are referencing)



Hi Fosco

I think you should be seeing a difference in the length of my posts

now.

Paul



Quote


--

Fosco



-

Re:Re: Problems in Waiting for Web page to Open



Fosco escreveu:





Quote
Try this with Internet Explorer default browser :



Set objIE = CreateObject("InternetExplorer.application")

objIE.Visible = True

objIE.Navigate "translate.google.com/translate_t"">translate.google.com/translate_t"

WScript.Sleep 2000

Do While objIE.Busy = True

WScript.Sleep 50

Loop

objIE.document.forms.item(0).langpair.Value="de|en"

objIE.document.forms.item(0).text.Value="hier ist es einfacher"

objIE.Document.all.item(66).click

WScript.Sleep 5000

objIE.quit



Set objIE = CreateObject("InternetExplorer.application")

objIE.Visible = True

objIE.Navigate "translate.google.com/translate_t"">translate.google.com/translate_t"

Do While objIE.Busy = True

WScript.Sleep 50

Loop

WScript.Sleep 1000

objIE.document.forms.item(0).langpair.Value="it|en"

objIE.document.forms.item(0).text.Value="martello"

objIE.Document.all.item(66).click

WScript.Sleep 5000

objIE.quit



Set objIE = CreateObject("InternetExplorer.application")

objIE.Visible = True

objIE.Navigate "translate.google.com/translate_t"">translate.google.com/translate_t"

Do While objIE.Busy = True

WScript.Sleep 50

Loop

WScript.Sleep 1000

objIE.document.forms.item(0).langpair.Value="en|it"

objIE.document.forms.item(0).text.Value="bye"

objIE.Document.all.item(66).click



OK, this works fine and it's a nice little translator.

So that's what "Arrividerci" means <g>

Paul

Quote


--

Fosco



-

Re:Re: Problems in Waiting for Web page to Open



Fosco escreveu:



Quote
"Fosco"

>>What is APPSKEY?



But it was ONLY for Internet explorer browser .. if I recall firefox

has an internal option to view source/html





Firefox has View>Page Source, although I have never up to now

considered using it



Quote


--

Fosco



-

Re:Re: Problems in Waiting for Web page to Open



Fosco escreveu:



Quote
"PaulFXH"



>As I mentioned above, no TOOLBAR whatsoever shows up on the EULA page.



I have understand .... you must navigate the html page

www.kaspersky.com/kos/english/kavwebscan.html">www.kaspersky.com/kos/english/kavwebscan.html



better with Internet Explorer and>>>>>Apskey ecc or View ecc





Even navigating to the HTML page within IE as browser, the APPSKEY does

not show anything on either the EULA page nor on the Scanner Update

page.

The View>Source does however work on both pages. However, although the

first page (EULA) does contain a reference to the ACCEPT button, I can

find nothing in regards to it having an Index of 58. The only means I

can find for ascertaining this information is by means of the

wowww2.exe tool.



In addition, I can find nothing via wowww2.exe regarding the Index

Number for the NEXT button on the Scanner Update page. So, it seems

that I'm continually running into a stonewall here.



Nevertheless, the script I have to open this Virus Scanner DOES work

fine, even if it is a little crude. Given the difficulties I seem to be

running into, despite your highly erudite contributions, I really don't

want to spend the rest of my life trying to effect a relatively minor

refinement on this script.

Therefore, I feel it would be better to move on and only come back to

this particular problem whenever I happen to stumble on what might seem

like a possible solution. In addition, perhaps I do need to have a look

at AutoIt as you have continually advised.



I hope you will allow me to ask your advice on another, but related,

problem that I had recently posted here but has, as yet received no

replies. (See: Wait for Page Loading within Apps 13/06/06).

This refers to the fact that while many routes are available within

vbscript to delay the script proceeding until a previously-called web

page has loaded, I am not aware how this can be done when working ONLY

with off-line apps.

I recently wrote a small script to Print a Test Page (from a local

printer) which involved quite a number of different stages. However, in

order to avoid problems I had to insert a Wscript.Sleep command, of

arbitrary length, between each of the stages.

My preference would be to insert a Do While Busy type of loop as is

normal for webpages.

I would be grateful for any advice you can offer on this.



Many thanks and best wishes

Paul







Quote


--

Fosco



-

Re:Re: Problems in Waiting for Web page to Open

"PaulFXH"

Quote
The View>Source does however work on both pages. However, although the

first page (EULA) does contain a reference to the ACCEPT button, I can

find nothing in regards to it having an Index of 58.



You can use other methods than index .. maybe NAME here is a generic sample

(www.kaspersky.com down at moment)



Set objIE = CreateObject("InternetExplorer.application")

objIE.Visible = True

objIE.Navigate "google.it/"">google.it/"

Do While objIE.Busy = True

WScript.Sleep 50

Loop

WScript.Sleep 1000

msgbox "NON fare niente clicca SOLO su OK"

'Mixed procedure name/index

objIE.document.forms.item(0).q.Value="Ciao"

WScript.Sleep 1000



stext1 = objIE.document.forms.item(0).q.Value

'stext2 = objIE.document.forms.form.q.Value

' ALL Index index

stext2 = objIE.document.forms.item(0).item(1).Value



'ALL name

' come vedi dalla prima pagina risultanti col wowww.exe il Name

' del form che ci interessa e' F per qui :

stext3 = objIE.document.all.f.q.Value



Msgbox " Mixed Procedure " & stext1

Msgbox "ALL By Index " & stext2

msgbox "ALL By Name " & stext3

WScript.Sleep 2000



' thish is ALL by name click as you see NO index needed



objIE.document.all.btnG.Click





--

Fosco





-

Re:Re: Problems in Waiting for Web page to Open

"PaulFXH"

Quote
I hope you will allow me to ask your advice on another [CUT]



I have no experience with Printers .. sorry _:



http://www.google.it/search?hl" rel="nofollow" target="_blank">www.google.it/search=it&q=wsh%2Bprint&meta=

http://www.google.com/search?hl" rel="nofollow" target="_blank">www.google.com/search=it&q=wsh%2Bprint&meta=



--

Fosco





-

Re:Re: Problems in Waiting for Web page to Open

"Fosco"

Quote
"PaulFXH"

You can use other methods than index .. maybe NAME here is a generic sample

(www.kaspersky.com down at moment)





Here is a cleaner sample All by name ... even wowww.exe is not working

you may view at the source HTML of the page and search for the names

of the button to click [1] :



Set objIE = CreateObject("InternetExplorer.application")

objIE.Visible = True

objIE.Navigate "google.com/"">google.com/"

Do While objIE.Busy = True

WScript.Sleep 50

Loop

WScript.Sleep 1000

objIE.document.all.q.Value="Ciao"

WScript.Sleep 1000

stext2 = objIE.document.all.q.Value

Msgbox "ALL By Name " & stext2

WScript.Sleep 2000

' thish is ALL by name click as you see NO index needed

objIE.document.all.btnG.Click





'[1]

this is part of the google.it source



cellpadding=0><tr><td width=25%>&nbsp;</td><td align=center><input type=hidden name=hl value=it><input maxlength=2048

size=55 name=q value="" title="Cerca con Google"><br><input type=submit value="Cerca con Google" name=btnG><input



you can se the button name>>btnG <<<<< and how i submit it even

without knowing the index>>>objIE.document.all.btnG.Click



same thing with your page search for the name (e/o submit) and try something like :

objIE.Document.all.Accept.click

or

objIE.Document.all.item.Accept.click



ecc



--

Fosco







-

Re:Re: Problems in Waiting for Web page to Open

"Fosco"

Quote
same thing with your page search for the name (e/o submit) and try something like :



As I said .. all could be done in wsh+InternetExplorer.application

but it's not simple for a beginner

Here the FULL references

http://msdn.microsoft.com/library/default.asp?url" rel="nofollow" target="_blank">msdn.microsoft.com/library/default.asp=/workshop/browser/webbrowser/reference/Objects/InternetExplorer.asp



--

Fosco





-

Re:Re: Problems in Waiting for Web page to Open

"Fosco"



No name for the buttons but if you like playing around now or later (i have no time)



msdn.microsoft.com/workshop/author/dhtml/reference/methods/item.asp">msdn.microsoft.com/workshop/author/dhtml/reference/methods/item.asp



http://msdn.microsoft.com/library/default.asp?url" rel="nofollow" target="_blank">msdn.microsoft.com/library/default.asp=/workshop/author/dhtml/reference/properties/tagname.asp



'ecc



Set objIE = CreateObject("InternetExplorer.application")

objIE.Visible = True

objIE.Navigate "www.kaspersky.com/kos/english/kavwebscan.html"">www.kaspersky.com/kos/english/kavwebscan.html"

Do While objIE.Busy = True

WScript.Sleep 50

Loop



WScript.Sleep 2000



coll = objIE.Document.all.item ="BUTTON"

'var = document.all.item("Sample")



msgbox coll





for i = 0 to objIE.document.all.length

'msgbox objIE.document.all(i).tagName

if objIE.document.all(i).tagName="INPUT" then

'if objIE.document.all(i).value="accept" then

msgbox objIE.document.all(i).type

if objIE.document.all(i).type="Button" then

msgbox""

' end if

end if

end if

next

'ecc



'objIE.Document.all.item(58).click



--

Fosco











-

Re:Re: Problems in Waiting for Web page to Open



Fosco escreveu:





Quote


You can use other methods than index .. maybe NAME here is a generic sample

(www.kaspersky.com down at moment)



Set objIE = CreateObject("InternetExplorer.application")

objIE.Visible = True

objIE.Navigate "google.it/"">google.it/"

Do While objIE.Busy = True

WScript.Sleep 50

Loop

WScript.Sleep 1000

msgbox "NON fare niente clicca SOLO su OK"

'Mixed procedure name/index

objIE.document.forms.item(0).q.Value="Ciao"

WScript.Sleep 1000



stext1 = objIE.document.forms.item(0).q.Value

'stext2 = objIE.document.forms.form.q.Value

' ALL Index index

stext2 = objIE.document.forms.item(0).item(1).Value



'ALL name

' come vedi dalla prima pagina risultanti col wowww.exe il Name

' del form che ci interessa e' F per qui :

stext3 = objIE.document.all.f.q.Value



Msgbox " Mixed Procedure " & stext1

Msgbox "ALL By Index " & stext2

msgbox "ALL By Name " & stext3

WScript.Sleep 2000



' thish is ALL by name click as you see NO index needed



objIE.document.all.btnG.Click



Hi Fosco

This works fine for me. However, it seems to me that the only novelty

here is the use of the command " objIE.document.all.btnG.Click" to

click the first available button.

While this seems to work fine on the Google page, it does not click

anything for me in the Kaspersky program nor in another script I have

to open Yahoo Mail.



Paul

Quote




--

Fosco



-

Re:Re: Problems in Waiting for Web page to Open



Fosco escreveu:





Quote
I have no experience with Printers .. sorry _:



Fosco,

My question has absolutely NOTHING to do with printers. It just happens

incidentally to involve a printing step.

Here is a small extract from the script I wrote which will illustrate

what improvement I am looking for:



Dim objShell

Set objShell = WScript.CreateObject("Wscript.shell")

objShell.Run "control panel"

wscript.sleep 1000

wshshell.SendKeys "{p 4}"



After calling Control Panel, I had to insert a Wscript.Sleep command of

1 second to allow time for Control panel to open fully before

proceeding.

Surely there must be a Do..While..Busy type of loop that I can use here

which is equivalnet to the various loops that allow the script to wait

until a web page is fully open.



Paul





-

Re:Re: Problems in Waiting for Web page to Open



Fosco escreveu:



Quote


Here is a cleaner sample All by name ... even wowww.exe is not working

you may view at the source HTML of the page and search for the names

of the button to click [1] :



Set objIE = CreateObject("InternetExplorer.application")

objIE.Visible = True

objIE.Navigate "google.com/"">google.com/"

Do While objIE.Busy = True

WScript.Sleep 50

Loop

WScript.Sleep 1000

objIE.document.all.q.Value="Ciao"

WScript.Sleep 1000

stext2 = objIE.document.all.q.Value

Msgbox "ALL By Name " & stext2

WScript.Sleep 2000

' thish is ALL by name click as you see NO index needed

objIE.document.all.btnG.Click





'[1]

this is part of the google.it source



cellpadding=0><tr><td width=25%>&nbsp;</td><td align=center><input type=hidden name=hl value=it><input maxlength=2048

size=55 name=q value="" title="Cerca con Google"><br><input type=submit value="Cerca con Google" name=btnG><input



you can se the button name>>btnG <<<<< and how i submit it even

without knowing the index>>>objIE.document.all.btnG.Click



same thing with your page search for the name (e/o submit) and try something like :

objIE.Document.all.Accept.click

or

objIE.Document.all.item.Accept.click



Hi again Fosco

OK, I see better now where the btnG came from.

However, I tried the View>Source on the Yahoo Mail page. However, the

button I wished to click in the script had NEITHER a Name nor an ID,

just a Value.

This was confirmed by wowww2.exe



then I tried the Scanner Update page on the Kaspersky program. Here, as

far as I could tell, the NEXT button had a name of 'btNextInit".

So, I tried this using the suggestions you made. However, in neither

case did the NEXT button get clicked. Mysteriously, this addition to

the script seemed to cause the first button in my QuickLaunch area to

be clicked (??).



Paul

Quote


ecc



--

Fosco



-

Re:Re: Problems in Waiting for Web page to Open



Fosco escreveu:



Quote
"Fosco"

>same thing with your page search for the name (e/o submit) and try something like :



As I said .. all could be done in wsh+InternetExplorer.application

but it's not simple for a beginner

Here the FULL references

http://msdn.microsoft.com/library/default.asp?url" rel="nofollow" target="_blank">msdn.microsoft.com/library/default.asp=/workshop/browser/webbrowser/reference/Objects/InternetExplorer.asp





Fosco,

This link brings me to a page with very little, if any, information.



Paul

Quote
--

Fosco



-

Re:Re: Problems in Waiting for Web page to Open



Fosco escreveu:



Quote
"Fosco"



No name for the buttons but if you like playing around now or later (i have no time)



msdn.microsoft.com/workshop/author/dhtml/reference/methods/item.asp">msdn.microsoft.com/workshop/author/dhtml/reference/methods/item.asp



http://msdn.microsoft.com/library/default.asp?url" rel="nofollow" target="_blank">msdn.microsoft.com/library/default.asp=/workshop/author/dhtml/reference/properties/tagname.asp



'ecc



Set objIE = CreateObject("InternetExplorer.application")

objIE.Visible = True

objIE.Navigate "www.kaspersky.com/kos/english/kavwebscan.html"">www.kaspersky.com/kos/english/kavwebscan.html"

Do While objIE.Busy = True

WScript.Sleep 50

Loop



WScript.Sleep 2000



coll = objIE.Document.all.item ="BUTTON"

'var = document.all.item("Sample")



msgbox coll





for i = 0 to objIE.document.all.length

'msgbox objIE.document.all(i).tagName

if objIE.document.all(i).tagName="INPUT" then

'if objIE.document.all(i).value="accept" then

msgbox objIE.document.all(i).type

if objIE.document.all(i).type="Button" then

msgbox""

' end if

end if

end if

next

'ecc



'objIE.Document.all.item(58).click



Fosco,

This is a very interesting script.

However, all of this is showing me that I really do have an awful lot

to learn. At least 90% of what you have shown me has been completely

new to me.



Many thanks for your kind help and best wishes to you

Paul

Quote


--

Fosco



-

Re:Re: Problems in Waiting for Web page to Open

"PaulFXH"

Quote
While this seems to work fine on the Google page, it does not click

anything for me in the Kaspersky program nor in another script I have

to open Yahoo Mail.



'This is my last post in this thread .. i think all I know is here :-)

'but if you have problems or question ask



'Here is my Offline [2] test WITHOUT index on the first page (until ActiveX)

'make the same with the next page if you don't want sendKeys it can

'be done by reading the html page[1] and/or by various tries like i have done



[2] Just tested also online now ALL ok



'[1]

'/HTML

'<TD vAlign=top height=50><INPUT style="FONT-SIZE: 12px; WIDTH: 100px"

'onclick=javascript:checkVersion() type=button value=Accept>&nbsp;&nbsp;&nbsp;

'HTML/



' you can see the structure and like I handled it without Index needed

'>>INPUT>>>>type>>button>>value (CAUTION maybe all case sensitive)



on error resume next

Set objIE = CreateObject("InternetExplorer.application")

objIE.Visible = True

' objIE.Navigate "C:\WINDOWS\TEMP\Kaspersky On-line Scanner.mht"

objIE.Navigate "www.kaspersky.com/kos/english/kavwebscan.html"">www.kaspersky.com/kos/english/kavwebscan.html"



Do While objIE.Busy = True

WScript.Sleep 50

Loop



WScript.Sleep 2000

for i = 0 to objIE.document.all.length

'msgbox objIE.document.all(i).tagName

if objIE.document.all(i).tagName="INPUT" then

'if objIE.document.all(i).value="accept" then

' msgbox objIE.document.all(i).type

'if objIE.document.all(i).type="button" then ' caSe SenSitIve spent 1 hour on this

'msgbox"BINGO"

if objIE.document.all(i).type="button" and objIE.document.all(i).value="Accept" then



' from if objIE>>TO>>Accept" then ALL in 1 line



' don't sure AND or OR or & here

'if objIE.document.all(i).type="button" or objIE.document.all(i).value="Accept" then

objIE.document.all(i).click

'msgbox"

end if

'end if

end if

next

WScript.Sleep 2000

' objIE.quit

'ecc



--

Fosco





-

Re:Re: Problems in Waiting for Web page to Open

"PaulFXH"

Quote
Hi Fosco

This works fine for me. However, it seems to me that the only novelty

here is the use of the command " objIE.document.all.btnG.Click" to

click the first available button.



It's NOT the first available button but>>>btnG <<<<<



--

Fosco





-

Re:Re: Problems in Waiting for Web page to Open

"PaulFXH"

Quote
Fosco,

My question has absolutely NOTHING to do with printers. It just happens

incidentally to involve a printing step.

Here is a small extract from the script I wrote which will illustrate

what improvement I am looking for:

[cut]

wshshell.SendKeys "{p 4}"



What is p 4 ?

You don' need to do that

Maybe on a WinXp it's different but it can be done like this on a win9x



direct *cpl cal (*cpl are the real files that are in control panel)

http://www.google.it/search?hl" rel="nofollow" target="_blank">www.google.it/search=it&q=winxp%2Bcpl&meta=



'--this script opens the Display Properties window.

'--to open other control panel windows replace "desk.cpl" with

'--the appropriate string.

'-- Some are listed below. You may have others. For instance, if TweakUI

'-- is installed there'll be a tweakui.cpl

'-- Some of the CPL files contain multiple interfaces. For example, Main.cpl

'-- will open the Mouse Properties window, but it also contains keyboard properties.

'---------------------------------------------------------

Dim shl

Set shl = CreateObject("Shell.Application")

shl.ControlPanelItem cstr("desk.cpl")



set shl = nothing



'--CPL files and their respective Control Panel windows:



'--DESK.CPL - Display Properties

'--INETCPL.CPL - Internet Properties

'--MMSYS.CPL - Multimedia Properties

'--MODEM.CPL - Modems Properties

'--NETCPL.CPL - Network

'--PASSWORD.CPL - Passwords

'--POWERCFG.CPL - Power Management Properties

'--APPWIZ.CPL - Add/Remove Programs

'--MAIN.CPL - Main - defaults to mouse properties.

'--SYSDM.CPL - System Properties

'--TELEPHON.CPL - Telephony

'--TIMEDATE.CPL - TimeDate

'--STICPL.CPL - Scanners and Cameras



'Control panel

Set oShell = WScript.CreateObject("WScript.Shell")

oShell.Run "explorer.exe /n,::"& _

"{20D04FE0-3AEA-1069-A2D8-08002B30309D}\::"& _

"{21EC2020-3AEA-1069-A2DD-08002B30309D}"



' Printers

Set WSHShell = WScript.CreateObject("WScript.Shell")

WSHShell.Run "explorer.exe /n,::"& _

"{20D04FE0-3AEA-1069-A2D8-08002B30309D}\::"& _

"{2227A280-3AEA-1069-A2DE-08002B30309D}"



' ecc



--

Fosco





-

Re:Re: Problems in Waiting for Web page to Open

"PaulFXH"

Quote
After calling Control Panel, I had to insert a Wscript.Sleep command of

1 second to allow time for Control panel to open fully before

proceeding.

Surely there must be a Do..While..Busy type of loop



change calculator with your REAL cal caption (depends on OS language)

launch the script and launch calculator (start>>run>>calc enter)



set oShell = CreateObject("WScript.Shell")

Do Until oShell.AppActivate("Calculator")

wscript.sleep 200

Loop

Msgbox "Calc is Active"



' exec method



Set WshShell = CreateObject("WScript.Shell")

Set oExec = WshShell.Exec("calc")

Do While oExec.Status = 0

WScript.Sleep 100

Loop

WScript.Echo "stato " & oExec.Status &" " &"closed"



Set oExec = WshShell.Exec("notepad")

WScript.Sleep 2000

oExec.Terminate()



' run

Set oSh = CreateObject("WScript.Shell")

' Next line runs , normal window (1), waits until exit (True)

oSh.Run "notepad",1,True

' Next line sleeps 2 seconds to give time to fade

'wscript.sleep 2000

oSh.Run "calc",1,False ' not wait



' here is good guide

Download :

download.microsoft.com/download/winscript56/Install/5.6/W982KMeXP/EN-US/scrdoc56en.exe">download.microsoft.com/download/winscript56/Install/5.6/W982KMeXP/EN-US/scrdoc56en.exe



snip : snipurl.com/jtut">snipurl.com/jtut



--

Fosco









-

Re:Re: Problems in Waiting for Web page to Open

"PaulFXH"

Quote
However, I tried the View>Source on the Yahoo Mail page. However, the

button I wished to click in the script had NEITHER a Name nor an ID,

just a Value.



on error resume next

Set objIE = CreateObject("InternetExplorer.application")

objIE.Visible = True

objIE.Navigate "mail.yahoo.com/"">mail.yahoo.com/"

Do While objIE.Busy = True

WScript.Sleep 50

Loop

WScript.Sleep 200



objIE.document.all.item(81).Value="USER"

objIE.document.all.item(86).Value="Password"



' we can just use again the sample I have done .. so you can see how it works



for i = 0 to objIE.document.all.length

'msgbox objIE.document.all(i).tagName

if objIE.document.all(i).tagName="INPUT" then

'if objIE.document.all(i).value="accept" then

' msgbox objIE.document.all(i).type

'if objIE.document.all(i).type="submit"

'msgbox"BINGO"

if objIE.document.all(i).type="submit" and objIE.document.all(i).value="Sign In" then

' abova ALL in 1 line

objIE.document.all(i).click

'msgbox"

end if

'end if

end if

next

WScript.Sleep 2000

' objIE.quit

'ecc



Quote
then I tried the Scanner Update page on the Kaspersky program. Here, as

far as I could tell, the NEXT button had a name of 'btNextInit".



use the same as above



PS:

as you can see the above Yahoo script is all done by looking at

wowww.exe first page : Characteristics of all HTML Elements on page



81 INPUT login username Form Input Type: text Value: 0

86 INPUT passwd passwd Form Input Type: password Value: 0

91 INPUT Form Input Type: submit Value: Sign In



--

Fosco







-

Re:Re: Problems in Waiting for Web page to Open

"PaulFXH"

Quote
This is a very interesting script.

However, all of this is showing me that I really do have an awful lot

to learn. At least 90% of what you have shown me has been completely

new to me.



I had time yesterday and played with .. all updated on this thread

give it a try and let me know

ciao



--

Fosco





-

Re:Re: Problems in Waiting for Web page to Open

"Fosco"

'''''' on error resume next

for i = 0 to objIE.document.all.length -1



ecc



--

Fosco





-

Re:Re: Problems in Waiting for Web page to Open

"Fosco"

Quote
"Fosco"

'''''' on error resume next

for i = 0 to objIE.document.all.length -1





As you I also don't like read the docs and test directly the scripts

but the risk is to make real basic beginners errors and mistakes

I suggest you (me too) to read first and try later :



Set oShell = WScript.CreateObject("Wscript.shell")

oShell.run"notepad"

WScript.Sleep 500

oshell.SendKeys "{p 4}"



--

Fosco











-

Re:Re: Problems in Waiting for Web page to Open



Fosco escreveu:





Quote


What is p 4 ?



Hi Fosco

p 4 is just a simple way of getting to the fourth Control Panel applet

that begins with the letter p, which is the Printers and faxes applet.

Yes, there are more direct ways of getting there, but my first priority

is just to get something that (at least) looks like it's going to work.

Afetr that, I can set about cleaning things up.



Quote
You don' need to do that

Maybe on a WinXp it's different but it can be done like this on a win9x



direct *cpl cal (*cpl are the real files that are in control panel)

http://www.google.it/search?hl" rel="nofollow" target="_blank">www.google.it/search=it&q=winxp%2Bcpl&meta=



'--this script opens the Display Properties window.

'--to open other control panel windows replace "desk.cpl" with

'--the appropriate string.

'-- Some are listed below. You may have others. For instance, if TweakUI

'-- is installed there'll be a tweakui.cpl

'-- Some of the CPL files contain multiple interfaces. For example, Main.cpl

'-- will open the Mouse Properties window, but it also contains keyboard properties.

'---------------------------------------------------------

Dim shl

Set shl = CreateObject("Shell.Application")

shl.ControlPanelItem cstr("desk.cpl")



set shl = nothing



'--CPL files and their respective Control Panel windows:



'--DESK.CPL - Display Properties

'--INETCPL.CPL - Internet Properties

'--MMSYS.CPL - Multimedia Properties

'--MODEM.CPL - Modems Properties

'--NETCPL.CPL - Network

'--PASSWORD.CPL - Passwords

'--POWERCFG.CPL - Power Management Properties

'--APPWIZ.CPL - Add/Remove Programs

'--MAIN.CPL - Main - defaults to mouse properties.

'--SYSDM.CPL - System Properties

'--TELEPHON.CPL - Telephony

'--TIMEDATE.CPL - TimeDate

'--STICPL.CPL - Scanners and Cameras



'Control panel

Set oShell = WScript.CreateObject("WScript.Shell")

oShell.Run "explorer.exe /n,::"& _

"{20D04FE0-3AEA-1069-A2D8-08002B30309D}\::"& _

"{21EC2020-3AEA-1069-A2DD-08002B30309D}"



' Printers

Set WSHShell = WScript.CreateObject("WScript.Shell")

WSHShell.Run "explorer.exe /n,::"& _

"{20D04FE0-3AEA-1069-A2D8-08002B30309D}\::"& _

"{2227A280-3AEA-1069-A2DE-08002B30309D}"



' ecc



--

Fosco



-

Re:Re: Problems in Waiting for Web page to Open



Fosco escreveu:





Quote


change calculator with your REAL cal caption (depends on OS language)

launch the script and launch calculator (start>>run>>calc enter)



Actually, I don't have Calculator on my computor (at least, not with

that name).



Quote


set oShell = CreateObject("WScript.Shell")

Do Until oShell.AppActivate("Calculator")

wscript.sleep 200

Loop

Msgbox "Calc is Active"



This works GREAT for me in my Print Test Page script, but only up to a

point.

The script in total has 16 separate steps. The first three of these are

carried out in the Control Panel app. So, using the above loop with "Do

Until oShell.AppActivate("Control Panel")" as the second line does

exactly what I want it to do.

After that, however, the script moves into a different app (to do with

printers) and the loop understandably doesn't function any more.

Obviously, I just need to replace "Control Panel" with the name of the

app currently in use. But this is where I run into a problem.

I have used what appears on the Window for that app as the name (such

as Printers and Faxes) but this does not work.

Perhaps you have some tips on how to find out the name of an app.

Nevertheless, I believe I'm gonna get this to work.



Very many thanks for yet another great tip.

Paul

Quote


' exec method



Set WshShell = CreateObject("WScript.Shell")

Set oExec = WshShell.Exec("calc")

Do While oExec.Status = 0

WScript.Sleep 100

Loop

WScript.Echo "stato " & oExec.Status &" " &"closed"



Set oExec = WshShell.Exec("notepad")

WScript.Sleep 2000

oExec.Terminate()



' run

Set oSh = CreateObject("WScript.Shell")

' Next line runs , normal window (1), waits until exit (True)

oSh.Run "notepad",1,True

' Next line sleeps 2 seconds to give time to fade

'wscript.sleep 2000

oSh.Run "calc",1,False ' not wait



' here is good guide

Download :

download.microsoft.com/download/winscript56/Install/5.6/W982KMeXP/EN-US/scrdoc56en.exe">download.microsoft.com/download/winscript56/Install/5.6/W982KMeXP/EN-US/scrdoc56en.exe



snip : snipurl.com/jtut">snipurl.com/jtut



--

Fosco



-

Re:Re: Problems in Waiting for Web page to Open



Fosco escreveu:







Quote


PS:

as you can see the above Yahoo script is all done by looking at

wowww.exe first page : Characteristics of all HTML Elements on page



81 INPUT login username Form Input Type: text Value: 0

86 INPUT passwd passwd Form Input Type: password Value: 0

91 INPUT Form Input Type: submit Value: Sign In





Hi Fosco,

This script just didn't work for me.

In addition, when I ran wowww2.exe on the Yahoo Mail Sign In page I got

quite different IDs for the input boxes and the Sign In button. These

were, respectively, 22,23 and 25 rather than the 81, 86 and 91 that you

used.

Nevertheless, even with these numbers, it still did nothing for me.

I'm going to have to study it more closely.



BTW, the WSH Documentation download that you indicated in your last

post, I already have.

But, I have to say that it is not the mosr user friendly of manuals and

seems to be more geared as a reminder for people who already know all

this stuff rather than a beginner who is struggling like me. <g>



Paul

Quote
--

Fosco



-

Re:Re: Problems in Waiting for Web page to Open

"PaulFXH"

Quote
>set oShell = CreateObject("WScript.Shell")

>Do Until oShell.AppActivate("Calculator")

>wscript.sleep 200

>Loop

>Msgbox "Calc is Active"



The first applicatin wit CAPTION Calculator will activate the messagbox

and loop OUT(quit) the script





If I recall you have win me ... this is calc ... C:\WINDOWS\CALC.EXE

you can extract it from installation CD



Quote
After that, however, the script moves into a different app (to do with

printers) and the loop understandably doesn't function any more.

Obviously, I just need to replace "Control Panel" with the name of the

app currently in use. But this is where I run into a problem.



Perhaps you have some tips on how to find out the name of an app.

Nevertheless, I believe I'm gonna get this to work.



Ok .. but you can simple open your app amd Control+ALT+CANC

and read the caption (it's CAse SenSitive in AppActivate)

or I use this www.filegone.com/okkg">www.filegone.com/okkg



--

Fosco





-

Re:Re: Problems in Waiting for Web page to Open

"PaulFXH"

Quote
This script just didn't work for me.



ALL my test are made with Internet Explorer 5.5sp2

FORGET to use them in Firefox .. will only mess up things



Quote
In addition, when I ran wowww2.exe on the Yahoo Mail Sign In page I got

quite different IDs for the input boxes and the Sign In button. These

were, respectively, 22,23 and 25 rather than the 81, 86 and 91 that you

used.

Nevertheless, even with these numbers, it still did nothing for me.



Can be different for various reasons



'IMHO index is always the simpler and reliable way and you

' don't have to worry about input names submit types ecc :



Set objIE = CreateObject("InternetExplorer.application")

objIE.Visible = True

objIE.Navigate "www.google.it/"">www.google.it/"

Do While objIE.Busy = True

WScript.Sleep 50

Loop

WScript.Sleep 200



objIE.document.all.item(41).Value="wsh+faq"

objIE.document.all.item(43).Click

'objIE.document.all.item(47).Click





'PS :

tested again on mail.yahoo.com/">mail.yahoo.com/ and works fine here :

and redirects me here https://login.yahoo.com/config/login?

(I don't have an Yahoo account)

or if I use my Yahoo Groups User & Pass

redirects me here https://edit.yahoo.com/config/mail?.intl=it

' But it WORKS





Set objIE = CreateObject("InternetExplorer.application")

objIE.Visible = True

objIE.Navigate "mail.yahoo.com/"">mail.yahoo.com/"

Do While objIE.Busy = True

WScript.Sleep 50

Loop

WScript.Sleep 200



objIE.document.all.item(81).Value="USER"

objIE.document.all.item(86).Value="Password"

objIE.document.all.item(91).Click





'woww.exe on mail.yahoo.com/">mail.yahoo.com/>>>>5.14 18/06/06



81 INPUT login username Form Input Type: text

86 INPUT passwd passwd Form Input Type: password Value: 0

91 INPUT Form Input Type: submit Value: Sign In



--

Fosco







-

Re:Re: Problems in Waiting for Web page to Open



Fosco escreveu:





Quote


The first applicatin wit CAPTION Calculator will activate the messagbox

and loop OUT(quit) the script





If I recall you have win me ... this is calc ... C:\WINDOWS\CALC.EXE

you can extract it from installation CD



Hi Fosco,

I actually use WinXP (I did use WinME for three months up to a short

time ago in another location).

However, I mislead you about the presence of Calculator on my machine.

Although I use MS Calculator Plus, Calculator is actually there.

When I found it after posting to you yesterday, your script worked

fine.



Quote




>Perhaps you have some tips on how to find out the name of an app.

>Nevertheless, I believe I'm gonna get this to work.



Ok .. but you can simple open your app amd Control+ALT+CANC

and read the caption (it's CAse SenSitive in AppActivate)

or I use this www.filegone.com/okkg">www.filegone.com/okkg



The little app you sent is very useful as the App name in the window is

often too large to see in its entirety. In addition the ability to copy

the app name to the clipboard is great.

However, the problem that I really had was that I was ignoring the case

sensitivity required by AppActivate.

Now that I'm aware of that, I made a huge amount of progress in tidying

up the script I use to print a test page. It now works about four times

faster as its various steps no longer have to wait for the arbitrary

times I assigned to each to avoid conflict between the steps.



As usual, however, I still have one small problem. I use the "Do Until

oShell.AppActivate" loop at each of the steps. To do this I wrote

subroutines appropriate to each sucessive app in the procedure. There

are six of these subroutines.

However, they only differ in that a different app is referred to in

each one.

My intention had been to use a VARIABLE app name in JUST ONE subroutine

that would be called repeatedly after changing the variable app name.

I tried this with strText and with Name but neither of these did the

trick.

Have you any suggestions?

I will post the script as it stands in the next post to avoid going

over your 75-line limit.



TIA

Paul



Quote


--

Fosco



-

Re:Re: Problems in Waiting for Web page to Open



Fosco escreveu:



Fosco,

Here's the script I referred to in the last post:



set wshshell = CreateObject("WScript.Shell")

Dim objShell

Set objShell = WScript.CreateObject("Wscript.shell")

objShell.Run "control panel"



Sub WaitForLoad

set oShell = CreateObject("WScript.Shell")

Do Until oShell.AppActivate("Control Panel")

wscript.sleep 100

Loop

End Sub



Sub WaitForLoad1

set oShell = CreateObject("WScript.Shell")

Do Until oShell.AppActivate("Printers and Faxes")

wscript.sleep 100

Loop

End Sub



Sub WaitForLoad2

set oShell = CreateObject("WScript.Shell")

Do Until oShell.AppActivate("Epson Stylus Photo 830 Series")

wscript.sleep 100

Loop

End Sub



Sub WaitForLoad3

set oShell = CreateObject("WScript.Shell")

Do Until oShell.AppActivate("Epson Stylus Photo 830 Series Properties")

wscript.sleep 100

Loop

End Sub



Sub WaitForLoad4

set oShell = CreateObject("WScript.Shell")

Do Until oShell.AppActivate("Print Preview - Test Page")

wscript.sleep 100

Loop

End Sub



Sub WaitForLoad5

set oShell = CreateObject("WScript.Shell")

Do Until oShell.AppActivate("EPSON Stylus Photo 830 Series - USB001")

wscript.sleep 100

Loop

End Sub





WaitForLoad

wshshell.SendKeys "{p 4}" 'Go to Printers and Faxes applet in Control

Panel

wshshell.SendKeys "{enter}" ' Open it

WaitForLoad

wshshell.SendKeys "{e}" 'Select Epson printer

WaitForLoad1

wshshell.SendKeys "{enter}" 'Open Epson printer dialog box

WaitForLoad2

wshshell.SendKeys "%{p}" 'Click Printer in toolbar options

wshshell.SendKeys "{r}" 'Clcik Properties in Drop-Down box

WaitForLoad3

wshshell.SendKeys "{tab 6}" 'Tab to Print Test Page button

wshshell.SendKeys "{enter}" 'Click it

WaitForLoad4

wshshell.SendKeys "%{f}" 'Click File in Toolbar

wshshell.SendKeys "{p}" 'Click Print Document

WaitForLoad5

wscript.sleep 100



Set WshShell = CreateObject("WScript.Shell")

WshShell.AppActivate "Printers and faxes" 'Assign Focus to Printers

and Faxes window



wshshell.SendKeys "%{f}" 'Click File in Toolbar

wshshell.SendKeys "{c}" 'Click Close





I hope this is not too long for you <g>

Paul



-

Re:Re: Problems in Waiting for Web page to Open



Fosco escreveu:





Quote
ALL my test are made with Internet Explorer 5.5sp2

FORGET to use them in Firefox .. will only mess up things



I have always changed the DEFAULT browser from FireFox to IE when

running these scripts.

However, I should mention that I use IE7 (Beta2). I don't know if this

may be messing things up.





Quote


Can be different for various reasons



'IMHO index is always the simpler and reliable way and you

' don't have to worry about input names submit types ecc :



Set objIE = CreateObject("InternetExplorer.application")

objIE.Visible = True

objIE.Navigate "www.google.it/"">www.google.it/"

Do While objIE.Busy = True

WScript.Sleep 50

Loop

WScript.Sleep 200



objIE.document.all.item(41).Value="wsh+faq"

objIE.document.all.item(43).Click

'objIE.document.all.item(47).Click



Running this, I get an error on the line

"objIE.document.all.item(41).Value="wsh+faq"" stating that an object is

required.

If this works for you, I can only think that my IE7 is not compatible

with this code. But that really does sound very strange.



Quote




'PS :

tested again on mail.yahoo.com/">mail.yahoo.com/ and works fine here :

and redirects me here https://login.yahoo.com/config/login?

(I don't have an Yahoo account)

or if I use my Yahoo Groups User & Pass

redirects me here https://edit.yahoo.com/config/mail?.intl=it

' But it WORKS





Set objIE = CreateObject("InternetExplorer.application")

objIE.Visible = True

objIE.Navigate "mail.yahoo.com/"">mail.yahoo.com/"

Do While objIE.Busy = True

WScript.Sleep 50

Loop

WScript.Sleep 200



objIE.document.all.item(81).Value="USER"

objIE.document.all.item(86).Value="Password"

objIE.document.all.item(91).Click



No luck here either with this script. I get the very same error on the

first "objIE.document.all.item" command (Object required).





Paul

Quote


--

Fosco



-

Re:Re: Problems in Waiting for Web page to Open

"PaulFXH"

Quote
However, I should mention that I use IE7 (Beta2). I don't know if this

may be messing things up.



Argggggghhhhhhhhhhhhhhh



http://www.autoitscript.com/forum/index.php?showtopic" rel="nofollow" target="_blank">www.autoitscript.com/forum/index.php=25629&st=135



No testing has been done with IE7. I don't expect it to be difficult to make it compatible with both IE6 and IE7 though,

so I'll be interested in specifics from anyone who tries it. I'll get around to it, but not quite yet.



Dale





--

Fosco





-

Re:Re: Problems in Waiting for Web page to Open

"PaulFXH"

Quote
Running this, I get an error on the line

"objIE.document.all.item(41).Value="wsh+faq" stating that an object is

required.

+faq""



First go with wowww.exe to www.google.it and control the index of the page

Characteristics of all HTML Elements on page



launch this script and report the output



ws = ScriptEngine & " Version " _

& ScriptEngineMajorVersion & "." _

& ScriptEngineMinorVersion _

& "." & ScriptEngineBuildVersion

wscript.echo ws



Quote
No luck here either with this script. I get the very same error on the

first "objIE.document.all.item" command (Object required).





'and try this :



Set objIE = CreateObject("InternetExplorer.application")

objIE.Visible = True

objIE.Navigate "www.google.it/"">www.google.it/"

' if you have PROBLEMS try to change google.it with YOUR

' google LANGUAGE settings maybe www.google.pt

' or www.google.com

Do While objIE.Busy = True

WScript.Sleep 50

Loop

WScript.Sleep 1000

objIE.document.all(41).Value="wsh+faq"

objIE.document.all(43).Click



'PS :

'have you a NORMAL google page or a personalized ?



post a litle script that is working fine with InternetExplorer.application



--

Fosco





-

Re:Re: Problems in Waiting for Web page to Open

"Fosco"

Quote
"PaulFXH"

>Running this, I get an error on the line



Try also this .. but this is via>>form>>names

(Index is ALWAYS available .. names not)



Set objIE = CreateObject("InternetExplorer.application")

objIE.Visible = True

objIE.Navigate "www.google.it/"">www.google.it/"

Do While objIE.Busy = True

WScript.Sleep 50

Loop

WScript.Sleep 1000

objIE.document.all.f.q.Value="wsh+faq"

objIE.document.all.f.btnG.Click



' yahoo

Set objIE = CreateObject("InternetExplorer.application")

objIE.Visible = True

objIE.Navigate "mail.yahoo.com/"">mail.yahoo.com/"

Do While objIE.Busy = True

WScript.Sleep 50

Loop

WScript.Sleep 200



objIE.document.all.login.Value="USER"

objIE.document.all.passwd.Value="Password"



--

Fosco







-

Re:Re: Problems in Waiting for Web page to Open

"PaulFXH"

Quote
I will post the script as it stands in the next post to avoid going

over your 75-line limit.



A script like this will never work .. and if ... you are a lucky guy



first use : (your objShell.Run "control panel" doesn't work here)



set wshshell = CreateObject("WScript.Shell")

Set objShell = WScript.CreateObject("Wscript.shell")

objShell.Run "explorer.exe /n,::"& _

"{20D04FE0-3AEA-1069-A2D8-08002B30309D}\::"& _

"{21EC2020-3AEA-1069-A2DD-08002B30309D}",3



' or

Set Shell = WScript.CreateObject ("Shell.Application")

Shell.ControlPanelItem""



' or

Set Shell = WScript.CreateObject ("Shell.Application")

Shell.Open(3)

'ecc



Don't use the { } in sendkeys like you do



NOT wshshell.SendKeys "{e}"

but wshshell.SendKeys "e"



as I just said I have not experiences with printer

if you have Office installed

http://groups.msn.com/windowsscript/officeautomation.msnw?action" rel="nofollow" target="_blank">groups.msn.com/windowsscript/officeautomation.msnw=view_list&row=5&viewtype=2&sortstring=

else

http://www.google.it/search?hl" rel="nofollow" target="_blank">www.google.it/search=it&q=wsh%2Bprint+test+page&meta=

www.codecomments.com/archive300-2005-6-526084.html">www.codecomments.com/archive300-2005-6-526084.html

www.codecomments.com/archive300-2005-3-407910.html">www.codecomments.com/archive300-2005-3-407910.html

ecc



but if you want to use sendkeys approach use autoit with controlsend instead

http://www.autoitscript.com/forum/index.php?showtopic" rel="nofollow" target="_blank">www.autoitscript.com/forum/index.php=27304&hl=printer



PS:

using sendkeys like you do is real the worst thing to do with wsh



are you sure you can not run the printers and faxes directly ? :



ControlPanelItem Method



--------------------------------------------------------------------------------



Runs the specified Control Panel application. If the application is already open, it will activate the running instance.



Syntax



Shell.ControlPanelItem(sDir)

Parameters



sDir Required. Specifies the Control Panel application's file name. All Control Panel applications have the .cpl

extension.



--

Fosco







-

Re:Re: Problems in Waiting for Web page to Open