Jump to content

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

COM Standard Library


  • Please log in to reply
669 replies to this topic
BoBo¨
  • Guests
  • Last active:
  • Joined: --
Well, I have found a [thread] like this one.

And it says:
> Aktuellen Song aus Windows Media Player auslesen
Read current song from Windows Media Player
> Versionen sind anscheinend egal. Ich habe das Vista SDK auf XP installiert und es mit dem WMP9 ausprobiert.
Looks like there are no (WMP) version dependancies. [He] has installed the Vista SDK on XP and tested it with WMP9.
> Ich habe mal das RemoteHost-Beispiel soweit gekürzt, dass nur der aktuelle Titel auf der Konsole ausgegeben wird. Die "RemoteHost.h" ist aus dem Sample.
[He] has used the RemoteHost-Sample [I guess from Vista SDK] and shortened it to display the current song at the console.

As I need the output as a variable to trigger my AHG script/GUI, I thought that method could be used.
Well, I'm not aware how to parse an audio stream [directly] with AHK, therefore I've expected to trigger WMP instead (which I use to execute/play the stream). :(

Exactly from where are you trying to get the infos?

From the stream (prefered) or the player.

BoBo¨
  • Guests
  • Last active:
  • Joined: --
Had a request [here] to follow another concept using [mediainfo.dll]. But had no response/luck. :(

Sean
  • Members
  • 2462 posts
  • Last active: Feb 07 2012 04:00 AM
  • Joined: 12 Feb 2007

I've expected to trigger WMP instead (which I use to execute/play the stream).

You may use this instead. But I don't know if the URL will be updated to the original source, as MS is careful enough to not expose the original source of the streams.
You may better redownload COM.ahk as I recently updated it to include CoInitialize() inside AtlAxWinInit() too.

sUrl := "C:\temp.wmv" ; Replace it to the real URL.

COM_AtlAxWinInit()
Gui, +Resize +LastFound
Gui, Show, w800 h600 Center, WMP
hGui := WinExist()
pwmp := COM_AtlAxCreateControl(hGui, "WMPlayer.OCX")
COM_Invoke(pwmp, "URL=", sUrl)
COM_Invoke(pwmp, "Play")
Sleep, 3000

pmda := COM_Invoke(pwmp, "CurrentMedia")
sURL1:= COM_Invoke(pmda, "SourceURL")
name := COM_Invoke(pmda, "Name")
durn := COM_Invoke(pmda, "durationString")

MsgBox, % sURL1 . "|" . name . "|" . durn
Return

GuiClose:
Gui, Destroy
COM_Release(pmda)
COM_Release(pwmp)
COM_AtlAxWinTerm()
ExitApp


BoBo¨
  • Guests
  • Last active:
  • Joined: --
Hi Sean,
thx for your effort+time. Much appreciated (well, as always :D)
If it comes to run local files/tracks your script is working perfect and delivered all details.
Unfortunately I can't still find a way to extract details on a single-track basis from within a mp3-stream running via WMP.

btw. Can you point out where to find that specific "strings" (methods?) which are used within your functions ...
COM_Invoke(pwmp, "[color=red]Play[/color]") 
pmda := COM_Invoke(pwmp, "[color=red]CurrentMedia[/color]") 
sURL1:= COM_Invoke(pmda, "[color=red]SourceURL[/color]") 
name := COM_Invoke(pmda, "[color=red]Name[/color]") 
durn := COM_Invoke(pmda, "[color=red]durationString[/color]")
Back to Google ... 8)

Sean
  • Members
  • 2462 posts
  • Last active: Feb 07 2012 04:00 AM
  • Joined: 12 Feb 2007

btw. Can you point out where to find that specific "strings" (methods?) which are used within your functions

I suppose the best place for these is always MSDN:
<!-- m -->http://msdn2.microso...y/bb249259.aspx<!-- m -->

BoBo¨
  • Guests
  • Last active:
  • Joined: --

I suppose the best place for these is always MSDN

Erm, that's the environment where I've spent the last hours (indeed, I do my very best to help myself not to need help from you :oops:).
Well, it looks like I will need an extra lifetime (or some good advise/training) to get an idea of those cryptic concepts. :cry:

What I've encountered so far:

oWMP.GetItemInfo("Artist")
oWMP.GetItemInfo("Title")

[?]

Sean
  • Members
  • 2462 posts
  • Last active: Feb 07 2012 04:00 AM
  • Joined: 12 Feb 2007

Well, it looks like I will need an extra lifetime (or some good advise/training) to get an idea of those cryptic concepts.

It needs some practice, as it's not so clear as crystal, obviously.

oWMP.GetItemInfo("Artist")
oWMP.GetItemInfo("Title")

That page says they are obsolete. Sorry, but, I don't really want to go further into it myself, you better read the pages I linked. I'd welcome them if you have questions about CoHelper.ahk or COM.ahk, but, from now on I'd like to avoid questions about a specific COM object, unless it happens to be one I'm interested in or can be done in less than 10 minutes, because I think the function Invoke() now reaches the stage of resembling the well-known VBS syntax as possible as it can, so I suppose users could now adopt many useful sources in VBS to AHK scripts, hopefully without much effort.

BoBo¨
  • Guests
  • Last active:
  • Joined: --

I'd welcome them if you have questions about CoHelper.ahk or COM.ahk,

Thx, I'm more than happy for that offer. Of help would be to have a sample "how to identify relevant objects and arguments within MSDN, and how to use them within these functions".
A how-to-use-Seans-COM-interface-tut.

but, from now on I'd like to avoid questions about a specific COM object, unless it happens to be one I'm interested in or can be done in less than 10 minutes

Fair enough. 8) I've assumed my request had to be categorized as '5 minute challenge'. :shock: Looks like I was wrong :lol:

Sean
  • Members
  • 2462 posts
  • Last active: Feb 07 2012 04:00 AM
  • Joined: 12 Feb 2007

Of help would be to have a sample "how to identify relevant objects and arguments within MSDN, and how to use them within these functions".

You have to be already familiar with how to use COM, e.g. in VBS/JS, to utilize CoHelper.ahk/COM.ahk. It won't tell you about COM itself. I posted the translation of VBS/JS to AHK in the thread of CoHelper.ahk. And, occasionally I posted an example of it, if I think it's a good and relatively simple example to analyze, the recent one is:
<!-- m -->http://www.autohotke...pic.php?t=23117<!-- m -->

I'm really perplexed that people expect more from me as I don't really know what should/could I do further than this. I'm not Chris. I really admire Chris for the excellent job he has done and his patience in dealing with the complaints, mostly unjustified/unfair IMO, he's got.

I've assumed my request had to be categorized as '5 minute challenge'. :shock: Looks like I was wrong :lol:

I suppose you'd be really surprised when figuring out the needed work/objects you may have to do/deal with for your purpose. The worse is that even after that there is no guarantee that it'll succeed.

Washboard
  • Guests
  • Last active:
  • Joined: --
Hi Sean,

Thanks for your work. But I must say I don't understand how this work. I'm not a noob in using VBScript to access MS Office apps and in VBA (even if I'm not an expert...), but I don't understand how I can use your Standard Library COM to open an XL file, read or write in a cell, ...
So 2 questions :
- can you please give an example of how to work with Excel (for example), with some explanations ?
- can you give us a little doc for your COM library : for each function, what is it supposed to do, with which parameters and eventually a little example.
I know that writing doc is the less interesting thing in programming, but it's the more usefull to share your work, that seems very good (I red this post and the one on CoHelper, but the examples given don't help me much, and I ask myself if they are compatible with COM.ahk, as you said it is not fully compatible with CoHelper.ahk, and things like

CLSID_iTunesApp := "{DC0C2640-1415-4644-875C-6F4D769839BA}"
IID_IiTunes := "{9DD6680B-3EDC-40DB-A771-E6FE4832E34A}"

are like chinese for me...)
Thanks a lot for all that you did and in advance for that you will do....

Sean
  • Members
  • 2462 posts
  • Last active: Feb 07 2012 04:00 AM
  • Joined: 12 Feb 2007

So 2 questions :
- can you please give an example of how to work with Excel (for example), with some explanations ?

Here is an example of Excel:
<!-- m -->http://www.autohotke...ic16565-45.html<!-- m -->

You better read about using Invoke() here:
<!-- m -->http://www.autohotke...topic16631.html<!-- m -->

- can you give us a little doc for your COM library : for each function, what is it supposed to do, with which parameters and eventually a little example.

It's planned. OTOH, now most functions in COM.ahk are mainly used internally, so no real need to concern about them. The users need only to know to use:
Invoke, CreateObject/ActiveXObject, GetObject, ConnectObject.

Sean
  • Members
  • 2462 posts
  • Last active: Feb 07 2012 04:00 AM
  • Joined: 12 Feb 2007

CLSID_iTunesApp := "{DC0C2640-1415-4644-875C-6F4D769839BA}"
IID_IiTunes := "{9DD6680B-3EDC-40DB-A771-E6FE4832E34A}"

For the example of iTunes, see this thread:
<!-- m -->http://www.autohotke...topic19443.html<!-- m -->

Sean
  • Members
  • 2462 posts
  • Last active: Feb 07 2012 04:00 AM
  • Joined: 12 Feb 2007
Here is one for Skype:
<!-- m -->http://www.autohotke...topic23117.html<!-- m -->

Sean
  • Members
  • 2462 posts
  • Last active: Feb 07 2012 04:00 AM
  • Joined: 12 Feb 2007
Example for the Voice Recognition:
<!-- m -->http://www.autohotke...topic20493.html<!-- m -->

Washboard
  • Guests
  • Last active:
  • Joined: --
Thanks Sean.
I didn't seen the topic on ADO COM. Very interesting. I'll try to use it.
Some (again) questions :
- These examples make reference to CoHelper.ahk. But you said (I don't remember where) that CoHelper and COM.ahk are not fully compatibles. So what is incompatible ? Are the examples in ADO COM (for example) can be "prefixed" with "#Include COM.ahk" rather than "#Include CoHelper.ahk"with no more modification than to prefix each COM function with "COM_" ?
For the documentation, I'd like to know, if it is usefull, the difference between COM_Invoke() and COM_Invoke_(), that I seen in the COM source, if the second one can be called directly and is usefull to use ...
For COM_CreateObject and COM_GetObject, I know what they do. They must work (almost) in the same way as the VBS/VBA equivalent. But I don't know the usage/utility of COM_ActiveXObject. Idem for COM_ConnectObject.
Thanks for the answers you gave/will give to me and for your work.