AutoHotkey Community

It is currently May 27th, 2012, 9:24 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: August 20th, 2006, 9:22 pm 
Offline

Joined: November 1st, 2005, 4:44 am
Posts: 135
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 1st, 2006, 11:46 am 
Offline

Joined: August 8th, 2006, 3:55 pm
Posts: 49
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" )


Report this post
Top
 Profile  
Reply with quote  
PostPosted: February 19th, 2008, 10:31 am 
Offline

Joined: January 7th, 2008, 3:03 pm
Posts: 9
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 21st, 2008, 2:05 pm 
Offline

Joined: November 1st, 2005, 4:44 am
Posts: 135
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 21st, 2008, 6:23 pm 
Offline

Joined: January 7th, 2008, 3:03 pm
Posts: 9
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]


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: nomissenrojb, SKAN, Stigg and 7 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group