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 

clearing the clipboard after pasting from it?

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
partack



Joined: 14 Aug 2004
Posts: 3

PostPosted: Sat Aug 14, 2004 11:26 am    Post subject: clearing the clipboard after pasting from it? Reply with quote

allright. i'ts probably a really dumb question and im sorry =/ but i have given it a shot. really i have and iv've read alot of help files to try and figure it out my self..

i play a game that disables the 'send' commands.

all i want is a nice little chat hotkey. nothing to do with the actual game.

the game i play has special text characters you can create by adding two alt codes together. (Dont ask me how it works.. it jsut does.. Shocked )
thus meaning i don't want to remember all those alt codes for my favourite cool logo's and stuff.

simple enuff yeah? it works a treat.

i copy to the clipboard using alt and whatever and then paste it using ctrl and v. no problems so far.

Code:
!a::clipboard = %clipboard%¨Í ;
!b::clipboard = %clipboard%¨Î ;
!c::clipboard = %clipboard%¨Ï ;
!d::clipboard = %clipboard%¨Ð ;
!e::clipboard = %clipboard%¨Ñ ;



but just to make life easyer, it'd be better to hold alt and a letter to do pre-set special characters that i can paste all in one go

so i use the %clipboard% thing.

(alt + hello this is a test)

but i don't want to haveto clear my clipboard each time.. in order to type something else..

so is there a way to clear the clipboard after i have pasted from it without using a send command? or am i jsut going to have to scrap the whole idea?

i'm new at coding (And to this program) so pls go easy on me Rolling Eyes

by the way, great program. i love it to the max even if it doesnt suit this perticular situation.

3 thumbs up for it being released under GPL =D (free is my friend)
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Sat Aug 14, 2004 12:15 pm    Post subject: Reply with quote

Without understanding exactly the effect you're trying to achieve, here are are a few things that might help.

To clear the clipboard, set it equal to nothing, like so:
clipboard =

To clear the clipboard after pasting from it, you could make Control+V into a pass-through hotkey via the tilde prefix. This would cause Ctrl+V to paste in the game as normal (assuming Ctrl-V really has that function in the game), but it can also trigger an action to clear the clipboard (this feature requires NT/2k/XP+):

~^v::
Sleep, 200 ; Give some time for the text to be pasted.
clipboard = ; clear the clipboard
return

If I misunderstood your question, maybe you can clarify it with a specific example of an action+reaction you're trying to achieve.
Back to top
View user's profile Send private message Send e-mail
partack



Joined: 14 Aug 2004
Posts: 3

PostPosted: Sat Aug 14, 2004 12:43 pm    Post subject: Reply with quote

chris, you're awesome Very Happy snappy reply!

i know that Clipboard = ; clears the clipboard but i was confused with it.. for a while..
i was also having trouble getting it to paste a space to the clipboard too 'cos it wa sjsut saying {space} and leavign it blank jsut cleared the clipboard.. but i found the auto trim off thing.

BUT MAN, IT WORKED! you jsut own SO ...MUCH! Shocked

thank you Very Happy

by the way, i would donate some money to you but unfortunately i'm too young to own a credit card and i'm flat broke regardless =/ But you have my best wishes and gratitude. (also i will tell alot of people about your program.) thank you again!
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Sat Aug 14, 2004 1:04 pm    Post subject: Reply with quote

I'm glad it works.

Quote:
getting it to paste a space to the clipboard too 'cos it wa sjsut saying {space} and leavign it blank jsut cleared the clipboard.. but i found the auto trim off thing.

You can also use the built-in variable A_Space to include a literal space by itself, or at the beginning/end of a value:
clipboard = %a_space%
Back to top
View user's profile Send private message Send e-mail
Guest






PostPosted: Sat Aug 14, 2004 9:02 pm    Post subject: Reply with quote

i did actually try that, clipboard = %a_space% ;

but it didn't want to work for me.. maybe i did somehting wrong.. well, i'm still experiemnting.

it works now anyway.. i used

Code:

AutoTrim, Off
SPACE = %A_Space%

;makes a space--
!Space::clipboard = %clipboard% %SPACE%


if this isn't the correct way, oh well, it works and besides, using that veriable was good practice+experience. i learned something from it.

That piece of code you posted really helped me understand how to set out the code properly. Smile

i didn't know events could happen like that, well, i had a hunch that they might be able to but i didn't know how to do it Rolling Eyes

i have another question if you want to answer it but it isnt too inportant, i
i can deal with copying to the clipboard and then pressing ctrl+v .. but is there a way to paste after, pressing my hotkey and letting it copy to the clipboard? without using the send command.. (damn bot protector Confused ) ?

dont stress over it; as i said it's not too much of a problem.. it'd just be a novelty ;D

oh well, back to scripting.

Thanks again.
Back to top
partack



Joined: 14 Aug 2004
Posts: 3

PostPosted: Sat Aug 14, 2004 9:19 pm    Post subject: Reply with quote

oops.. that last post was me.. sorry, i didn't realise i wasn't logged in..
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Sun Aug 15, 2004 12:15 am    Post subject: Reply with quote

Ah, you're right, you must turn off AutoTrim to make it work. Your example can be simplified to this (though yours actually puts two spaces at the end since there is a literal space in between the two variables):

AutoTrim, Off
;makes a space--
!Space::clipboard = %clipboard% %A_Space%

Quote:
but is there a way to paste after, pressing my hotkey and letting it copy to the clipboard?

Since the target window ignores artificial keystrokes, your options are limited. Here are some other topics where this was discussed in the past:

"You might try using ControlSend, and if that fails, PostMessage. There are some examples on the forum about PostMessage, in addition to Rajat's tutorial about it. But chances are -- if the game is specifically designed to be resistant to automation -- these methods won't work either."

And some other topics with practical examples:
http://www.autohotkey.com/forum/viewtopic.php?t=506
http://www.autohotkey.com/forum/viewtopic.php?t=351
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help 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