flashget的这个功能怎么实现的? ( 积分: 50 )

  • 主题发起人 主题发起人 emule
  • 开始时间 开始时间
E

emule

Unregistered / Unconfirmed
GUEST, unregistred user!
在网页中点右键下载,它可以抓到IE地址栏中的URL,
请教如何实现?
 
在网页中点右键下载,它可以抓到IE地址栏中的URL,
请教如何实现?
 
用VBScript。
在网页中点右键下载,调用的是FlashGet指定的一个*.htm文件。我没有装flashget。具体你文件名称可以查注册表。
Sub OnContextMenu()
set srcLocation = external.menuArguments.location
MsgBox srcLocation 'srcLocation 就是地址栏的URL
end sub
 
我看到了那jc_link.htm文件, 代码如下:
<script language="VBScript">
'Great thanks to Vladimir Romanov(Author of ReGet Pro)
'Download selected link

Sub AddLink(Url,Info)
On Error Resume Next
set JetCarCatch=CreateObject("JetCar.Netscape")
if err<>0 then
MsgBox("FlashGet not properly installed!"+ vbCrLf+"Please install FlashGet again")
else
call JetCarCatch.AddUrl(Url, Info, external.menuArguments.document.Url)
end if
end sub

Sub OnContextMenu()
set srcEvent = external.menuArguments.event
set EventElement = external.menuArguments.document.elementFromPoint ( srcEvent.clientX, srcEvent.clientY )
if srcEvent.type = "MenuExtAnchor" then
set srcAnchor = EventElement
do until TypeName(srcAnchor)="HTMLAnchorElement"
set srcAnchor=srcAnchor.parentElement
Loop
Call AddLink(srcAnchor.href,srcAnchor.innerText)
elseif srcEvent.type="MenuExtImage" then
if TypeName(EventElement)="HTMLAreaElement" then
Call AddLink(EventElement.href,EventElement.Alt)
else
set srcImage = EventElement
set srcAnchor = srcImage.parentElement
do until TypeName(srcAnchor)="HTMLAnchorElement"
set srcAnchor=srcAnchor.parentElement
if TypeName(srcAnchor)="Nothing" then
call AddLink(srcImage.href,srcImage.Alt)
exit sub
end if
Loop
Call AddLink(srcAnchor.href,srcImage.Alt)
end if
elseif srcEvent.type="MenuExtUnknown" then
set srcAnchor = EventElement
do until TypeName(srcAnchor)="HTMLAnchorElement"
set srcAnchor=srcAnchor.parentElement
if TypeName(srcAnchor)="Nothing" then
Call AddLink(EventElement.href,EventElement.innerText)
exit sub
end if
Loop
Call AddLink(srcAnchor.href,srcAnchor.innerText)
elseif 1=1 then
MsgBox("Unknown Event Source """ + srcEvent.type + """" + vbCrLf + "Please send description of error to jetcar@163.net")
end if
end sub


call OnContextMenu()

</script>

我增加了你的代码, 但老出错,要加在哪里?
能否指点一下,谢谢!!!
 
没有关系,你把他那个文件内容全部清空。然后输入:
<script language="VBScript">
Sub OnContextMenu()
set srcLocation = external.menuArguments.location
MsgBox srcLocation
end sub

call OnContextMenu()
</script>
 
我试了,但总说当前脚本发生错误, 没有权限:'MsgBox'
是不是什么语法错误,要怎么改?不熟悉VB的
 

Similar threads

回复
0
查看
989
不得闲
D
回复
0
查看
923
DelphiTeacher的专栏
D
D
回复
0
查看
811
DelphiTeacher的专栏
D
后退
顶部