Paste Clipboard Contents into STRING

Paste Clipboard Contents into STRING

TK.421
Advisor Advisor
1,075 Views
3 Replies
Message 1 of 4

Paste Clipboard Contents into STRING

TK.421
Advisor
Advisor

Is it possible to paste whatever text I've copied from somewhere else into a string? Something along the lines of:

STRING paste = CLIPBOARD PASTE
message info $paste

thanks in advance

david

<><


the numbers never lie
0 Likes
Accepted solutions (1)
1,076 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
Accepted solution

GetClip.mac:

FUNCTION MAIN() {
   STRING bat= macro_path(0)+"\getClip.bat"
   STRING file1= macro_path(0)+"\getClip.txt"
   STRING file2= macro_path(0)+"\getClip.OK"
   IF file_exists($file1) {
      DELETE FILE $file1
   }
   IF file_exists($file2) {
      DELETE FILE $file2
   }
   STRING cmd='powershell -command "Get-Clipboard" >"'+$file1+'"' +crlf+'ECHO OK >"'+$file2+'"'
   FILE OPEN $bat FOR WRITE AS "output"
   FILE WRITE $cmd TO "output"
   FILE CLOSE "output"
   OLE FILEACTION "OPEN" $bat
   WHILE NOT file_exists($file2) {
      INT I=0
   }
   STRING Clipboard=""
   FILE OPEN $file1 FOR READ AS "file1"
   FILE READ $Clipboard FROM "file1"
   FILE CLOSE "file1"
   DELETE FILE $file1
   DELETE FILE $file2
   print=$Clipboard
}

ToClip.mac: - for entity context menu - such as model

FUNCTION MAIN(STRING S ) {
STRING P= macro_path(0)+"\ToClip.bat"
STRING CLIP="ECHO | SET /P=" +$S+" | CLIP"
 FILE OPEN $P FOR WRITE AS "output"
      FILE WRITE $Clip TO "output"
      FILE CLOSE "output"
 OLE FILEACTION "OPEN" $P
}
Message 3 of 4

TK.421
Advisor
Advisor

that is wonderful, thank you so much!  it took me an hour to figure out i had to update powershell. works like a charm

 

david

<><


the numbers never lie
0 Likes
Message 4 of 4

TK.421
Advisor
Advisor

the finished product is attached of what I wanted to use the clipboard for. I,J,K values copied from another program

 

thanks again


the numbers never lie