Jump to content



Photo

[- Release -] Clipboard Tool


  • Please log in to reply
8 replies to this topic

#1 FinalVersion

FinalVersion

    0 ^ 1

  • Active Members
  • PipPipPipPipPipPip
  • 599 posts

Posted 12 March 2010 - 01:36 PM

Notes: Simple, but I find this extremely useful.

Hotkeys:
  • Ctrl + Home (Clear the clipboard)
  • Ctrl + Page Up (Read the clipboard)
  • Ctrl + End (Exit the program)
ToDo:
  • Load File Into Clipboard With Hotkey.
  • Your Suggestions!
AutoIt         
#cs ----------------------------------------------------------------------------         Author:     -> Final Version     Version:    -> 3.3.5.6 <Beta>     Function:   -> Simple clipboard tool, but could potentially but useful for nurmerous people.s     #ce ---------------------------------------------------------------------------- #include <Misc.au3> Opt("TrayMenuMode", 3) $tClear = TrayCreateItem("-> Clear The Clipboard") $tRead = TrayCreateItem("-> Read The Clipboard") $tExit = TrayCreateItem("-> Exit Program") While 1     $tMsg = TrayGetMsg()     Select         Case $tMsg = $tClear             ClearTheClip()         Case $tMsg = $tRead             ReadTheClip()         Case $tMsg = $tExit             End()     EndSelect     If _IsPressed("11") And _IsPressed("24") Then         ClearTheClip()     ElseIf _IsPressed("11") And _IsPressed("21") Then         ReadTheClip()     ElseIf _IsPressed("11") And _IsPressed("23") Then         End()     EndIf WEnd Func ClearTheClip()     ClipPut(""); EndFunc ;==>ClearTheClip Func ReadTheClip()     $sRead = ClipGet();     If $sRead = "" Then         TrayTip("Current Clip Contents", "Clipboard doesn't contain anything!", 3, 1);     ElseIf $sRead = " " Then ;==> This is for my personal use, I got into the habit of clearing my clipboard by cutting a space in a text field.         TrayTip("Current Clip Contents", "Clipboard contained a space, I'll empty it for you...", 3, 1);         ClipPut("")     Else         TrayTip("Current Clip Contents", $sRead, 3, 1);     EndIf EndFunc ;==>ReadTheClip Func End()     Exit EndFunc ;==>End

Edited by FinalVersion, 12 March 2010 - 02:40 PM.








#2 Shafayat

Shafayat

    Polymath

  • Active Members
  • PipPipPipPip
  • 245 posts

Posted 12 March 2010 - 01:48 PM

I'd prefer using ispressed() udf or wm events instead of hotkeyset to avoid blocking functionality of other software using the same hotkey. I know this because I made the same mistake once.
[Not using this account any more. Using "iShafayet" instead]

#3 FinalVersion

FinalVersion

    0 ^ 1

  • Active Members
  • PipPipPipPipPipPip
  • 599 posts

Posted 12 March 2010 - 02:26 PM

Yeah I noticed the interference with firefox trying to create a New Tab. Will fix asap.

Edit: Done.

Edited by FinalVersion, 12 March 2010 - 02:39 PM.


#4 Shafayat

Shafayat

    Polymath

  • Active Members
  • PipPipPipPip
  • 245 posts

Posted 12 March 2010 - 03:18 PM

You might add option to automatically output clipboard text. I remember I saw a udf for that. Search for "_clipboard_getall" and you'll probably find it.
[Not using this account any more. Using "iShafayet" instead]

#5 FinalVersion

FinalVersion

    0 ^ 1

  • Active Members
  • PipPipPipPipPipPip
  • 599 posts

Posted 12 March 2010 - 03:20 PM

What do you mean, automatically output the clipboard text?

#6 Shafayat

Shafayat

    Polymath

  • Active Members
  • PipPipPipPip
  • 245 posts

Posted 12 March 2010 - 04:18 PM

I mean show the traytip you are using whenever data in clipboard changes.
[Not using this account any more. Using "iShafayet" instead]

#7 FinalVersion

FinalVersion

    0 ^ 1

  • Active Members
  • PipPipPipPipPipPip
  • 599 posts

Posted 12 March 2010 - 04:24 PM

Ok will add that.

#8 scriptjunkie

scriptjunkie

    Seeker

  • Active Members
  • 20 posts

Posted 12 March 2010 - 05:16 PM

That's kinda of a cool idea. I like the adding support to load a file to the clipboard. (even though I'm sure it's been done before).


Plain Text         
#cs ----------------------------------------------------------------------------         Author:     -> Final Version     Version:    -> 3.3.5.6 <Beta>     Function:   -> Simple clipboard tool, but could potentially but useful for nurmerous people.s     #ce ---------------------------------------------------------------------------- #include <Misc.au3> Opt("TrayMenuMode", 3) $tClear = TrayCreateItem("-> Clear The Clipboard") $tRead = TrayCreateItem("-> Read The Clipboard") $tReadfile = TrayCreateItem("-> Load File to Clipboard") $tExit = TrayCreateItem("-> Exit Program") While 1     $tMsg = TrayGetMsg()     Select         Case $tMsg = $tClear             ClearTheClip()         Case $tMsg = $tRead             ReadTheClip()         Case $tMsg = $tReadfile             AddFileToClip()         Case $tMsg = $tExit             End()     EndSelect     If _IsPressed("11") And _IsPressed("24") Then         ClearTheClip()     ElseIf _IsPressed("11") And _IsPressed("21") Then         ReadTheClip()     ElseIf _IsPressed("11") And _IsPressed("23") Then         End()     ElseIf _IsPressed("11") And _IsPressed("22") Then         AddFileToClip()     EndIf WEnd Func ClearTheClip()     ClipPut(""); EndFunc ;==>ClearTheClip Func ReadTheClip()     $sRead = ClipGet();     If $sRead = "" Then         TrayTip("Current Clip Contents", "Clipboard doesn't contain anything!", 3, 1);     ElseIf $sRead = " " Then ;==> This is for my personal use, I got into the habit of clearing my clipboard by cutting a space in a text field.         TrayTip("Current Clip Contents", "Clipboard contained a space, I'll empty it for you...", 3, 1);         ClipPut("")     Else         TrayTip("Current Clip Contents", $sRead, 3, 1);     EndIf EndFunc ;==>ReadTheClip Func AddFileToClip()         Local $filename, $filehand, $filedata         $filedata = ""         $filename = FileOpenDialog("Choose file", "./", "All (*.*)", 1+2)     If $filename = "" Then Return         $filehand = FileOpen($filename, 0)     If $filehand = -1 Then         MsgBox(0, "Error", "Unable to open file.")         Return     EndIf     While 1         $filedata = $filedata & FileRead($filehand, 1024)         If @error = -1 Then ExitLoop     Wend     FileClose($filehand)     ClipPut($filedata)     TrayTip("Loaded into Clipboard", $filedata, 3, 1);     EndFunc ;==>AddFileToClip         Func End()     Exit EndFunc ;==>End


#9 wraithdu

wraithdu

    I am less fun than a twisted ankle.

  • MVPs
  • 2,137 posts

Posted 12 March 2010 - 07:23 PM

_IsPressed in a loop like that is a bad hack. Why not just send the keypresses through in your function if you really don't want to eat them?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users