AutoHotkey Community

It is currently May 27th, 2012, 1:04 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 66 posts ]  Go to page Previous  1, 2, 3, 4, 5  Next
Author Message
 Post subject:
PostPosted: December 20th, 2011, 6:01 pm 
Offline

Joined: December 4th, 2011, 7:09 am
Posts: 25
Deo wrote:
well, if GetOpenClipboardWindow() returned anything != 0, the tooltip will be shown 100%, it can't be any rarely


It works rarely for me, that's all I can say. Would it perform more predictably if it were to call OpenClipboard() before GetOpenClipboardWindow() (and of course CloseClipboard() later)?

Deo wrote:
it would be nice if you can describe any way to reproduce your problem on practice with code example


I'm working on getting a reproducible example but the problem is too intermittent. That AHK tends to need kludging with Sleep, which optimal duration varies widely, is a fundamental issue or limitation.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: HTML Format
PostPosted: January 22nd, 2012, 6:12 pm 
Offline

Joined: January 22nd, 2012, 6:10 pm
Posts: 5
Any chance you could add the ability to put HTML formatted text on the clipboard?


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Re: HTML Format
PostPosted: January 31st, 2012, 3:33 pm 
Offline

Joined: May 16th, 2010, 2:38 pm
Posts: 185
class has been updated, check the first post for info

mparsons wrote:
Any chance you could add the ability to put HTML formatted text on the clipboard?

done in the last update

_________________
Crypt|QMsgBox|PUM|Quick Cliq|WinClipboard


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 7th, 2012, 5:33 pm 
Offline

Joined: February 7th, 2012, 3:32 pm
Posts: 7
Location: Straight up
How about retreiving the rtf in the clipboard BTW thanks for the html


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 7th, 2012, 6:42 pm 
Offline

Joined: May 16th, 2010, 2:38 pm
Posts: 185
MiddleFinger wrote:
How about retreiving the rtf in the clipboard BTW thanks for the html

done :)
Quote:
Update 7/02/2012
Added following methods to retrieve or set RTF format:
GetRTF(),iGetRTF
SetRTF( text ),iSetRTF( text )

_________________
Crypt|QMsgBox|PUM|Quick Cliq|WinClipboard


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 8th, 2012, 5:53 am 
Offline

Joined: February 7th, 2012, 3:32 pm
Posts: 7
Location: Straight up
Very nice thanks a heap


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 8th, 2012, 11:20 am 
@Deo: WinClip() looks interesting. I note you can save a clipboard to a file already, but how about storing it in other formats say base64 or other text format, see my post here http://www.autohotkey.com/forum/post-510440.html#510440
the idea would be to allow one to store the clipboard history in a/one plain text file rather than individual binary clipboard files. It would also make storing clipboard data in a psuedo database (say xml or csv) possible which is what I'm after eventually.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 8th, 2012, 6:59 pm 
Offline

Joined: May 16th, 2010, 2:38 pm
Posts: 185
hi
sure, you can do whatever you want with binary data you get from
Code:
dataSize := WinClip.Snap( data )

or, in case of instantiated WinClip object
Code:
wc := new WinClip
wc.iSnap()
dataSize := wc.iGetData( Data )

for example, you can convert this into transportable hash, like this
Code:
hash := ByteToHash( data, dataSize )

ByteToHash(ByRef pbData,dwLen)
{
   if (dwLen < 1)
      return 0
   if pbData is integer
      ptr := pbData
   else
      ptr := &pbData
   SetFormat,integer,Hex
   loop,%dwLen%
   {
      num := numget(ptr+0,A_index-1,"UChar")
      hash .= substr((num >> 4),0) . substr((num & 0xf),0)
   }
   SetFormat,integer,D
   return hash
}

to convert it back, you can use this function
Code:
HashToByte(sHash,ByRef ByteBuf)
{
   if (sHash == "" || RegExMatch(sHash,"[^\dABCDEF]") || mod(StrLen(sHash),2))
      return 0
   BufLen := StrLen(sHash)/2
   VarSetCapacity(ByteBuf,BufLen,0)
   loop,%BufLen%
   {
      num1 := (p := "0x" . SubStr(sHash,(A_Index-1)*2+1,1)) << 4
      num2 := "0x" . SubStr(sHash,(A_Index-1)*2+2,1)
      num := num1 | num2
      NumPut(num,ByteBuf,A_Index-1,"UChar")
   }
   return BufLen
}

_________________
Crypt|QMsgBox|PUM|Quick Cliq|WinClipboard


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 9th, 2012, 1:18 pm 
Offline

Joined: May 16th, 2010, 2:38 pm
Posts: 185
to encode bytes to base64, use this functions:
Code:
b64Encode( ByRef buf, bufLen )
{
   DllCall( "crypt32\CryptBinaryToStringA", "ptr", &buf, "UInt", bufLen, "Uint", 1, "Ptr", 0, "UInt*", outLen )
   VarSetCapacity( outBuf, outLen, 0 )
   DllCall( "crypt32\CryptBinaryToStringA", "ptr", &buf, "UInt", bufLen, "Uint", 1, "Ptr", &outBuf, "UInt*", outLen )
   return strget( &outBuf, outLen, "CP0" )
}

b64Decode( b64str, ByRef outBuf )
{
   DllCall( "crypt32\CryptStringToBinaryW", "ptr", &b64str, "UInt", 0, "Uint", 1, "Ptr", 0, "UInt*", outLen, "ptr", 0, "ptr", 0 )
   VarSetCapacity( outBuf, outLen, 0 )
   DllCall( "crypt32\CryptStringToBinaryW", "ptr", &b64str, "UInt", 0, "Uint", 1, "Ptr", &outBuf, "UInt*", outLen, "ptr", 0, "ptr", 0 )
   return outLen
}

for example:
Code:
dataSize := WinClip.Snap( data )
b64string := b64Encode( data, dataSize  )

to put data back to clipboard:
Code:
b64Decode( b64string, clipBuf )
WinClip.Restore( clipBuf )

_________________
Crypt|QMsgBox|PUM|Quick Cliq|WinClipboard


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 9th, 2012, 1:31 pm 
Thanks Deo, you're the AHK Clipboard Master! :D
I'll start experimenting over the weekend...


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 9th, 2012, 1:39 pm 
Offline

Joined: May 16th, 2010, 2:38 pm
Posts: 185
lol, thanks!

_________________
Crypt|QMsgBox|PUM|Quick Cliq|WinClipboard


Report this post
Top
 Profile  
Reply with quote  
PostPosted: February 11th, 2012, 1:43 am 
Offline

Joined: February 10th, 2012, 6:00 am
Posts: 3
I have made a GUI that always displays what is in my clipboard.
Now I looking to expand some capibilities.
I am thinking this is possible something that could be very useful!

Have you thought about displaying or making available the inner clipboard.
Maybe the command / method is there and I don't see it. :)

Sure you would be able to send the inner to the clipboard and it would show, but why not make it so that you could see, 'Preview' the inner?

Usually I am a lurker. So if I did this incorrect forgive me.

Example
Code:
iSnap() ;Copies the clipboard to innerclipboard
;other work here
;other work here
;other work here
;hmmm I don't remember what is in the innerclipboard.
Msgbox, %iDisplay() ;Display what is in the innerclipboard
ipaste() ;oh yes this is what I want paste it.
I am liking what I see so far :o


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 11th, 2012, 4:02 am 
Offline

Joined: May 16th, 2010, 2:38 pm
Posts: 185
hi
if under "display" you mean any data, you may get it through different "iGet*" methods like
iGetText
iGetFiles
iGetHTML
iGetRTF
iGetBitmap
Or
iGetFormats to get all formats available
or, if you need to know that specified format presented on clipboard
iHasFormat

iHasFormat accept any integer or string format. You can see standard formats values at the bottom of WinClip.ahk :)

_________________
Crypt|QMsgBox|PUM|Quick Cliq|WinClipboard


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 11th, 2012, 5:04 am 
Offline

Joined: February 10th, 2012, 6:00 am
Posts: 3
ok I see now.
Kind of like this

Code:
#Include WinClipAPI.ahk
#Include WinClip.ahk
;wc := new WinClip
wc1:=new WinClip
wc2:=new WinClip

f1::
wc1.iCopy()
gosub, update
return

f2::
wc2:=new WinClip
wc2.iCopy()
gosub, update
return

f3::
wc1.iPaste()
gosub, update
return

F4::
wc2.iPaste()
gosub, update
return

update:
Gui, Destroy
preview1 := wc1.iGetText()
preview2 := wc2.iGetText()
Gui, add , text, ,1: %preview1%
Gui, add, text, , 2: %preview2%
gui, show, , preview
return

[Edit]
Great!

Now I just need a better understanding of Arrays..........
Thank you

PS The documentation regarding the formats is really good. At least for me.
I think I am going to sticking to CF_OEMTEXT. This is a great feature.
Thank you. Again


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 12th, 2012, 8:41 pm 
Deo wrote:
to encode bytes to base64, use this functions
@Deo: Thanks man, it really works well!


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 66 posts ]  Go to page Previous  1, 2, 3, 4, 5  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 3 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group