Sign in to follow this  
Followers 0
Inverted

TinyURL script

4 posts in this topic

I've made a script to quickly use tinyurl. It works, but I have some problems :

1) Can I avoid the question about permission to copy to the clipboard ? The site tries to copy to the clipboard and it pauses the whole thing. I know I could probably mess with my IE settings, but I want the script to work the same on all PCs without any extra work. So, can I set the options somehow ?

2) Can I make it to load faster ? Maybe somehow not loading images ?

I started out trying to use POST method but failed miserably. After an hour of fumbling about I did some searches on the forum and got some useful info, like "read the IE documentation and the examples"

That's why 'm doing it the loser's way with the hidden IE and clicking :)

Here is my script :

#include <IE.au3>
#include <ClipBoard.au3>

$ProgName = "TinyURL_Auto"

$BigUrl = InputBox ($ProgName, "Enter url to send to tinyurl")

$oIE = _IECreate ("http://tinyurl.com/",0,0)
If $oIE=0 Then
     MsgBox (4096, $ProgName, "Couldn't open page, firewall ?")
EndIf   

$submit_btn = _IEGetObjByName($oIE, "submit",1)
$url_box = _IEGetObjByName($oIE, "url")
_IEFormElementSetValue ($url_box, $BigUrl)
$submit_btn.click
_IELoadWait ($oIE)

$sText = _IEBodyReadText ($oIE)

$array = StringSplit ($sText,@CRLF,1)
For $i = 1 to $array[0]
    If StringInStr ($array[$i],"http://tinyurl.com/") Then
        _ClipBoard_SetData ($array[$i])
        MsgBox(0, $ProgName, "Copied to clipboard : "& @CRLF & @CRLF & $array[$i],3)
        Exit
    EndIf
Next

Share this post


Link to post
Share on other sites



Oops, my thread got buried in 3rd page already ?

*bump*

:)

Share this post


Link to post
Share on other sites

I don't mean my ClipPut, the site itself also tries to send to the clipboard, but IE gives a message to "allow/don't allow"

And it pauses the execution !

Is there some way to set the options in my script to always allow/disallow it ? Or somehow avoid the warning ?

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