Jump to content

Copy Link Address


Recommended Posts

Hi,

Here is the script, and prtscr is attached:

#include <GUIConstants.au3>
#include <IE.au3>

$TEST = GUICreate("TEST", 470, 600)
GUISetState(@SW_SHOW)

Global $oIE = _IECreateEmbedded ()
Global $GUIActiveX = GUICtrlCreateObj($oIE, 0, 0, 470, 620)
_IENavigate($oiE, "http://www.youtube.com/results?search_query=AutoIT&aq=f")

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

Quesstion:

Is there some possibility, to make shortcut with:

Send("keys"), or use _IE... or somthing else

I used this fuction, if hit some HotKey, but it's not what I need

Func _CopyLinkAddress()
        $pos = MouseGetPos()
        MouseClick("right")
        Sleep (10)
        MouseMove($pos[0]+66, $pos[1]+140)
        Sleep (10)
        MouseClick("left")
EndFunc

Please help me, if somebody knows something. Posted Image

post-56053-0-27754200-1294344340_thumb.j

Link to comment
Share on other sites

Straight out of the helpfile

#include <GUIConstants.au3>
#include <IE.au3>

$TEST = GUICreate("TEST", 470, 600)
GUISetState(@SW_SHOW)

Global $oIE = _IECreateEmbedded ()
Global $GUIActiveX = GUICtrlCreateObj($oIE, 0, 0, 470, 620)
_IENavigate($oiE, "http://www.youtube.com/results?search_query=AutoIT&aq=f")

_IELoadWait($oiE)

$oLinks = _IELinkGetCollection ($oIE)
$iNumLinks = @extended
MsgBox(0, "Link Info", $iNumLinks & " links found")
For $oLink In $oLinks
    MsgBox(0, "Link Info", $oLink.href)
Next


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

I don`t know how to explain Posted Image Sry for bad [English]

I wonna put in Clipboard the link of the target *(can be seen on screenshot) and than Exit on GUI.

Open e.g.:Notepad and Paste URL -->(on screenshot) is that -->

If you still dnot know: Open the PAGE and move mouse over first video what you see, right click, and click "Copy Link Address" -in Opera, "Copy Link Location"-in Mozilla,

"Copy Shortcut"- in IE.... open new Blank tab and paste

This I would like to do over code, :x

Link to comment
Share on other sites

If this were C# I would suggest the getobjectfrompoint method, but alas I think thats a .net thing which autoit does not use.

If it were a normal browser I would suggest reading the status bar, but once again its a gui and it dosent work on all browsers anyway.

So in conclusion I havent got a clue even if you can with autoit.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

This can be done, but please explain what you are trying to accomplish because there may be easy and hard ways of accomplishing your goal.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

Actually this is first idea of my YouTUBE-Search script:

#include 
#include 
$hGUI = GUICreate("YouTUBE-SEARCH", 470, 600)
GUISetState(@SW_SHOW)

Global $oIE = _IECreateEmbedded ()
Global $GUIActiveX = GUICtrlCreateObj($oIE, 0, 0, 470, 620)
_IENavigate($oiE, @ScriptDir & "\YouTUBE-Search.html")  ;<== or change to http://boris.host56.com/YT_Search/YT-Search.html

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

And make HTML:

<script src="http://www.yvoschaap.com/ytcp.js" type="text/javascript"></script><style type="text/css">
</style>
<div id="youtubeDiv"></div>
<form onsubmit="insertVideos({'block':'youtubeDivSearch','type':'search','q':document.getElementById('ytSearchField').value,'results': 30,'order':'most_relevance'}); return false;">
  <input  type="text" id="ytSearchField" />  <input type="submit" value="  Search  " />
</form>
<div id="youtubeDivSearch"></div>

...and i wonna copy link address and..., but this is bullsh**

This is really what i want

thanks for help :x

Link to comment
Share on other sites

It is not clear to me what you are trying to accomplish. The pictures do not do it for me. I can help, but you need to explain in much more detail your intent and proposed design.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

Dale,

I hope have little more details of image.

Please help me, I want this solve

Sorry for slow response,

#cs


    08.01.2011 = By BoRisk
    YouTUBE-SEARCH = explaining script

    Searching options:
                        Result type:    Videos
                        Sort by:        Relevance
                        Displaying 10 result / search
                        Thumbnail, Title
    
-   Question? How to make search like this==>
            If tipe keyword PRODIGY in $eSearch and press $sBtn, how to get 10 result, like shown here
            http://www.youtube.com/results?search_type=videos&search_query=Prodigy&uni=3
            Than use default picture as button to get link, example of first video === [http://www.youtube.com/watch?v=wmin5WkOuPw]
            and save this to text file

-   PROBLEM! How to make search...
#Ce


    #cs
    ==============================  How to get Title?  ===========================================
            String in Page Source = http://gdata.youtube.com/feeds/api/videos/wmin5WkOuPw
            
            The Prodigy - Firestarter 
            
            If using _StringBetween ===>
            Exmple:
            $left = 
            $right =  
            _StringBetween($Read_In_PageSource, $left, $right)
            and get Title = The Prodigy - Firestarter
    
                            GET PAGE SOURCE:
                                                #include 
                                                #include 
                                                $GUI = GUICreate("Page Source", 800, 450)
                                                $object = ObjCreate("Shell.Explorer.2")
                                                $object_ctrl = GUICtrlCreateObj($object, 0, 0, 800, 450)
                                                _IENavigate($object, "http://gdata.youtube.com/feeds/api/videos/wmin5WkOuPw")
                                                GUISetState()

                                                While 1
                                                    $msg = GUIGetMsg()
                                                    Select
                                                    Case $msg = $GUI_EVENT_CLOSE
                                                        Exit
                                                    EndSelect
                                                WEnd
    #ce
#cs             
********Im used GUIScrollbars_Ex UDF by  Melba23 = http://www.autoitscript.com/forum/topic/113723-scrollbars-made-easy/page__hl__scrollbar
#ce

#include "GUIScrollbars_Ex.au3"
#include "GUIConstantsEx.au3"
#include "EditConstants.au3"
#include "IE.au3"
#include "WindowsConstants.au3"
#include "INet.au3"
#include "ButtonConstants.au3"

DirCreate(@ScriptDir & "\TempFILES")
Global $fSave = @ScriptDir & "\" & "Save.txt"

$hGUI = GUICreate("YouTUBE-SEARCH", 500, 800)
    GUISetBkColor(0xFFFFFF)
;$Logo = GUICtrlCreatePic(@ScriptDir & '\YouTube.jpg', 20, 20, 107, 45)
        $URL = "http://boris.host56.com/UPLOAD/YouTube.jpg"
        $PicL = @ScriptDir & "\TempFILES" & "\YouTube.jpg"
        InetGet($URL, $PicL, 1)
$Logo = GUICtrlCreatePic( $PicL, 20, 20, 107, 45)
        GUICtrlSetCursor (-1, 0)
$eSearch = GUICtrlCreateEdit("Prodigy", 140, 30, 250, 25, $ES_AUTOHSCROLL)
    GUICtrlSetFont($eSearch, 12)
    GUICtrlSetBkColor($eSearch, 0xFFFFFF)
$sBtn = GUICtrlCreateButton("SEARCH", 400, 30, 75, 25, 0)
    GUICtrlSetCursor (-1, 0)
    GUICtrlSetColor($sBtn, 0xFFFFFF)
    GUICtrlSetBkColor($sBtn, 0xBEBEBE)

; 01 result ====================================================================================
Local $VideID_01 = "wmin5WkOuPw"
$URL = "http://i.ytimg.com/vi/"& $VideID_01 &"/default.jpg"
$PicName = $VideID_01
$PIC = @ScriptDir & "\TempFILES" & "\" & $PicName & ".jpg"
Global $yTOP = 90
InetGet($URL, $PIC, 1)
$r01 = GUICtrlCreatePic( $PIC, 30, $yTOP, 120, 90)
GUICtrlSetCursor (-1, 0)
; Create Label = TITLE of Song
$Label1 = GUICtrlCreateLabel("", 160, $yTOP, 200, 15)
GUICtrlSetData( $Label1, "The Prodigy - Firestarter")

; 02 result ====================================================================================
Local $VideID_02 = "6RI9wVgOO1s"
$URL = "http://i.ytimg.com/vi/"& $VideID_02 &"/default.jpg"
$PicName = $VideID_02
$PIC = @ScriptDir & "\TempFILES" & "\" & $PicName & ".jpg"
$yTOPnext = $yTOP + 100
InetGet($URL, $PIC, 1)
$r02 = GUICtrlCreatePic( $PIC, 30, $yTOPnext, 120, 90)
GUICtrlSetCursor (-1, 0)
; Create Label = TITLE of Song
$Label1 = GUICtrlCreateLabel("", 160, $yTOPnext, 200, 15)
GUICtrlSetData( $Label1, "Prodigy - No Good")

; 03 result ====================================================================================
Local $VideID_03 = "-Fz85FE0KtQ"
$URL = "http://i.ytimg.com/vi/"& $VideID_03 &"/default.jpg"
$PicName = $VideID_03
$PIC = @ScriptDir & "\TempFILES" & "\" & $PicName & ".jpg"
$yTOPnext = $yTOP + 200
InetGet($URL, $PIC, 1)
$r03 = GUICtrlCreatePic( $PIC, 30, $yTOPnext, 120, 90)
GUICtrlSetCursor (-1, 0)
; Create Label = TITLE of Song
$Label1 = GUICtrlCreateLabel("", 160, $yTOPnext, 200, 15)
GUICtrlSetData( $Label1, "THE PRODIGY - voodoo people (original)")


; 04 result ====================================================================================
Local $VideID_04 = "BKXKWBcaV3A"
$URL = "http://i.ytimg.com/vi/"& $VideID_04 &"/default.jpg"
$PicName = $VideID_04
$PIC = @ScriptDir & "\TempFILES" & "\" & $PicName & ".jpg"
$yTOPnext = $yTOP + 300
InetGet($URL, $PIC, 1)
$r04 = GUICtrlCreatePic( $PIC, 30, $yTOPnext, 120, 90)
GUICtrlSetCursor (-1, 0)
; Create Label = TITLE of Song
$Label1 = GUICtrlCreateLabel("", 160, $yTOPnext, 200, 15)
GUICtrlSetData( $Label1, "The Prodigy - Voodoo People (Pendulum Remix)")


; 05 result ====================================================================================
Local $VideID_05 = "Lrmf283dSXw"
$URL = "http://i.ytimg.com/vi/"& $VideID_05 &"/default.jpg"
$PicName = $VideID_05
$PIC = @ScriptDir & "\TempFILES" & "\" & $PicName & ".jpg"
$yTOPnext = $yTOP + 400
InetGet($URL, $PIC, 1)
$r05 = GUICtrlCreatePic( $PIC, 30, $yTOPnext, 120, 90)
GUICtrlSetCursor (-1, 0)
; Create Label = TITLE of Song
$Label1 = GUICtrlCreateLabel("", 160, $yTOPnext, 200, 15)
GUICtrlSetData( $Label1, "Prodigy - Spitfire")

; 06 result ====================================================================================
Local $VideID_06 = "rmHDhAohJlQ"
$URL = "http://i.ytimg.com/vi/"& $VideID_06 &"/default.jpg"
$PicName = $VideID_06
$PIC = @ScriptDir & "\TempFILES" & "\" & $PicName & ".jpg"
$yTOPnext = $yTOP + 500
InetGet($URL, $PIC, 1)
$r06 = GUICtrlCreatePic( $PIC, 30, $yTOPnext, 120, 90)
GUICtrlSetCursor (-1, 0)
; Create Label = TITLE of Song
$Label1 = GUICtrlCreateLabel("", 160, $yTOPnext, 200, 15)
GUICtrlSetData( $Label1, "The Prodigy - 'Breathe'")


; 07 result ====================================================================================
Local $VideID_07 = "Bq46OY-FHIc"
$URL = "http://i.ytimg.com/vi/"& $VideID_07 &"/default.jpg"
$PicName = $VideID_07
$PIC = @ScriptDir & "\TempFILES" & "\" & $PicName & ".jpg"
$yTOPnext = $yTOP + 600
InetGet($URL, $PIC, 1)
$r07 = GUICtrlCreatePic( $PIC, 30, $yTOPnext, 120, 90)
GUICtrlSetCursor (-1, 0)
; Create Label = TITLE of Song
$Label1 = GUICtrlCreateLabel("", 160, $yTOPnext, 200, 15)
GUICtrlSetData( $Label1, "The Prodigy 'Omen'")

; 08 result ====================================================================================
Local $VideID_08 = "20tWDFxQq5A"
$URL = "http://i.ytimg.com/vi/"& $VideID_08 &"/default.jpg"
$PicName = $VideID_08
$PIC = @ScriptDir & "\TempFILES" & "\" & $PicName & ".jpg"
$yTOPnext = $yTOP + 700
InetGet($URL, $PIC, 1)
$r08 = GUICtrlCreatePic( $PIC, 30, $yTOPnext, 120, 90)
GUICtrlSetCursor (-1, 0)
; Create Label = TITLE of Song
$Label1 = GUICtrlCreateLabel("", 160, $yTOPnext, 200, 15)
GUICtrlSetData( $Label1, "Prodigy - Smack My Bitch Up (banned from mtv)")

; 09 result ====================================================================================
Local $VideID_09 = "CD5I-srSIbc"
$URL = "http://i.ytimg.com/vi/"& $VideID_09 &"/default.jpg"
$PicName = $VideID_09
$PIC = @ScriptDir & "\TempFILES" & "\" & $PicName & ".jpg"
$yTOPnext = $yTOP + 800
InetGet($URL, $PIC, 1)
$r09 = GUICtrlCreatePic( $PIC, 30, $yTOPnext, 120, 90)
GUICtrlSetCursor (-1, 0)
; Create Label = TITLE of Song
$Label1 = GUICtrlCreateLabel("", 160, $yTOPnext, 200, 15)
GUICtrlSetData( $Label1, "Prodigy")

; 10 result ====================================================================================
Local $VideID_10 = "gTw2YvutJRA"
$URL = "http://i.ytimg.com/vi/"& $VideID_10 &"/default.jpg"
$PicName = $VideID_10
$PIC = @ScriptDir & "\TempFILES" & "\" & $PicName & ".jpg"
$yTOPnext = $yTOP + 900
InetGet($URL, $PIC, 1)
$r10 = GUICtrlCreatePic( $PIC, 30, $yTOPnext, 120, 90)
GUICtrlSetCursor (-1, 0)
; Create Label = TITLE of Song
$Label1 = GUICtrlCreateLabel("", 160, $yTOPnext, 200, 15)
GUICtrlSetData( $Label1, "The Prodigy - Invaders Must Die [HQ] High Quality Sound")
;===========================================================

GUISetState(@SW_SHOW)
_GUIScrollbars_Generate($hGUI, 0, 1100)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $r01
            IniWrite($fSave, "01", "Link", $VideID_01)
        Case $r02
            IniWrite($fSave, "02", "Link", $VideID_02)
        Case $r03
            IniWrite($fSave, "03", "Link", $VideID_03)
        Case $r04
            IniWrite($fSave, "04", "Link", $VideID_04)
        Case $r05
            IniWrite($fSave, "05", "Link", $VideID_05)
        Case $r06
            IniWrite($fSave, "06", "Link", $VideID_06)
        Case $r07
            IniWrite($fSave, "07", "Link", $VideID_07)
        Case $r08
            IniWrite($fSave, "08", "Link", $VideID_08)
        Case $r09
            IniWrite($fSave, "09", "Link", $VideID_09)
        Case $r10
            IniWrite($fSave, "10", "Link", $VideID_10)
        Case $sBtn
            $keyword = GUICtrlRead( $eSearch)
                MsgBox( 0, "Search", $keyword) ; <--example
                ; _funcSEARCH and than sort results by ...
    EndSwitch
WEnd ;==> End script

#cs From search on YouTUBE - http://www.youtube.com/results?search_type=videos&search_query=Prodigy&uni=3

The Prodigy - Firestarter
[http://www.youtube.com/watch?v=wmin5WkOuPw]

Prodigy - No Good
[http://www.youtube.com/watch?v=6RI9wVgOO1s]

THE PRODIGY - voodoo people (original)
[http://www.youtube.com/watch?v=-Fz85FE0KtQ]

The Prodigy - Voodoo People (Pendulum Remix)
[http://www.youtube.com/watch?v=BKXKWBcaV3A]

Prodigy - Spitfire
[http://www.youtube.com/watch?v=Lrmf283dSXw]

The Prodigy - 'Breathe'
[http://www.youtube.com/watch?v=rmHDhAohJlQ]

The Prodigy 'Omen'
[http://www.youtube.com/watch?v=Bq46OY-FHIc]

Prodigy - Smack My Bitch Up (banned from mtv)
[http://www.youtube.com/watch?v=20tWDFxQq5A]

Prodigy
[http://www.youtube.com/watch?v=CD5I-srSIbc]

The Prodigy - Invaders Must Die [HQ] High Quality Sound
[http://www.youtube.com/watch?v=gTw2YvutJRA]
#ce

; FUNCTIONS==>
Link to comment
Share on other sites

Example for search:

#include 'IE.au3'
#include 'String.au3'
#include 'Array.au3'
#include 'INet.au3'

;$Keyword = InputBox( "Search", "YouTUBE")
$Keyword = "Prodigy"

$file="sRESULT.xml"
INetGet("http://m.youtube.com/results?client=mv-google&gl=US&hl=en&q="& $Keyword &"&submit=Search",""& $file, 0, 0)
$source= FileRead("sRESULT.xml")


; 01 =========================================================================================
; Video ID
$left_VideoID = '<a accesskey="1" href="/watch?gl=US&client=mv-google&hl=en&v='
$right_VideoID = '">'
$string_ID=_StringBetween( $source, $left_VideoID, $right_VideoID)
; Title
$left_Title = $string_ID[0] & '">'
$right_Title = "</a>"
$string_TITLE=_StringBetween( $source, $left_Title, $right_Title)

MsgBox(0,"1", $string_ID[0] & @CRLF & $string_TITLE[0])


; 02 =========================================================================================
; Video ID
$left_VideoID = '<a accesskey="2" href="/watch?gl=US&client=mv-google&hl=en&v='
$right_VideoID = '">'
$string_ID=_StringBetween( $source, $left_VideoID, $right_VideoID)
; Title
$left_Title = $string_ID[0] & '">'
$right_Title = "</a>"
$string_TITLE=_StringBetween( $source, $left_Title, $right_Title)

MsgBox(0,"2", $string_ID[0] & @CRLF & $string_TITLE[0])


; 03 =========================================================================================
; Video ID
$left_VideoID = '<a accesskey="3" href="/watch?gl=US&client=mv-google&hl=en&v='
$right_VideoID = '">'
$string_ID=_StringBetween( $source, $left_VideoID, $right_VideoID)
; Title
$left_Title = $string_ID[0] & '">'
$right_Title = "</a>"
$string_TITLE=_StringBetween( $source, $left_Title, $right_Title)

MsgBox(0,"3", $string_ID[0] & @CRLF & $string_TITLE[0])


; 04 =========================================================================================
; Video ID
$left_VideoID = '<a accesskey="4" href="/watch?gl=US&client=mv-google&hl=en&v='
$right_VideoID = '">'
$string_ID=_StringBetween( $source, $left_VideoID, $right_VideoID)
; Title
$left_Title = $string_ID[0] & '">'
$right_Title = "</a>"
$string_TITLE=_StringBetween( $source, $left_Title, $right_Title)

MsgBox(0,"4", $string_ID[0] & @CRLF & $string_TITLE[0])


; 05 =========================================================================================
; Video ID
$left_VideoID = '<a accesskey="5" href="/watch?gl=US&client=mv-google&hl=en&v='
$right_VideoID = '">'
$string_ID=_StringBetween( $source, $left_VideoID, $right_VideoID)
; Title
$left_Title = $string_ID[0] & '">'
$right_Title = "</a>"
$string_TITLE=_StringBetween( $source, $left_Title, $right_Title)

MsgBox(0,"5", $string_ID[0] & @CRLF & $string_TITLE[0])


; 06 =========================================================================================
; Video ID
$left_VideoID = '<a accesskey="6" href="/watch?gl=US&client=mv-google&hl=en&v='
$right_VideoID = '">'
$string_ID=_StringBetween( $source, $left_VideoID, $right_VideoID)
; Title
$left_Title = $string_ID[0] & '">'
$right_Title = "</a>"
$string_TITLE=_StringBetween( $source, $left_Title, $right_Title)

MsgBox(0,"6", $string_ID[0] & @CRLF & $string_TITLE[0])


; 07 =========================================================================================
; Video ID
$left_VideoID = '<a accesskey="7" href="/watch?gl=US&client=mv-google&hl=en&v='
$right_VideoID = '">'
$string_ID=_StringBetween( $source, $left_VideoID, $right_VideoID)
; Title
$left_Title = $string_ID[0] & '">'
$right_Title = "</a>"
$string_TITLE=_StringBetween( $source, $left_Title, $right_Title)

MsgBox(0,"7", $string_ID[0] & @CRLF & $string_TITLE[0])


; 08 =========================================================================================
; Video ID
$left_VideoID = '<a accesskey="8" href="/watch?gl=US&client=mv-google&hl=en&v='
$right_VideoID = '">'
$string_ID=_StringBetween( $source, $left_VideoID, $right_VideoID)
; Title
$left_Title = $string_ID[0] & '">'
$right_Title = "</a>"
$string_TITLE=_StringBetween( $source, $left_Title, $right_Title)

MsgBox(0,"8", $string_ID[0] & @CRLF & $string_TITLE[0])
Edited by BoRisk
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...