Sign in to follow this  
Followers 0
Diana (Cda)

Help converting this send script to clipput.

6 posts in this topic

I worked on this script yesterday. It's one that I've used for years. But with new stuff I learned in last few days, would like to make it into a clipput script rather than keeping it as one where the keys are sent. It will make it easier to deal with switching screens; I won't risk losing information anymore with clipput.

I have the bulk of the script converted and the rest works okay, it's just getting the variable part, $sourceURL, to work.

The original script is this:

;
; AutoIt v3.0
;

;URL given will be used here wherever $sourceURL is found
$sourceURL = InputBox("Source URL", "Paste the source URL of this document here ...", "", "", -1, -1, 600, 400)
Sleep(2500)

SoundPlay(@ScriptDir & "\WAVs\WAV-PrRotate.wav")
Sleep(1000)

Send("<{shiftdown}1{shiftup}-- saved from url=(0035)")
Send($sourceURL)
Send(" -->{enter 2}")
Send("<{!}--HTML doc's URL{:}-->{enter}<b><font color={#}00FFFF><A HREF={SHIFTDOWN}'{SHIFTUP}")
Send($sourceURL)
Send("{SHIFTDOWN}'{SHIFTUP}>{enter}")
Send($sourceURL)
Send("{enter}<{/}A><{/}b><{/}font>{enter}<br>{enter}<br>{enter}<br>{enter 2}")

Exit
; finishedoÝ÷ ØÌ©j»bjYrb}çh謶¬jëh×6;
; AutoIt v3.0
;

;URL given will be used here wherever $sourceURL is found
$sourceURL = InputBox("Source URL", "Paste the source URL of this document in the" & @CRLF & "box below.  It will be sent to the clipboard ..." & @CRLF & "" & @CRLF & "(Retrieve from the clipboard using the PASTE function.)", "", "", -1, -1, 600, 400)
Sleep(500)

SoundPlay(@ScriptDir & "\WAVs\WAV-PrRotate.wav")
Sleep(500)

Clipput("<! -- saved from url=(0035) " & "$sourceURL" & " -->" & @CRLF & "" & @CRLF & "<!--HTML doc's URL:-->" & @CRLF & "<b><font color=#00FFFF><A HREF= " & """$sourceURL""" & ">" & @CRLF & "$sourceURL" & @CRLF & "</A></b></font>" & @CRLF & "<br>" & @CRLF & "<br>" & @CRLF & "<br>" & @CRLF & "" & @CRLF & "")

Sleep(500)
Exit
; finished

But I don't know how to get the info from $sourceURL to go into the clipboard text.

If I plug in "test URL" into the box, I get this as a result:

<! -- saved from url=(0035) $sourceURL -->

<!--HTML doc's URL:-->
<b><font color=#00FFFF><A HREF= "$sourceURL">
$sourceURL
</A></b></font>
<br>
<br>
<br>

without "test URL" in the 3 spots where $sourceURL is.

Thanks. :)

Share this post


Link to post
Share on other sites



My partially modifed one is this:

;
; AutoIt v3.0
;

;URL given will be used here wherever $sourceURL is found
$sourceURL = InputBox("Source URL", "Paste the source URL of this document in the" & @CRLF & "box below.  It will be sent to the clipboard ..." & @CRLF & "" & @CRLF & "(Retrieve from the clipboard using the PASTE function.)", "", "", -1, -1, 600, 400)
Sleep(500)

SoundPlay(@ScriptDir & "\WAVs\WAV-PrRotate.wav")
Sleep(500)

Clipput("<! -- saved from url=(0035) " & "$sourceURL" & " -->" & @CRLF & "" & @CRLF & "<!--HTML doc's URL:-->" & @CRLF & "<b><font color=#00FFFF><A HREF= " & """$sourceURL""" & ">" & @CRLF & "$sourceURL" & @CRLF & "</A></b></font>" & @CRLF & "<br>" & @CRLF & "<br>" & @CRLF & "<br>" & @CRLF & "" & @CRLF & "")

Sleep(500)
Exit
; finishedoÝ÷ Ûú®¢×ºËmjG­ê®¢×¨}ûazö«¦åzv¦y«­¢+ØÀÌØíͽÕÉUI0ôÅÕ½Ðí¡ÑÑÀè¼½ÝÝܹ½½±¹½´ÅÕ½Ðì)
±¥ÁÁÕÐ Ìäì±ÐìÌÌì´´ÍÙɽ´ÕÉ°ô ÀÀÌÔ¤ÌäìµÀìÀÌØíͽÕÉUI0µÀìÌäì´´ØÈìÌäìµÀì
I1µÀì
I1µÀìÌäìØÀìÌÌì´µ!Q50½ÌäìÌäíÌUI0è´´ØÈìÌäìµÀì|)
I1µÀìÌäì±ÐíÐì±Ðí½¹Ð½±½ÈôÀÁÐì±Ðí!IôÅÕ½ÐìÌäìµÀìÀÌØíͽÕÉUI0µÀìÌäìÅÕ½ÐìÐìÌäìµÀì
I1µÀìÀÌØíͽÕÉUI0µÀì
I1µÀìÌäì±Ðì½Ðì±Ðì½Ðì±Ðì½½¹ÐÐìÌäìµÀì|)
I1µÀìÌäì±ÐíÈÐìÌäìµÀì
I1µÀìÌäì±ÐíÈÐìÌäìµÀì
I1µÀìÌäì±ÐíÈÐìÌäìµÀì
I1µÀì
I1¤()5Í   ½à ØаÅÕ½ÐíIÍÕ±ÑÌÅÕ½Ðì°
±¥ÁÐ ¤¤

Note the single quotes used to make it easier to enclose double quotes where required. Plus doubled single quotes in "doc's" to escape that.

:)

Edit: Added display for clarity.


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

There's different ways you can do this and a suggestion would be to create one string and put that string into your paste variable. Here's an example.

$sourceURL = InputBox("Source URL", "Paste the source URL of this document here ...", "", "", -1, -1, 600, 400)
Sleep(2500)

SoundPlay(@ScriptDir & "\WAVs\WAV-PrRotate.wav")
Sleep(1000)
$pasteTxt = '<!-- saved from url=(0035)' & $sourceURL & '-->' & @CRLF & @CRLF
$pasteTxt &= "<!--HTML doc's URL:-->" & @CRLF
$pasteTxt &= '<b><font color=#00FFFF><A HREF="' & $sourceURL & '">' & @CRLF
$pasteTxt &= $sourceURL & @CRLF
$pasteTxt &= '</A></b></font>' & @CRLF & '<br>' & @CRLF & '<br>' & @CRLF & '<br>'
ClipPut($pasteTxt)
Send("^v")
Exit

Edit: PsaltyDS... you ok?? I think one post would have been sufficient to get your point across :) Didn't the doctor say to stop drinking so much salt water?? Its not good for you man :).

Edited by ssubirias3

Share this post


Link to post
Share on other sites

Edit: PsaltyDS... you ok?? I think one post would have been sufficient to get your point across :) Didn't the doctor say to stop drinking so much salt water?? Its not good for you man :P.

The forum editor bug got me. I thought it would be clever to just use the back button on Firefox to go back and fix something, but managed to post duplicates instead... live and learn, 'til you die and forget.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Wow, that is definitely more elegant than my attempt <sigh> <g>. I changed a couple of spaces and added the broader text prompt, so here is finished script:

;
; AutoIt v3.0
;

SoundPlay(@ScriptDir & "\WAVS\''H'', ''T'', ''M'', ''L'' (HTML).wav")


$sourceURL = InputBox("Source URL", "Paste the source URL of this document in the" & @CRLF & "box below.  It will be sent to the clipboard ..." & @CRLF & "" & @CRLF & "(Retrieve from the clipboard using the PASTE function.)", "", "", -1, -1, 600, 400)
SoundPlay(@ScriptDir & "\WAVs\WAV-PrRotate.wav")


$pasteTxt = '<!-- saved from url=(0035) ' & $sourceURL & ' -->' & @CRLF & @CRLF
$pasteTxt &= "<!--HTML doc's URL:-->" & @CRLF
$pasteTxt &= '<b><font color=#00FFFF><A HREF="' & $sourceURL & '">' & @CRLF
$pasteTxt &= $sourceURL & @CRLF
$pasteTxt &= '</A></b></font>' & @CRLF & '<br>' & @CRLF & '<br>' & @CRLF & '<br>' & @CRLF & '' & @CRLF & ''
ClipPut($pasteTxt)
Send("^v")

Exit
; finished

Thanks! This is great. When I save pages with MSIE I open them and copy the URL that IE leaves at the top. When I plug these URLs into this script, the output is a clickable link that when you open the saved webpage, takes you to the original page when clicked. By using the clipboard instead of sending to the keyboard, I won't have to rush to do the screen switch to get the cursor in position in time for the code to start sending <g>.

Thanks. :)

Edited by Diana (Cda)

Share this post


Link to post
Share on other sites

Wow, that is definitely more elegant than my attempt <sigh> <g>.

Now, now... there wasn't anything wrong with the way you were doing it before. As PsaltyDS said, all you needed to do was remove the quotes from around the variable. I was only offering an alternative that isn't "better" just different. Glad this worked out for you and always remember there's more than one way to skin a cat :).

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