Jump to content

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

v1.0.29 released: Save and restore the entire clipboard


  • This topic is locked This topic is locked
36 replies to this topic
Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
Here are the changes for v1.0.29:

Fixed things like "Sleep %Seconds%000", which stopped working in v1.0.25+. [thanks Mayhem]

Fixed the Input command to correctly capture uppercase and control characters when not in "visible" mode.

Fixed key-up hotkeys to work on the neutral keys Control, Shift, and Alt. [thanks jonny]

Changed compiled scripts to always have their .exe file extension at the end of their names for the purpose of A_ScriptFullPath and default window titles. This also allows #SingleInstance to work even when the script is launched from the command line without its extension. [thanks Mythos]

Improved ClipWait to optionally wait for any data rather than just text and files.

An expression can be used in a parameter that does not directly support it by preceding it with a percent sign and a space or tab. This is most commonly used to access arrays [thanks JSLover]. Examples:
FileAppend, % MyArray%i%, My File.txt
MsgBox % "The variable MyVar contains " MyVar "."
Control, Choose, % CurrentSelection - 1

Added built-in variable A_MSec, which is the current time's millisecond. [thanks JSLover]

Added built-in variable ClipboardAll, which contains all data on the clipboard (such as pictures and formatting). This can be used to save and restore the clipboard to memory or a file as in these examples:
ClipSaved = %ClipboardAll%
Clipboard = %ClipSaved% ; Done at a later time to restore the original contents.
FileAppend, %ClipboardAll%, C:\Saved clipboard.bin ; Write the entire clipboard to a file.
FileRead, Clipboard, *c C:\Saved clipboard.bin ; Restore from a file via the *c option.

http://www.autohotkey.com/download/

Rajat
  • Members
  • 1904 posts
  • Last active: Jul 17 2015 07:45 AM
  • Joined: 28 Mar 2004
ClipboardAll is great addition!
is it now somehow possible to take screenshots with ahk? ... like sending {PRINTSCREEN} and saving CipboardAll as bmp or something?

MIA

CleanNews.in : Bite sized latest news headlines from India with zero bloat


Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
No, but you could save a bunch of clipboards and then later have a script go through them all convert them as BMP (by loading them on the clipboard, pasting them into an image program, and then saving).

Since clipboard files with saved images in them are usually raw DIB files with a few bytes extra at the beginning and end of the file, it might be possible to convert them directly somehow (with a utility or custom program). Unfortunately, converting a BMP on the clipboard into a BMP file on disk requires several steps and I haven't found a definitive answer on the best way to do it (someone knowledgeable could have a draft of it done in about 10 minutes).

Anyway, it is still planned to support BMP<->clipboard manipulation in a future version.

JSLover
  • Members
  • 920 posts
  • Last active: Nov 02 2012 09:54 PM
  • Joined: 20 Dec 2004

Anyway, it is still planned to support BMP<->clipboard manipulation in a future version.

...not to throw more on your plate, but how about PNG in addition to BMP? I use ScreenShotAssistant (sourceforge.net) (website {supposedly} coming soon, till then use the sourceforge project page) for my screen shots. I can't find info on it, but it says it uses JansGraphics.dll (from jansfreeware.com), which creates great, small pngs, smaller than what MS Paint puts out everytime (when pasting the clipboard & saving as png)...since everything involved is freeware (& at least SSA is open source {I don't know about the dll}), you might be able to scrape it into AHK. Aha! Google works wonders...I searched for "JansGraphics.dll" & it asked me if I meant "JanGraphics.dll", clicking that, led me to...Jans Freeware COM Objects...evidently the author of SSA made a typo in the About box (adding an s to the filename {but really, it sounds better with the s}). Searching my computer (for the corrected name) found it in C:\Windows\system32\janGraphics.dll. I wrote a helper script for SSA, which I'm gonna post in the Scripts forum later.

I've been meaning to ask you...why were there 14 sub-versions of 1.0.25 but only 1 each for 1.0.26, 1.0.27 & 1.0.28? What constitutes a "big" version change over a "small"?

Thanks for 1.0.29...I'm gonna install it soon...but have you decided on changing the help file background color to white? Currently I have de-compiled the help file & re-compiled with my changes, but I don't wanna have to do it for every version (but my version also restores the blue bars along with the background color).
Useful forum links: New content since: Last visitPast weekPast 2 weeks (links will show YOUR posts, not mine)

OMFG, the AutoHotkey forum is IP.board now (yuck!)...I may not be able to continue coming here (& I love AutoHotkey)...I liked phpBB, but not this...ugh...

Note...
I may not reply to any topics (specifically ones I was previously involved in), mostly cuz I can't find the ones I replied to, to continue helping, but also just cuz I can't stand the new forum...phpBB was soo perfect. This is 100% the opposite of "perfect".

I also semi-plan to start my own, phpBB-based AutoHotkey forum (or take over the old one, if he'll let me)
PM me if you're interested in a new phpBB-based forum (I need to know if anyone would use it)
How (or why) did they create the Neil Armstrong memorial site (neilarmstronginfo.com) BEFORE he died?

Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004

...not to throw more on your plate, but how about PNG in addition to BMP?

As far as I know, you can't put PNG files directly only the clipboard, at least not in a neutral format understood by any application. Instead, PNGs are first converted to BMP or DIB and then put on the clipboard.

If you use a particular application that is able to copy & paste PNG images within its own windows, that can be automated by saving a clipboard using FileAppend, ClipboardAll, PNG Ready To Paste.clip and then loading it again later with FileRead, Clipboard, *c PNG Ready To Paste.clip

since everything involved is freeware (& at least SSA is open source {I don't know about the dll}), you might be able to scrape it into AHK.

Since AutoHotkey is designed to be tightly integrated (not requiring any registry entries nor any DLLs), I don't think this would be worth it unless there was some huge benefit.

I've been meaning to ask you...why were there 14 sub-versions of 1.0.25 but only 1 each for 1.0.26, 1.0.27 & 1.0.28? What constitutes a "big" version change over a "small"?

Releases that lack any major new features tend to be minor releases.

have you decided on changing the help file background color to white?

I don't see a significant benefit to forcing white, and keeping it the way it is allows anyone to select a custom background color. For example, if you visit http://www.yahoo.com with MSIE, your custom background color should be in effect there too. Contrary opinions are welcome.

SanskritFritz
  • Members
  • 280 posts
  • Last active: Jan 09 2013 02:15 PM
  • Joined: 17 Feb 2005

Since clipboard files with saved images in them are usually raw DIB files with a few bytes extra at the beginning and end of the file, it might be possible to convert them directly somehow (with a utility or custom program). Unfortunately, converting a BMP on the clipboard into a BMP file on disk requires several steps and I haven't found a definitive answer on the best way to do it (someone knowledgeable could have a draft of it done in about 10 minutes).

You can find ideas in CLCL-s source code, it converts clipboard data rendered as CF_BITMAP on the fly in its viewer.
Is there another word for synonym?

BoBo
  • Guests
  • Last active:
  • Joined: --
I guess, ClipboardAll includes the option to push the clipboards content directly to StdOut means a DOS Box. Am I correct here ?

jonny
  • Members
  • 2951 posts
  • Last active: Feb 24 2008 04:22 AM
  • Joined: 13 Nov 2004
FileAppend,%clipboardall%,*
return

Only works if you pipe it to pipesplit or mtee, though, like so:

C:\AutoHotkey\AutoHotkey.exe C:\Test.ahk | pipesplit.exe nul

toralf
  • Moderators
  • 4035 posts
  • Last active: Aug 20 2014 04:23 PM
  • Joined: 31 Jan 2005
@Chris

Thanks for the new version.
But before I start testing, I already have a question.

Imagine you have a list of items and each item has properties
And you seach for a certain property in that list of items.
What I currently do is:
SplitString,Array,ListOfItems, `,
;eliminate spaces
Property := Array4
If (Property = "abc")
      MsgBox, Found
Because this doesn't work:
SplitString,Array,ListOfItems, `,
If (Array4 = "abc")
  MsgBox, Found
It doens't work, because Array4 may have trailing spaces. And therefore doesn't contain "abc" but "abc ".

The same I do in loops:
SplitString,Array,ListOfItems, `,
Loop, %Array0%
  {
    ;eliminate spaces
    Property := Array%A_Index%
    If (Property = "abc")
      {
         MsgBox, Found
         break
      }
  }

Would this work now:
SplitString,Array,ListOfItems, `,
Loop, %Array0%
  {
    ;does the "%" eliminate spaces ?????????
    If ( % Array%A_Index% = "abc")
      {
         MsgBox, Found
         break
      }
  }
Would the % eliminate the spaces (like with AutoTrim)?
Ciao
toralf
 
I use the latest AHK version (1.1.15+)
Please ask questions in forum on ahkscript.org. Why?
For online reference please use these Docs.

Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004

You can find ideas in CLCL-s source code, it converts clipboard data rendered as CF_BITMAP on the fly in its viewer.

Thanks, that should help.

I guess, ClipboardAll includes the option to push the clipboards content directly to StdOut means a DOS Box.

No, that isn't currently supported because I hadn't thought of it. I'm not even sure if it would work since I don't know for sure if cmd.exe is capable of piping binary data without corrupting it (I've never piped or redirected anything other than plain text).

Property := Array%A_Index%

The above won't trim spaces because the := operator does not obey AutoTrim. I think the only way to get AutoTrim into effect for something like this is:
Property := Array%A_Index%
Property = %Property%

Someday, there should be an easier way such as:
If (Trim(Array%A_Index%) = "abc")

JSLover
  • Members
  • 920 posts
  • Last active: Nov 02 2012 09:54 PM
  • Joined: 20 Dec 2004

As far as I know, you can't put PNG files directly only the clipboard, at least not in a neutral format understood by any application.

...I guess I might've quoted the wrong part of your post, I wasn't meaning to put a png on the clipboard (I don't care what format it is on the clipboard), but you mentioned bmp->disk...

(by loading them on the clipboard, pasting them into an image program, and then saving).

...

Unfortunately, converting a BMP on the clipboard into a BMP file on disk

...so I was really on the bmp->disk track & not on the bmp->clipboard track...so what I meant was, if you get bmp->disk support, can you also support png->disk?...or really that means CB->disk as bmp & CB->disk as png.

If you use a particular application that is able to copy & paste PNG images within its own windows

...no, SSA watches the clipboard for images (normally put there by pressing Print Screen) & writes them to disk using settings you gave it beforehand (what dir, what filename prefix, what format).

Since AutoHotkey is designed to be tightly integrated (not requiring any registry entries nor any DLLs), I don't think this would be worth it unless there was some huge benefit.

...can't you support a command that links into a dll, but if the person don't have the dll, that command just don't work? It won't need to require the dll (for all scripts), it can just ignore that command (or give an error) if someone tries to use it without having the dll. The only other option is to write your own image routines, which would increase the size of all scripts & perhaps not have as good of file sizes (on png's). I think certain commands using external dlls, isn't a bad thing...cuz (it don't increase every .exe's file size &) you can put in the help file "use of this command requires this dll on the target computer". I'm sure other AHKers are on track with the no-dll thing, but as long as the dll is only required *if* a script *uses* that command, I think it's ok. Poll anyone?: Should a few ahk commands be allowed to link into external dlls?...almost the same as using an external .exe (BoBo), but this image writing thing is a dll & not an exe, so I can't use it that way.

I don't see a significant benefit to forcing white

...would it be too much to ask you to compile a 2nd help file with white?...read on before you say "Yes (it would it be too much to ask)". You could (write an ahk script to), compile normally, rename "default.css" to "default-hold.css", rename "default-white.css" to "default.css", recompile & then rename both back, this way you only rename a file & recompile & don't need to re-configure the help compiler (to use one css the 1st time & another the 2nd time) (unless having 2 help projects is easier than renaming???). If not that, could you provide your .hpj? Cuz when I de-compiled it before that was the one file it didn't give me & I had to guess at until I got it configured like you have it (with the buttons & help window names).

and keeping it the way it is allows anyone to select a custom background color.

...it doesn't let me choose an AHK background color, it makes me change my browser default to accommodate one page. This don't help the compiled help file, but on the web, you can provide an "alternate style" & I can pick it in the browser, cuz the online help still looks like crap & I can't fix that. Actually, I'm not sure how persistent "alternate style"s are, if I need to re-pick the alternate style on every visit or if the browser remembers it, if you test that & it's not persistent, would you mind if I code some cookies to remember a user bgcolor (that you put on the help pages)?

For example, if you visit http://www.yahoo.com with MSIE, your custom background color should be in effect there too. Contrary opinions are welcome.

...yes, alot of sites have not specified a background color (& look like crap), but I don't think most of them do it to "use your custom background color" I think they do it, cuz in their IE, when they test it, white is default, so they think everyone else's is white too & don't even think about setting it.

...this board specifies colors for everything...& looks good...

Why is the new variable called ClipboardAll & not ClipboardRaw (All what?)? Why do most operations have to be on a "saved" version of it & not directly on ClipboardAll?
Useful forum links: New content since: Last visitPast weekPast 2 weeks (links will show YOUR posts, not mine)

OMFG, the AutoHotkey forum is IP.board now (yuck!)...I may not be able to continue coming here (& I love AutoHotkey)...I liked phpBB, but not this...ugh...

Note...
I may not reply to any topics (specifically ones I was previously involved in), mostly cuz I can't find the ones I replied to, to continue helping, but also just cuz I can't stand the new forum...phpBB was soo perfect. This is 100% the opposite of "perfect".

I also semi-plan to start my own, phpBB-based AutoHotkey forum (or take over the old one, if he'll let me)
PM me if you're interested in a new phpBB-based forum (I need to know if anyone would use it)
How (or why) did they create the Neil Armstrong memorial site (neilarmstronginfo.com) BEFORE he died?

royscott
  • Members
  • 27 posts
  • Last active: Nov 01 2009 01:01 PM
  • Joined: 22 Nov 2004
While it is very nice to have a language developer that is responsive to the perceived needs and suggestions of the users, his primary job is to provide us with a good, solid, usable language that meets the needs of the majority of the application developers using it. Our job as programmers is to take the commands and functions provided and make them do the job we need to do. I have found that Chris and AutoHotKey fulfill this requirement in an exemplary fashion. Sometimes as programmers we get a little impatient with the progress of our favorite language. From what I can see, this one is progressing very nicely. Many new things are in process and any bugs or glitches are addressed in a very timely fashion. Hang in there and I am sure that the issues you have addressed will come to pass as we and the language grow together.

BoBo
  • Guests
  • Last active:
  • Joined: --

Why is the new variable called ClipboardAll & not ClipboardRaw ?

Cause Chris is entitled to do it.

Btw. have your parents asked you if you're fine with your name (right in the moment they gave it to you) ?
If yes, what was your answer ?
Guess something like: "buaaahhh-gnanggnga-bblblbbl-burbs" :wink:
So what ? 8)

jonny
  • Members
  • 2951 posts
  • Last active: Feb 24 2008 04:22 AM
  • Joined: 13 Nov 2004
Either All or Raw is fine with me. I think it's young enough to still be open to change. Raw seems to be the one preferred by the AutoIt3 community for such variables/arrays, so I guess that's the one I'd lean towards. Anyone whose script it would break has to be keeping up with the development or they wouldn't have put it in by now, so I think it's safe to change.

  • Guests
  • Last active:
  • Joined: --

Why is the new variable called ClipboardAll & not ClipboardRaw ?

Cause Chris is entitled to do it.

Btw. have your parents asked you if you're fine with your name (right in the moment they gave it to you) ?
If yes, what was your answer ?
Guess something like: "buaaahhh-gnanggnga-bblblbbl-burbs" :wink:
So what ? 8)


My parents called me "the boy" until I was nine. Then they called me Bob O. I just accepted it... :(

Yes, it's a sad story...