Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
IE navigation and accessing menu when 'Right' clicking
#1
Hi,

I'm trying to save some images down from my suppliers website...and am very new to Quick Macro's.
I've done programming before in Access97 vba so am familiar with Macros and modules, and slowly am getting there with this powerful tool.

However, i'm very much a cowboy at the moment, bodging bits together, with the hope that eventually i'll master the language and write some ingenious functions for both my and others benefit.

ANYWAY.... what i want to do is find the image on the web page, right click and save it to a folder.

So far
1) i have a list of product codes in Excel
2) Using mouse co-ordinates i click on IE and then the search box...where it pastes the product code
3) returns the image and use mouse co-ordinates to right click and save (this was all done recording the macro)

I would appreciate your knowledge just to get me started...as i'm sure i will then be flying very quickly..

Kind Regards

Andy
#2
Show the code you have so far. With comments where you don't know how to do something.
#3
Hi,

I have included my code below....and at present it has worked for me.... But has taken an awful lot of trial and error to do the basic things, so i have written comments where i am stuck and in need of some advice.
These comments are in blue


This loops through 5 product codes in Excel which are:
4201
4382
4402
4416
4435
getting 3 images for each product from the suppliers website.



int i ;;declare variable i
i=1
rep

I have used various Controls to try and get what i want e.g. find window control, Find Html element, but don't understand what all the boxes in the dialog represent, and can't find documentation supporting it fully.
So most of this code has been produced by the 'Recorder'


int w1=win("" "Shell_TrayWnd")
lef 588 15 w1
int w2=act(win("Microsoft Excel - Book1" "XLMAIN"))
'Cc
'D
wait 2
lef 977 19 w1
How do i get it to always go to the same webpage, no matter what the last page was that was being viewed??
It appears that it looks for the whole window title, which changes with each product that is displayed, as the product appears in the title


int w3=act(win("Dropship Sex Toys UK - wholesale adult toys - trade sex toys - penthouse - doc johnson - hustle - Windows Internet Explorer pro" "IEFrame"))

err web "http://www.1on1dropship.co.uk/default.asp" 0x1; err

wait 0 I
How do identify and select this element (its the link which takes you to the home page on the website, (a logo with 1on1dropship.co.uk written on it)). I tried using the html element finder, and despite it flashing (to show it's the correct element), something i'm doing is not correct ???
lef 346 230 w3
wait 0 I
lef 889 174 w3
'Cv
'Y
wait 0 I

int w11=act(win("Dropship Sex Toys UK - wholesale adult toys - trade sex toys - penthouse - doc johnson - hustle - Windows Internet Explorer pro" "IEFrame"))

Here i am trying to right click on the image to open the Save box, and could not find a simple way of saving the file down... Any offerings as to what i should do, and how to work around the dialog box ??? (again i use co-orinates which i know are not ideal!)
rig 557 632 w11
wait 1
key s

goto beginning of line and type in file path:

act win("Save Picture" "#32770")
'H "F:\My Documents\My Pictures\Thumbs"
'(255)\Y
What does the (255) mean here ?

Click Thumbnail image to view the next detail
Here i am using co-ordinates, rather than identifying the element, to click on the image so that i can see the next level of product detail.
Here if i use the identify HTML element, it will be specific to the product, and i don't know how to change that for the next product in the loop ???

int w18=act(win("Dropship Sex Toys UK - wholesale adult toys - trade sex toys - penthouse - doc johnson - hustle - Windows Internet Explorer pro" "IEFrame"))
lef 556 613 w18
wait 0 I

Then save next image down
rig 573 623 w18
wait 1
key s

goto beginning of line and type in file path:

act win("Save Picture" "#32770")
'H "F:\My Documents\My Pictures\Detail"
'(255)\Y

Click image to view the FULL size image

Here I'm trying to view the Large jpg image..and the best way i could work it was to open it in a full window as a new 'open link' command, from the right clcik menu on the image.
BUT, i have randomly selected co-ordinates to find the area where the image should appear !!

I then have to click BACKSPACE to get back to the the previous view, else at the beginning of the code (on the next loop), the IE window is not the same title as the one when i click backspace... i know this is all easy steps, once familiar with the language a bit more.

int w19=act(win("Dropship Sex Toys UK - wholesale adult toys - trade sex toys - penthouse - doc johnson - hustle - Windows Internet Explorer pro" "IEFrame"))
rig 586 622 w19
wait 1
key o
wait 2
goto beginning of line and type in file path:

int w99=win("Internet Explorer" "IEFrame")
rig 299 397 w99

's

'H "F:\My Documents\My Pictures\Large"
'(255)\Y
wait 0 I
'B

i+1

if i>4
out "i is > 4"
break ;;exit the loop
out i
#4
Some tips.

In recorded code, remove parts that click taskbar, eg this and other lines where is w1:

int w1=win("" "Shell_TrayWnd")
lef 588 15 w1

To make the code independent from the document, remove document names in window names. Or, if class is unique, remove whole name:

int w3=act(win("" "IEFrame"))

In htm and other places, if you have window handle, use it instead of win(...):

Htm el=htm("A" "Christmas" "" w3 0 6 0x21) ;;find the link
el.Click ;;click it

In htm, use a wait time to wait until the page is loaded:

el=htm("B" "More Info" "" w3 0 39 0x21 60) ;;find a link in the next page, and also wait for it max 60 s

Remove multiple Htm before the same variable (see above).

----

(255) is a key, probably Fn.

----


Quote: Click Thumbnail image to view the next detail
Here i am using co-ordinates, rather than identifying the element, to click on the image so that i can see the next level of product detail.
Here if i use the identify HTML element, it will be specific to the product, and i don't know how to change that for the next product in the loop ???

Like with window names, removing or changing some parts from htm code should make it not specific to the product. But not sure, I need to see the page and test, but cannot access it. See htm documentation in QM help.



Quote: Here I'm trying to view the Large jpg image..and the best way i could work it was to open it in a full window as a new 'open link' command, from the right clcik menu on the image.
BUT, i have randomly selected co-ordinates to find the area where the image should appear !!

el=htm(...)
el.Mouse(2)


Forum Jump:


Users browsing this thread: 1 Guest(s)