======================= INFORMATION OR SOMETHING ===============================
Timeline Merger for Flash
Version: 0.0.5 SNAPSHOT

Uses the JNativeHook and the JNA libraries

JNativeHook Licenses
GPL 3.0     LGPL 3.0

JNA Licenses
Apache 2.0  LGPL 2.1

================================== DISCLAIMER ==================================


============================= HOW TO USE =======================================

  - This is a Symbol of some kind. There's no range control, it will try to merge EVERYTHING.
  - Expects only regular frames. Not Tweens, masks, guides, etc.
  - All layers to be merged are visible. It will not scroll up or down to find new layers.
  - Tries to define an area around as many consecutive layers as possible. 
  - The bottommost consecutive layer will be the destination.
  - Flash actually needs to be visible.
  - Nothing in front of the timeline.

1. Start program.
2. Scroll timeline all the way to the left.
3. Resize timeline to show all the layers you want to merge.
     You can put a folder above and below them, etc.
     Folders let you wall off layers you don't want to copy.
4. Click the upper left most frame and leave the mouse there. Let go of the mouse.
5. Press your hotkey button.
6. Wait wait wait.
7. If everything is in order, you can delete the original layers manually.

  - If horrible things are happening, first try hitting the hotkey again.
  - If that doesn't work, quickly moving the mouse out of the timeline will also signal it to stop.
      However, it will keep sending commands until it realized the mouse has left the building.
  - If it was launched via bat file, you can use Ctrl+C (or it will!) on that window.
  - First things first, try it one more time. It might have just been a fluke.
  - If it seems that things aren't happening at the right time (like the shift key wasnt released before the next mouse down)
      Try increasing the delay times. Defaults are below, but are changeable as needed. My tests were nowhere near comprehensive.
      Maybe using OBS means you need longer delays? Maybe more complex frames take a little longer to copy?
  - If it seems like it's not calculating something correctly (thinks the timeline only has 2 frames, indexArrayOutOfBounds)
      Try tweaking the width of the timeline itself. Try to make sure the scrubber line is visible when placed on the very last visible frame slot
      When moving the mouse, it will try to line up with where the scrubber line would be, and can walk right off the end if the size is just perfectly wrong.
  - I had a bug once where it seemed like having the toolbar on the right was messing with my calculations, but I couldn't reproduce it whenever I wanted to.
      If you can reproduce this one on command, tell me how you did it. My bet is that it's a variant of the timeline width quirk above.
============================= LAUNCH ARGUMENTS =================================
                arguments are in the format of key=value

KEY           DEFAULT     OPTIONS               DESCRIPTION
key           insert      any single key?       hotkey to start / stop the merge process
method        layer       [layer, all]          method to use for merging. 
                                                  "layer" will copy/paste each layer one at a time.
                                                    it's slower, but doesn't wander outside of consecutive layers.
                                                    it will probably also burn up all your undos.
                                                  "all" will use ctrl+a to do the merge.
                                                    it's a lot faster, but it will copy anything in an unlocked layer.
                                                    make sure to lock everything you dont want to be affected.
short-delay   10          any positive integer  delay in ms between modifier presses (like ctrl and shift)
med-delay     20          any positive integer  delay in ms between press and subsequent release
long-delay    50          any positive integer  delay in ms after a full command (such as the full copy, paste)
source        flash       [flash, screen]       the initial screenshot for gathering information about the flash timeline
                                                  if set to "flash", the program will look for an open window whose title bar matches the regex
                                                    if it cannot find a matching flash window, it will fall back on the screen method
                                                  if set to "screen", the program will just take a screenshot of everything instead.
monitor       null        any positive integer  the screen number to take a screenshot of.
                                                  if set to null, the whole screen is used.
                                                  indexed from 1 .. (number of screens that you have)
                                                  on windows 7, you can use right click > screen resolution to see the numbering of your monitors.
regex-file    regex.txt   any valid filename    the file to load the title bar regex from.
                                                  an invalid file will result in the default regex being used.
status-file   null        any valid filename    the file to write the current simple status to.                                                  

==================================== REGEX =====================================

The program tries to locate flash through it's title bar.
An alternative regex can be specified in the regex.txt file.
It will try to match the entire title bar against the regex.

If the source is set to screen, the regex file won't be loaded.
Only the first line of the file will be used. You can store multiple regexes in the file and just put the one you want on top.

==================================== STATUS ====================================

The status of the program can be written to a specified file.
Status file uses simple key=value format.
Status is written when the program starts and ends, and retains information from the previous run.

running   true              program is running.
          false             program is not running.
killed    true              program was killed and did probably did not complete
          false             program was not killed.
reason    null              program was not killed
          mouse_out         program was killed because the mouse left the timeline aren
          killed_by_hotkey  program was killed because the hotkey was hit again
          exception         program was killed due to some other exception (check the output)

================================= KNOWN BUGS ===================================
 - Seems to copy the first frame twice. Honestly, very low priority.
 - Exceptions if the timeline is sized just wrong. Don't know quite how to compensate for that.

================================= OTHER NOTES ==================================
I recommend keeping multiple bat files with different launch arguments ready to go.
The delay times are about as fast as I could get them to reliably run. Feel free to play with them, but SAVE FIRST!!!
It uses the colors of specific pixels to determine what it's looking at. It will need to be updated to support different colorsets.
It expects the frames to be the normal size in CS4. If sizes are different across versions, iIt will need to be patched.

It really bothers me that the scrubber can be completely hidden off the righthand side of the timeline BEFORE the timeline advances to the next page.

I don't want to be responsible if a bug in my code destroys hours of your work. SAVE SAVE SAVE SAVE SAVE

Oh, and did I mentionSAAAAAAAAAAAAAAAAAVE????