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 

Paste blocking

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



Joined: 10 May 2008
Posts: 15

PostPosted: Thu May 15, 2008 6:50 pm    Post subject: Paste blocking Reply with quote

How can I make an edit box so that you can't past anything into it but you can edit it? Question

and Razz Embarassed Wink

How can I make a script do something if text is pasted into an edit field? Exclamation Question
Back to top
View user's profile Send private message
n-l-i-d
Guest





PostPosted: Thu May 15, 2008 7:03 pm    Post subject: Reply with quote

Crude: add Control+p and Shift+Insert as hotkeys to the script, and block the execution of the "Paste" if the Edit control is focussed.
Back to top
Autex675



Joined: 10 May 2008
Posts: 15

PostPosted: Thu May 15, 2008 10:53 pm    Post subject: Paste Blocking Reply with quote

How can I block the execution of paste if the control is focused?
Back to top
View user's profile Send private message
poo_noo



Joined: 08 Dec 2006
Posts: 137
Location: Sydney Australia

PostPosted: Thu May 15, 2008 11:23 pm    Post subject: Reply with quote

Maybe use ControlGetFocus and empty the clipboard when that control is in focus.

Code:
ControlGetFocus, OutputVar, Untitled - Notepad
if ErrorLevel
    return
else
    clipboard =


might work. I have not tested this though.
_________________
Paul O
Back to top
View user's profile Send private message Visit poster's website
Autex675



Joined: 10 May 2008
Posts: 15

PostPosted: Tue May 27, 2008 8:56 pm    Post subject: Paste Blocking Reply with quote

How can I do it without emptying the clipboard? Rolling Eyes Embarassed Wink
Back to top
View user's profile Send private message
engunneer



Joined: 30 Aug 2005
Posts: 6847
Location: Pacific Northwest, US

PostPosted: Tue May 27, 2008 8:59 pm    Post subject: Reply with quote

maybe you can find some way to detect the paste then undo it?

a built in function of an edit control is to allow paste. it's hard to remove. If you find some documentation on msdn, you may be able to apply it to making a custom control, or modifying the control in a custom way.
_________________
Unless otherwise noted, all code is untested.
Common Answers: 1.(Loops, Viruses, etc.) 2. Search 3.RTFM
Back to top
View user's profile Send private message Visit poster's website
[VxE]



Joined: 07 Oct 2006
Posts: 1494

PostPosted: Wed May 28, 2008 2:46 am    Post subject: Reply with quote

engunneer wrote:
maybe you can find some way to detect the paste then undo it?
one method to do this is to check the contents of the edit field (controlgettext) then, if the length of that string increases by more than, say 5, characters over a 50ms interval, then revert the field contents to what it was previously.
_________________
My Home Thread
More Common Answers: [1]. It's in the FAQ [2]. Ternary ( a ? b : c ) guide [3]. Post code inside [code][/code] tags !
Back to top
View user's profile Send private message
sinkfaze



Joined: 18 Mar 2008
Posts: 139

PostPosted: Wed May 28, 2008 3:22 am    Post subject: Re: Paste blocking Reply with quote

Autex675 wrote:
How can I make an edit box so that you can't past anything into it but you can edit it? Question

and Razz Embarassed Wink

How can I make a script do something if text is pasted into an edit field? Exclamation Question


The real question is are you working with a window with just one edit field that you would like to do this with, or one with multiple edit fields and you want the change to apply to just one of those edit fields?

And to address both questions, what program would you be using?
_________________
Have trouble searching the site for information? Try Quick Search for Autohotkey.
Back to top
View user's profile Send private message
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