Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Hide Notepad but keeping it activated for text input
#4
Better not to hide the window incase something goes wrong . if function/macro errors window will remain hidden .Use minimize and restore instead
here is a quick example of getting clipboard text and transferring it to notepad
this function will run in the background and transfer text copied from the clipboard to notepad window.

Function CopyClipboardToNotepadExample
Code:
Copy      Help
int w=win("" "Notepad")
int c=id(15 w) ;;editable text 'Text Editor'
min w;; minimize notepad window
str s ss
spe -2
rep
,0.3
,ifk(`)
,,break;; break loop when the key ` is pressed
,ss.getclip;; get clipboard
,if ss.len;; if clipboard is not empty
,,s.getwintext(c);; get notepad text
,,if s.len;; if notepad text is not empty do the following
,,,,_s.from("[]" ss);;add new text to existing text
,,,,_s.setwintext(c);; put clipboard text into notepad
,,,,ss.fix(0);;  empty string ss
,,,,ss.setclip;; empty clipboard
,,else
,,,ss.setwintext(c);; put clipboard text into notepad
,,,ss.fix(0);;set string ss length to zero so can empty clipboard
,,,ss.setclip;; empty the clipboard
;; run subfunction when the loop is broken
sub.finished

#sub finished
function w
res w;; show notepad window
;act w;; if desired uncomment
;;     function ends now


Messages In This Thread
RE: Hide Notepad but keeping it activated for text input - by Kevin - 09-01-2018, 07:14 PM

Forum Jump:


Users browsing this thread: 4 Guest(s)