Need help COMobj, making a add manager

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
HomePlayer
Posts: 9
Joined: 09 Jan 2014, 08:01

Need help COMobj, making a add manager

16 Jan 2014, 11:39

Hello all,

We my wife and I have over a 100 add's on this ebay like site. Managing those add is getting harder whit every new add.

So i'm trying to get some code off the ground, to help us whit it.
the goal is;
To get a database (excel,txt) to write the adds in, and get the script to post them on the website.

But after almost a week of trying i'm not getting anywhere soon.
I don't want to use a (mouse)recorder, i'm sure the wife will get lost ;-)

I'll try to update the OP with my progress.
Under the spoiler you find a screen clip and some source of the site
Spoiler
To fill the (form) a user has to click a item in all tree boxes.

then whit the use of F12 i found that the url post was

Code: Select all

https://www.marktplaats.nl/syi/plaatsAdvertentie.html?l1=1&licensePlate=&bucket=1&l2=2&origin=HEADER&nl.marktplaats.xsrf.token=1389880178001.25e90b55eb7f0f808169580b99055f58
l1=1&licensePlate=&bucket=1&l2=2&origin=HEADER& is the $var that comes from the clicking of the form,
the token is a problem if i want to deep link.
Well if i learn how to click in a COMobj. on <li class="item active" data-val="1" data-ga-track-page-view-on-click="/SYI/SELECTCATEGORY/1_antiek-en-kunst">Antiek en Kunst</li>
I don't need to deep link, and won't have to deal whit the token part.

Update:
Spoiler
With

Code: Select all

MsgBox % wb.document.getElementsByTagName("li")[a].click()
its possible to click the menu items.

now i need still some code, that gets the click, when we are placing a add
User avatar
Blackholyman
Posts: 1293
Joined: 29 Sep 2013, 22:57
Location: Denmark
Contact:

Re: Need help COMobj, making a add manager

17 Jan 2014, 07:49

Example

Code: Select all

#Persistent
url = https://www.marktplaats.nl/syi/plaatsAdvertentie.html?l1=1&licensePlate=&bucket=1&l2=2&origin=HEADER&nl.marktplaats.xsrf.token=1389880178001.25e90b55eb7f0f808169580b99055f58
wb := ComObjCreate("InternetExplorer.Application")
wb.Silent := true

wb.Visible := true  ; This is known to work incorrectly on IE7.
wb.Navigate(url)
while (wb.busy) or (wb.Document.Readystate != "Complete")
	Sleep 1

Box1 := wb.document.getElementById("syi-categories-l1")
Box2 := wb.document.getElementById("syi-categories-bucket")
Box3 := wb.document.getElementById("syi-categories-l2")

UL1 := Box1.getElementsByTagName("UL")[0]
UL2 := Box2.getElementsByTagName("UL")[0]
UL3 := Box3.getElementsByTagName("UL")[0]

; loop box type 1
loop % (LIs := UL1.getElementsByTagName("LI")).length
	if instr(LIs[A_index-1].innertext, "Auto-onderdelen")
	{
		LIs[A_index-1].click()
		break
	}
	
Sleep 1000
; loop box type 3
loop % (LIs := UL3.getElementsByTagName("LI")).length
	if instr(LIs[A_index-1].innertext, "BMW")
	{
		LIs[A_index-1].click()
		break
	}


return
Hope it helps
Also check out:
Courses on AutoHotkey

My Autohotkey Blog
:dance:
HomePlayer
Posts: 9
Joined: 09 Jan 2014, 08:01

Re: Need help COMobj, making a add manager

18 Jan 2014, 11:03

@Blackholyman wow thanks

nice peace of code, this will help for sure.
My code looks like this;
Spoiler
Yours is better lol

The next step is click photo upload box, wel thats no problem the file select box puts up,

so I do a send key Send file-path/Send {testing} but thats not working.
And i really dont know why, the pop-up has focus, and the cursor is in the write place.
HomePlayer
Posts: 9
Joined: 09 Jan 2014, 08:01

Re: Need help COMobj, making a add manager

19 Jan 2014, 12:29

Help please,

if you run the above script a file-select window will pop-up
at that point the script pauses til the pop-up closes.

but i cant send and letters or any thing.
User avatar
Blackholyman
Posts: 1293
Joined: 29 Sep 2013, 22:57
Location: Denmark
Contact:

Re: Need help COMobj, making a add manager

19 Jan 2014, 15:38

For me no file select box puts up with you script...

but maybe try an run the script as Admin
Also check out:
Courses on AutoHotkey

My Autohotkey Blog
:dance:
HomePlayer
Posts: 9
Joined: 09 Jan 2014, 08:01

Re: Need help COMobj, making a add manager

20 Jan 2014, 03:08

Darn,
I forgot to put the code in
Spoiler
This line will open the file select box, no admin needit
wb.document.getElementById("file-picker-0").click()
User avatar
Blackholyman
Posts: 1293
Joined: 29 Sep 2013, 22:57
Location: Denmark
Contact:

Re: Need help COMobj, making a add manager

20 Jan 2014, 03:49

That line was in your last post also... it does not open a select box for me (xp, IE7 and win7, IE11)

have not really used any time to try and make it work but for now i can't really test it. But just to let you know if i manualy open the select box before the sleep is done it sends the text to the box just fine...

so unsure of the problem you have other then the .click() does not open a select box... :(
Also check out:
Courses on AutoHotkey

My Autohotkey Blog
:dance:
HomePlayer
Posts: 9
Joined: 09 Jan 2014, 08:01

Re: Need help COMobj, making a add manager

20 Jan 2014, 04:36

mmm strange, maybe the site sees your not Dutch or from The Netherlands,

never-mind, a <input type="file"> is in the html source.

I have done all kinds of text insert, but every time the file select box pups up, the filed is empty.

If i then run this

Code: Select all

WinGet windows, List
Loop %windows%
{
	id := windows%A_Index%
	WinGetTitle wt, ahk_id %id%
	r .= wt . "`n"
}
MsgBox %r%file?
return
That will tell "program manager
File?"

I think i need a piece of code to detect a file-browse window and then paste my file-url

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Bing [Bot], Draken, Google [Bot], oktavimark, Spawnova, william_ahk and 277 guests