| View previous topic :: View next topic |
| Author |
Message |
Autex675
Joined: 10 May 2008 Posts: 15
|
Posted: Thu May 15, 2008 6:50 pm Post subject: Paste blocking |
|
|
How can I make an edit box so that you can't past anything into it but you can edit it?
and
How can I make a script do something if text is pasted into an edit field?  |
|
| Back to top |
|
 |
n-l-i-d Guest
|
Posted: Thu May 15, 2008 7:03 pm Post subject: |
|
|
| 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
|
Posted: Thu May 15, 2008 10:53 pm Post subject: Paste Blocking |
|
|
| How can I block the execution of paste if the control is focused? |
|
| Back to top |
|
 |
poo_noo
Joined: 08 Dec 2006 Posts: 137 Location: Sydney Australia
|
Posted: Thu May 15, 2008 11:23 pm Post subject: |
|
|
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 |
|
 |
Autex675
Joined: 10 May 2008 Posts: 15
|
Posted: Tue May 27, 2008 8:56 pm Post subject: Paste Blocking |
|
|
How can I do it without emptying the clipboard?  |
|
| Back to top |
|
 |
engunneer
Joined: 30 Aug 2005 Posts: 6847 Location: Pacific Northwest, US
|
Posted: Tue May 27, 2008 8:59 pm Post subject: |
|
|
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 |
|
 |
[VxE]
Joined: 07 Oct 2006 Posts: 1494
|
Posted: Wed May 28, 2008 2:46 am Post subject: |
|
|
| 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 |
|
 |
sinkfaze
Joined: 18 Mar 2008 Posts: 139
|
Posted: Wed May 28, 2008 3:22 am Post subject: Re: Paste blocking |
|
|
| Autex675 wrote: | How can I make an edit box so that you can't past anything into it but you can edit it?
and
How can I make a script do something if text is pasted into an edit field?  |
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 |
|
 |
|