Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Basic Ahk v1.1+ COM Tutorial for Webpages


  • Please log in to reply
138 replies to this topic

Poll: Did this guide help you? (92 member(s) have cast votes)

Did this guide help you?

  1. Ya! COM ftw rawr! (111 votes [86.72%])

    Percentage of vote: 86.72%

  2. No. I am now dumber for having read this... (17 votes [13.28%])

    Percentage of vote: 13.28%

Vote Guests cannot vote
Mickers
  • Members
  • 1239 posts
  • Last active: Sep 25 2015 03:03 PM
  • Joined: 11 Oct 2010
It's really whatever you prefer. You could name it "whataboutbob" if you wanted to.

If you want to quickly change it from IE to pwb then use Ctrl + h and replace IE with Pwb. :wink:

  • Guests
  • Last active:
  • Joined: --
I learned the hard way if you leave out WB.Visible := True or set it to WB.Visible := False be sure to run
wb.quit
before exiting your script.

During testing I ended up with 10 invisible iexplore.exe processes.

I only found this in one place in the manual and it has no explaination.

Mickers
  • Members
  • 1239 posts
  • Last active: Sep 25 2015 03:03 PM
  • Joined: 11 Oct 2010
@guest

That's because you never closed those windows. By default Microsoft windows start off in invisible mode. They exist just like normal windows you just can't see them. Since you can't see the close window button you can't close them normally. The .quit method closes them as if you press that button. :wink:

Benny-D
  • Members
  • 1485 posts
  • Last active: Sep 27 2016 11:23 PM
  • Joined: 29 Feb 2008
Mickers, please continue with your amazing tutorial. You have a talent for explaining complicated things in simple terms. Also, I like your sense of humor.

Mickers
  • Members
  • 1239 posts
  • Last active: Sep 25 2015 03:03 PM
  • Joined: 11 Oct 2010

Mickers, please continue with your amazing tutorial. You have a talent for explaining complicated things in simple terms. Also, I like your sense of humor.

Thank your and thank you. I feel the trick is to explain it as you would to yourself. Only a dumber version, if possible, of yourself. :wink:

I'll take any suggestions you may have as to what I should work on next.

jethrow
  • Moderators
  • 2854 posts
  • Last active:
  • Joined: 24 May 2009
I say add more on DOM Navigation (childNodes, parentNode, etc ...) & Frames. Also, for objects, everything inside brackets [] is an expression - so you don't need to use parenthesis.

Benny-D
  • Members
  • 1485 posts
  • Last active: Sep 27 2016 11:23 PM
  • Joined: 29 Feb 2008

I'll take any suggestions you may have as to what I should work on next.

- I know nothing about COM, but I really want to learn it at least to some degree that I could use it in solving some of my problems and achieving some of my goals. I have already stumbled upon "you need to do it trough COM" suggestion quite a few times. So I can't really give you any specific suggestions here. The only one is please don't stop, please continue with this tutorial.

  • Guests
  • Last active:
  • Joined: --

- I know nothing about COM, but I really want to learn it at least to some degree that I could use it in solving some of my problems and achieving some of my goals. I have already stumbled upon "you need to do it trough COM" suggestion quite a few times.

Why don't you post questions in Ask For Help? I'd happy to help if you keep questions simple.

Benny-D
  • Members
  • 1485 posts
  • Last active: Sep 27 2016 11:23 PM
  • Joined: 29 Feb 2008

Why don't you post questions in Ask For Help? I'd happy to help if you keep questions simple

- At the moment I don''t have any specific questions on COM as my knowledge of it and experience in using it, apart from knowing that it could really be helpful, equal almost to zero. So, I would rather first read a tutorial on it to get a general idea of how COM works and what it can do.

Anyway, thank you for your reediness to provide support in the form of answers, as well as thank you for all the answers you have already provided to my questions so far on this forum (I am not sure whether you are that "Guest" who have been answering my questions in "Ask for Help" so far or merely a guest that just came by, in which case I guess my many thanks are obviously not addressed to you)

I'd happy to help if you keep questions simple

- Since my knowledge of COM is, as I said, so little, my questions will surely be very simple.

tank
  • Administrators
  • 4345 posts
  • AutoHotkey Foundation
  • Last active: Oct 13 2016 01:04 AM
  • Joined: 21 Dec 2007
Actually you probably know enuff about COM

Your probably need to learn more about using the MSDN as a reference.

your probably if using a browser need to spend more time learning DOM

you know how to use create obj
and you know how to set a property such as visible and call a method such as quit

My advice is learn more about using the documentation for the app your using COM on
Never lose.
WIN or LEARN.

Benny-D
  • Members
  • 1485 posts
  • Last active: Sep 27 2016 11:23 PM
  • Joined: 29 Feb 2008

your probably if using a browser need to spend more time learning DOM

- I have no idea what DOM is.

you know how to use create obj

- Objects and whatever is related to them is still a deep forest to me.

and you know how to set a property such as visible and call a method such as quit

- No idea at all. Why do you think that I know? Probably, you saw some of the scripts that I posted here on this forum and figured that I wrote them by myself, which is not really the case - many kind supporters here have given me their snippets of scripts and I was successfully using them in my scripts, but it doesn't mean that I fully knew the workings of their scripts.

Your probably need to learn more about using the MSDN as a reference...
My advice is learn more about using the documentation for the app your using COM on

- I have visited MSDN page quite a few times trying to create my own DllCall, but I found that a lot of things written there are absolutely out of the frame of my reference - I don't know what many of those things mean.

Carcophan
  • Members
  • 1578 posts
  • Last active: Nov 27 2013 06:46 PM
  • Joined: 24 Dec 2008

No idea at all. Why do you think that I know?


Maybe you DO know, but you just don't know THAT you know it.


I started my AHK life, and programming in general, doing the same thing. 'Borrowing' snippets, being Frankenstein. I never learned anything that way, and caused more problems for myself than anything.



You have more ability than you give yourself credit for... now you just need to motivation to match.

DOM is not the end of the world. It is a structure, like 'folders'. You can find your favorite MP3 or picture, buried deep on your PC, no? You categorize and classify things, DOM is sort of like that.


Someone, can't remember off the top of my head who (sorry)... used the example of an office building. you want to find a pen. The state the city is in. The block the building is on within the city. The floor the office is on, the location of that office within the floor. Within the office is a desk, in the desk is a drawer. In the drawer has the pen.


The piece of data you need, is the pen... you just need to rationalize how to find it.

Benny-D
  • Members
  • 1485 posts
  • Last active: Sep 27 2016 11:23 PM
  • Joined: 29 Feb 2008

Someone, can't remember off the top of my head who (sorry)... used the example of an office building. you want to find a pen. The state the city is in. The block the building is on within the city. The floor the office is on, the location of that office within the floor. Within the office is a desk, in the desk is a drawer. In the drawer has the pen

- Very interesting example. Thank you.

sinkfaze
  • Moderators
  • 6367 posts
  • Last active:
  • Joined: 18 Mar 2008

Someone, can't remember off the top of my head who (sorry)... used the example of an office building.


That was probably me:

Don't let objects confuse you too well, it's simply a matter of doing one thing in order to do another. Oversimplified example: Suppose you want to go visit your friend at their office, which is in a high rise downtown. To visit them first you need to get to where the buildings are (Application), then you need to get to the right building (Workbook), then you need to go to the right floor in that building (Worksheet), then you need to go down the right hall on that floor (Range), to finally get to their office (Cell).


For DOM (or HTML or DHTML or what have you), how objects work isn't quite as broad as how they work in Excel, but the same principles generally apply. For instance, if you wanted to access a cell in a table, you wouldn't expect to go through the links object to do it. That's why you only access cells through a rows collection, which is accessed through a table object. It's a matter of sorting and limiting how things are accessed.

And just to re-emphasize, Microsoft's HTML and DHTML Reference is an excellent resource to keep around for your own learning.

Zod
  • Members
  • 214 posts
  • Last active: Jan 26 2012 08:02 PM
  • Joined: 06 Jul 2011
Posted Image
Posted Image Stolen from SKAN