Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
The result of the paste command is incorrect
#1
The code below is an example. I use the Shift+Enter hotkey to paste the text from the editor into the desired location.

It works in Notepad, but it doesn't work in a text box in the chrome browser. It outputs the content of the clipboard instead.
I've tried writing the content from the editor to the clipboard first, and it always works. However, it overwrites the content in the clipboard.

Is there a better solution?

Thank you in advance for any suggestions and help.
David

Function Macro15
Trigger Aa     Help - how to add the trigger to the macro
Code:
Copy      Help
str dd=
;BEGIN DIALOG
;0 "" 0x90080AC8 0x0 0 0 224 136 "Dialog" "4"
;3 Edit 0x54231044 0x200 8 8 208 98 ""
;1 Button 0x54030001 0x4 116 116 48 14 "OK"
;2 Button 0x54030000 0x4 168 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040C02 "*" "" "" ""

str controls = "3"
str e3
e3=
;hello world
;hello
;world
if(!ShowDialog(dd &sub.DlgProc &controls)) ret

out e3 ;;OK

e3.setclip ;;it always works for paste. However, it overwrites the content in the clipboard.

paste e3 ;;use this line of code directly: in Notepad OK!  But in Chrome NO!

#sub DlgProc
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,DT_SetAccelerators(hDlg "401 SY")
,
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
,case [401]
,DT_Ok(hDlg)    
ret 1
#2
I cannot reproduce. If does not work only after a dialog, try to insert a delay before pasting, eg 0.5 s.
#3
I have encountered many similar situations, sometimes adding a delay works, sometimes it is ineffective.
[Image: a.gif]
#4
Probably 'paste' restores the old clipboard text too soon. Normally it waits until somebody gets the new temporary clipboard text, but other clipboard software can break it. If using a clipboard program, try to disable. Including the Windows "Clipboard history".

Or create a function that pastes and waits a fixed amount of time.
Function PasteSlow
Code:
Copy      Help
;/
function str'text

str old.getclip
text.setclip
key Cv
wait 0.5
old.setclip
#5
thank you!


Forum Jump:


Users browsing this thread: 1 Guest(s)