Sign in to follow this  
Followers 0
dickjones007

button click to activate scipt portion + other stuff

11 posts in this topic

first of all i am total newb but learning fast

so my mission is to make a button to run part of scipt in $oIE = _IECreateEmbedded ()

what i cant figure out is how to run following script specified number of time.

i can specify it maybe though input box?

Select
            Case $msg = $GUI_Button_Clickvid
                MouseClick("primary",50,70)
                MouseWheel("down",9)
                Dim $ycoord = 65
                    While $ycoord
                    Sleep(300)
                    MouseClick("primary",130,$ycoord)
                    Sleep(5000)
                    MouseClick("primary",130,$ycoord)
                    Sleep(3000)
                    $ycoord +=29
                    WEnd
EndSelect

my next mission would be to extract anchor link list from pages source (and put it in a table for further copy paste) like its done in IEbulder 1.0.4 (i guess you know about it, check attached file for example).

i think that would be it for a start.

Share this post


Link to post
Share on other sites



hi dickjones,

A simple loop will do the trick :unsure: look at this example:

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 362, 240, 205, 147)
$Button1 = GUICtrlCreateButton("Click me", 8, 8, 345, 25, $WS_GROUP)
$Edit1 = GUICtrlCreateEdit("", 8, 40, 345, 193)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            $number = Number(InputBox(@ScriptName, "Enter number of lines to add"))
            For $i = 1 To $number
                GUICtrlSetData($Edit1, GUICtrlRead($Edit1) & "Some text." & @CRLF)
            Next
    EndSwitch
WEnd

Hope this helps

-smartee

Share this post


Link to post
Share on other sites

yes that was extremely helpful

thanks

...

my next mission would be to extract anchor link list from pages source

...

this quote of mine was also part of the problem. i want to replace your "Some text." with anchor links list.

i failed to extract the code from ultimate autoit script collection.

can i get any help on that?

Share this post


Link to post
Share on other sites

update:

i found this code for list

i am not certain how to modify it to display ONLY links in anchor code

#include <Array.au3>
#include <IE.au3> 

$Primary_url = "http://buxp.info/viewvids.php" ; Any URL

$IE = _IECreate($Primary_url,0,1,1)
$pagesource = _IEBodyReadHTML($IE)

$array = StringRegExp($pagesource,'(?:<A href=")(http.*?)(?:">)(.*?)(?:</A>)',3)


 _ArrayDisplay($array, "Test")

Share this post


Link to post
Share on other sites

hi again,

Try this

#include <IE.au3>
#include <Array.au3>
$oIE = _IECreate("http://www.gnu.org/software/wget/manual/wget.html")
$oLinks = _IELinkGetCollection ($oIE)
$iNumLinks = @extended
MsgBox(0, "Link Info", $iNumLinks & " links found")
For $oLink In $oLinks
    ;show only Anchor links
    If StringInStr($oLink.href,"#") Then
    MsgBox(0, "Link Info: "&$oLink.innerText, $oLink.href)
    EndIf
Next

Hope this clears up some things :unsure:

-smartee

Share this post


Link to post
Share on other sites

thanks for that,

its late now

i will play with it tomorrow and let you know how it goes

Share this post


Link to post
Share on other sites

hi again,

Try this

#include <IE.au3>
#include <Array.au3>
$oIE = _IECreate("http://www.gnu.org/software/wget/manual/wget.html")
$oLinks = _IELinkGetCollection ($oIE)
$iNumLinks = @extended
MsgBox(0, "Link Info", $iNumLinks & " links found")
For $oLink In $oLinks
    ;show only Anchor links
    If StringInStr($oLink.href,"#") Then
    MsgBox(0, "Link Info: "&$oLink.innerText, $oLink.href)
    EndIf
Next

Hope this clears up some things :unsure:

-smartee

this code is great for what i want but i cant get it to work the way i want.

id this code links come one by one and cannot be copied but i need to get in a list that can copy paste each line

Share this post


Link to post
Share on other sites

hi,

Perhaps you may be interested in FileWrite(). Here's a quick implementation:

#include <IE.au3>
#include <Array.au3>
$linkFile = @ScriptDir & "\AnchorLinks.txt"
SplashTextOn(@ScriptName, "Please wait..", 200, 50)
$oIE = _IECreate("http://www.gnu.org/software/wget/manual/wget.html", 0, 0)
$oLinks = _IELinkGetCollection($oIE)
$iNumLinks = @extended
$linkFileHandle = FileOpen($linkFile, 1)
;MsgBox(0, "Link Info", $iNumLinks & " links found")
FileWriteLine($linkFileHandle, $iNumLinks & " links found")
For $oLink In $oLinks
    ;show only Anchor links
    If StringInStr($oLink.href, "#") Then
        FileWriteLine($linkFileHandle, $oLink.href)
        ;MsgBox(0, "Link Info: " & $oLink.innerText, $oLink.href)
    EndIf
Next
FileClose($linkFileHandle)
_IEQuit($oIE)
SplashOff()
MsgBox(64, @ScriptName, $iNumLinks & " links saved to """ & $linkFile & """")

Hope this helps,

-smartee

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

hi,

Perhaps you may be interested in FileWrite(). Here's a quick implementation:

#include <IE.au3>
#include <Array.au3>
$linkFile = @ScriptDir & "\AnchorLinks.txt"
SplashTextOn(@ScriptName, "Please wait..", 200, 50)
$oIE = _IECreate("http://www.gnu.org/software/wget/manual/wget.html", 0, 0)
$oLinks = _IELinkGetCollection($oIE)
$iNumLinks = @extended
$linkFileHandle = FileOpen($linkFile, 1)
;MsgBox(0, "Link Info", $iNumLinks & " links found")
FileWriteLine($linkFileHandle, $iNumLinks & " links found")
For $oLink In $oLinks
    ;show only Anchor links
    If StringInStr($oLink.href, "#") Then
        FileWriteLine($linkFileHandle, $oLink.href)
        ;MsgBox(0, "Link Info: " & $oLink.innerText, $oLink.href)
    EndIf
Next
FileClose($linkFileHandle)
_IEQuit($oIE)
SplashOff()
MsgBox(64, @ScriptName, $iNumLinks & " links saved to """ & $linkFile & """")

Hope this helps,

-smartee

wow, it apears i WAS intersted in that and i didnt even know it :unsure: thinking sometimes gets blocked when working long into the night

can this be further upgraded to tell the script to collect only HREFs from links on the page that only contain exact word match.

for example if a HTML page contains following link list:

red

RED

blue

blue

red

RED

BLUE

RED

BLUE

can the script extract only RED links, not red, BLUE and blue.

or to select all other links that do not contain RED.

Edited by dickjones

Share this post


Link to post
Share on other sites

#10 ·  Posted

Hi again,

can this be further upgraded to tell the script to collect only HREFs from links on the page that only contain exact word match

Of course, just use the StringInStr() function as I have to filter the URLs.

For example to test if a URL contains the string "RED" and the character "#" (case sensitive), use something like

;Write only links containing the character "#" and the word "RED"
If StringInStr($oLink.href, "#") And StringInStr($oLink.href, "RED", 1) Then
    FileWriteLine($linkFileHandle, $oLink.href)
EndIf

Hope this helps,

-smartee

Share this post


Link to post
Share on other sites

#11 ·  Posted

Hi again,

Of course, just use the StringInStr() function as I have to filter the URLs.

For example to test if a URL contains the string "RED" and the character "#" (case sensitive), use something like

;Write only links containing the character "#" and the word "RED"
If StringInStr($oLink.href, "#") And StringInStr($oLink.href, "RED", 1) Then
    FileWriteLine($linkFileHandle, $oLink.href)
EndIf

Hope this helps,

-smartee

greately,

now im going back to my own workshop :unsure:

Share this post


Link to post
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
Sign in to follow this  
Followers 0