AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

ClipFile(s) - a clip helper

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
iason



Joined: 01 Nov 2005
Posts: 125

PostPosted: Sun Aug 20, 2006 9:22 pm    Post subject: ClipFile(s) - a clip helper Reply with quote

I guess i'm not the ony one. All the time wanting to copy that particular CLIP among myriads of them - and fast.

Let me create a folder (named for example "clipfiles") in my data-drive. And inside i create some .txt files containing clips. Why .txt files? - because notepad starts real fast, but it can be text-files of some other application. In a 'html.txt' file i put html-code-clips, in 'css.txt' css-code-clips, in 'emails.txt' email addresses etc. etc. etc.

The script:
Code:

;ClipFiles
#singleinstance force

         ; FOLDER TO LOOK FOR CLIPFILES (TO ZAP WITH NOTEPAD)
whichfolder = [put it here]

         ; BUILD GUI TO CHOOSE CLIPFILE
loop, %whichfolder%\*.txt
{
 file%A_Index% = %A_LoopFileName%
 num = %A_Index%
}
str = 
loop, %num%
{
 tmp := file%A_Index%
 str = %str%|%tmp%
}
sort, str, D|
gui, font, s9, Tahoma
gui, color, red
gui, add, ddl, w500 gexec r40 choose2, %str%
gui, show, , ClipFile(s)
MouseClick, left, 505, 39, ,0
return

exec:
winhide A
wingetactivetitle, MyWorkWin
run %whichfolder%\%A_GuiControl%
sleep 10
Input, var, , {Esc},    ; >> USER SELECTS with mouse WANTED (CLIP)TEXT & PRESSES "Esc"
sleep 10
Send ^c
winclose A
winactivate, %MyWorkWin%
send ^v         ; PASTE CLIP ON WORKING WINDOW
exitapp

         ; ON PRESSING Esc EXIT SCRIPT
guiescape:
guiclose:
exitapp

Use: Right now in my email client i need an email-address! I start the script with a hotkey, click on 'emails.txt', select the text i want and press Esc. Just that.

Version 2:

And even faster. I omit the initial GUI, accessing one certain ClipFile directly with one stroke:
Code:

;ClipFile
#singleinstance force

wingetactivetitle, MyWorkWin
run ahk_scripts\clipfiles\emails.txt
sleep 10
Input, var, , {Esc},    ; >> USER SELECTS with mouse WANTED CLIPTEXT & PRESSES "Esc"
sleep 10
Send ^c
winclose A
winactivate, %MyWorkWin%
send ^v         ;PASTE CLIP ON WORKING WINDOW
exitapp

         ;ON PRESSING Esc EXIT SCRIPT
guiescape:
guiclose:
exitapp

Use: Press the hotkey, select something with the mouse, press Esc. Just that.

Enjoy! And hey i would enjoy improvements. Good ideas most wanted. Wink
_________________
help to be helped
Back to top
View user's profile Send private message
robiandi



Joined: 08 Aug 2006
Posts: 50

PostPosted: Sun Oct 01, 2006 11:46 am    Post subject: Reply with quote

I enjoy it.
A little improvement:
In both scripts replace
Code:
Send ^c
winclose A
winactivate, %MyWorkWin%
send ^v         ; PASTE CLIP ON WORKING WINDOW
by
Code:
 Send ^c
 winclose A
 to_send := clipboard
 winactivate, %MyWorkWin%
 sendinput %to_send%
because otherwise it will not work for example in putty.exe
(When you change to putty.exe the clipboard is managed by putty.exe and the actual content doesn't correspond to the previous "send ^c" )
Back to top
View user's profile Send private message
danwdoo



Joined: 07 Jan 2008
Posts: 5

PostPosted: Tue Feb 19, 2008 10:31 am    Post subject: Can clipfiles just post the whole file to notepad? Reply with quote

I really like the concept of clipfiles but instead of opening notepad with the desired text to be highlighted I would like it to just copy the entire clipfile to the clipboard automatically and then either paste it into the active window at the cursor or let me paste it manually. Is there an easy way to do this? Basically I am looking for a "canned response" type manager and this is the closest I have found yet!

Thanks!
Danny
Back to top
View user's profile Send private message
iason



Joined: 01 Nov 2005
Posts: 125

PostPosted: Thu Feb 21, 2008 2:05 pm    Post subject: Reply with quote

If i get it right, you might replace
Code:
run %whichfolder%\%A_GuiControl%
sleep 10
Input, var, , {Esc},
sleep 10
Send ^c
winclose A

with a simple FileRead
Code:
FileRead, clipboard, %whichfolder%\%A_GuiControl%

Only problem: unicode stuff... hence the opening with notepad. Wink

Quote:
I am looking for a "canned response" type manager
If you want some static clips, make the filepick static instead.
_________________
help to be helped
Back to top
View user's profile Send private message
danwdoo



Joined: 07 Jan 2008
Posts: 5

PostPosted: Thu Feb 21, 2008 6:23 pm    Post subject: Reply with quote

That works perfectly. I did go back to the origional code of using:
Code:
send, ^v

As the latter method seemed to add double line spaces when pasting into RTF clients like Outlook or WordPad.

I am using this as a "canned response" manager for a helpdesk situation so helpdesk staff can paste common steps and answers to users in an email or other document. I really like the ability for individual files as this allows the staff to share files and be able to pick from a large list of choices without having to scroll through a single large file.

Thanks so much for your help!
Danny[/code]
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group