Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

[Class] WinClip - direct clipboard manipulations


  • Please log in to reply
94 replies to this topic
huntsfromshadow
  • Members
  • 2 posts
  • Last active: Mar 29 2015 02:43 AM
  • Joined: 22 Mar 2015

Hello I'm trying to use winclip to write a script that does some rtf modification and having issues.

 

What I'm trying to do overall is the following.

1 - Take RTF formatted text in the clipboard and convert it to plain text with the formatting

2 - Modify the formatting codes (in the test case just moving where the bold ends)

3 - Send the text back to the clipboard and convert it back into rtf so it can be pasted back into a program like wordpad 

as rtf formatted text.

 

Steps 1 and 2 are working. Step 3 through is throwing an error with the SetRTF command. It is throwing a variable name contains an illegal character.

 

In the test below I already have the text with the rtf codes in the clipboard. the SetRTF is throwing the error.

^k::
wc.iSnap()
test := wc.GetText()
wc.SetRTF(%test%)
return

Any thoughts?



Jackie Sztuk _Blackholyman
  • Spam Officer
  • 3757 posts
  • Last active: Apr 03 2016 08:47 PM
  • Joined: 28 Feb 2012
Remove the %'s around the variable 'test'
Helping%20you%20learn%20autohotkey.jpg?d

[AHK] Version. 1.1+ [CLOUD] DropBox ; Copy [WEBSITE] Blog ; About

huntsfromshadow
  • Members
  • 2 posts
  • Last active: Mar 29 2015 02:43 AM
  • Joined: 22 Mar 2015

Thanks @Blackholyman that fixed the error. Still learning the scripting language.

 

But it is not converting the text back to rtf. If I do a paste after running the script

it is still pasting the string with the rtf codes rather than the formatted string.



okram
  • Members
  • 230 posts
  • Last active: Oct 15 2015 05:55 AM
  • Joined: 05 Oct 2012

I tried to use WinClip and PUM classes together. In a simple test below a hotkey Alt-X is used to paste an image. If a PUM definition is added to the script this causes a crash when the hotkey is called a second time. Tested on Win7 32bit.

 

Any idea what might be an issue?
 

#Include WinClipAPI.ahk
#Include WinClip.ahk
#Include PUM_API.ahk
#Include PUM.ahk

pm := new PUM()  ;causes a crash when Alt-X is called a second time
return

!x::
WinClip.Clear()
WinClip.SetBitmap("D:\data\image.jpg") ;change to your image
WinClip.Paste()
return


valuex
  • Members
  • 7 posts
  • Last active: Sep 17 2015 01:31 PM
  • Joined: 23 Aug 2013

After clipping a picture, how can I append text as a source comment to it directly?

 

Hello,

I was trying to take a screen snap and add the source title to the snapped picture.

Here is how I work:

$PrintScreen::
WinGetTitle, acTitle, A ; get the window title

Run, ..\QQimage2012.exe   ; screenshot of this software's interface is attached below
process, waitclose, QQimage2012.exe     ; waiting for picture-snapping and marking operations to complete
; the RIGHT mark at the right-down-corner will save the snapped content to clipboard

; how to append window title to clipboard??
;  

return

How can I append window title to the clipboard  directly after pic-snapping completes, instead of having to save the clipped pic to local disk and then append it to a html snippet and then to append it to the clipboard?

 

 

Interface of the screencapture software:

2(25).jpg