AutoHotkey Community

It is currently May 26th, 2012, 9:45 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 8 posts ] 
Author Message
PostPosted: September 22nd, 2009, 7:54 am 
I've to point to [SEANs thread here] where I've already posted.

Looks like a minor issue (missing parameter or something).
(The real) pros will need half a minute (in average) to get it (lets place a bet :))
Unfortunately its above my head :(

Help would be much appreciated. Thx 8)


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: September 22nd, 2009, 12:21 pm 
Offline

Joined: December 23rd, 2006, 6:02 pm
Posts: 424
Location: Russia
You probably confused CreateObject with COM_CreateObject. As for WMPlayer.OCX, it's a ProgID, not a file name. You can find it in the registry.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 22nd, 2009, 12:36 pm 
Quote:
You probably confused CreateObject with COM_CreateObject. As for WMPlayer.OCX, it's a ProgID, not a file name
Well, I used it without any change made. A steal from SEANs thread 'as-is' (I linked to it above, btw) :shock:

Code:
#Include IEControl.ahk

sUrl := "C:\WINDOWS\clock.avi" ; Replace it with your media file.

GoSub, GuiStart
Gui, +Resize +LastFound
Gui, Show, w800 h600 Center, WMP
hGui := WinExist()

pwmp := CreateObject("WMPlayer.OCX")
AtlAxAttachControl(pwmp, hGui)

Invoke(pwmp, "URL=", sUrl)
Invoke(pwmp, "Play")

Sleep, 1000
pmda := Invoke(pwmp, "CurrentMedia")
name := Invoke(pmda, "Name")
duration := Invoke(pmda, "durationString")

Sleep, 2000
pctl := Invoke(pwmp, "controls")
Position := Invoke(pctl, "currentPosition")
Invoke(pctl, "currentPosition=", Position+6)
Return

GuiStart:
CoInitialize()
AtlAxWinInit()
Return
GuiClose:
Gui, Destroy
Release(pctl)
Release(pmda)
Release(pwmp)
AtlAxWinTerm()
CoUninitialize()
ExitApp

:?:


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: September 22nd, 2009, 1:54 pm 
Offline

Joined: December 23rd, 2006, 6:02 pm
Posts: 424
Location: Russia
Well, I could not find IEControl.ahk.
Sean wrote:
This is a standard library for IE/WebBrowser controls.

REDIRECT. IE.ahk is now retired. Code it using COM Standard Library.

And COM Standard Library (COM.ahk) has the function COM_CreateObject, not CreateObject.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 22nd, 2009, 2:22 pm 
I'll check this out. Me myself & I have each of those libraries* available, so this shouldn't have been a show-stopper (there was no error message about a false OR missing function!)?

*
IE.ahk
IEControl.ahk
CoHelper.ahk
COM.ahk
ACC.ahk
...


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: September 22nd, 2009, 2:48 pm 
Changing to COM.ahk ...
Code:
#Include IEControl.ahk ; looks like still necessary otherwise it throws out an 'Release(pctl)' error ???
; #Include CoHelper.ahk
#Include COM.ahk

sUrl := "C:\WINDOWS\clock.avi" ; Replace it with your media file.

GoSub, GuiStart
Gui, +Resize +LastFound
Gui, Show, w800 h600 Center, WMP
hGui := WinExist()

pwmp := COM_CreateObject("WMPlayer.OCX")
COM_AtlAxAttachControl(pwmp, hGui)
COM_Invoke(pwmp, "URL=", sUrl)
COM_Invoke(pwmp, "Play")

Sleep, 1000
pmda := COM_Invoke(pwmp, "CurrentMedia")
name := COM_Invoke(pmda, "Name")
duration := COM_Invoke(pmda, "durationString")

Sleep, 2000
pctl := COM_Invoke(pwmp, "controls")
Position := COM_Invoke(pctl, "currentPosition")
COM_Invoke(pctl, "currentPosition=", Position+6)
Return

GuiStart:
COM_CoInitialize()
COM_AtlAxWinInit()
Return

GuiClose:
Gui, Destroy
Release(pctl)
Release(pmda)
Release(pwmp)
COM_AtlAxWinTerm()
COM_CoUninitialize()
ExitApp

Made it run ! :D and failed immediately afterwards :cry: ...

Code:
---------------------------
COM Error Notification
---------------------------
Function Name:   "Play"
ERROR:   Unknown name.

   (0x80020006)

Will Continue?
---------------------------
Yes   No   
---------------------------
Code:
---------------------------
COM Error Notification
---------------------------
Function Name:   "currentPosition"
ERROR:   Does not support a collection.

   (0x80020011)

ERROR2:   Type mismatch.

   (0x80020005)

Will Continue?
---------------------------
Yes   No   
---------------------------

:?: :(


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: September 22nd, 2009, 4:45 pm 
Offline

Joined: December 23rd, 2006, 6:02 pm
Posts: 424
Location: Russia
Why not COM_Release? As for the notifications, I also receive them, however clock.avi seems to show up ok.

Perhaps this script is not fully compatible with COM.ahk, who knows. :roll:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 23rd, 2009, 8:49 am 
Quote:
who knows.
I guess SEAN. (100% chance that he does). Looks like he's left the scene :shock:


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: BrandonHotkey, JSLover, patgenn123, rbrtryn, virpara and 56 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group