Plus 1 for a macro feature

Hi, I’m working on editing an animation created with FreeCAD. The source file is from a screen recording. When FreeCAD moves parts in the animation it does it in stages, each part is updated in serial fashion, so each animation frame comes only after all parts have updated (over a number of frames).

My current way of working is to identify the last part that gets updated; I move forward two frames and split (S) there. Then I go forward, watching each part get updated until that last part gets updated and I split there. Then I double click that section, which moves the play position to the start of that block and press (X) to ripple the rest of the track back to that point, skip two frames and split again.

My animation will end up with 720 (double) frames, so you can imagine how mind-numbing this process is. One thing that helped tremendously was to be able to zoom the preview window rather than squint at a tiny portion watching for a movement. But it would be great to scan through all the updates until my part is updated and then hit a key that would split the track there, go back to the previous split, delete the block, skip forward two frames and split again. That sounds like the kinda thing a macro could help with. Even better would be to use python for macros (and a whole lot more) like FreeCAD and a lot of other software does these days.

By the way, I love ShotCut, what an excellent piece of software. I have done some smooth animations with nice titling. Thank you so much.

1 Like

Hi @Prajna - Plus 1 for Plus1 macro feature! But before that may (or may not) happen sometime in the future, you could use AutoHotkey (windows only). To experiment, I concocted a script which I think does what you describe.
I also tested it out and made a short demo here:

Feel free to try it out! Here’s the script. Copy it, paste into notepad or similar, save with a .ahk extension, run AutoHotKey, load the script, open Shotcut - and the trigger key I specify is CTRL/1 to get it started (this can be changed in the script).

Script:

  SetKeyDelay, 400			   ; ^ =ctrl  +=shift  !=alt
  SetNumLockState , on
  
  
  
  
  ^1::
  send, s
  sleep, 200
  send, ^{left}
  sleep, 200
  send, ^{left}
  sleep, 200
  send, x
  sleep, 200
  send, !{left}
  sleep, 200
  send, {right 2}
  sleep, 200
  send, s
  return

Hope this helps!

2 Likes

Thanks. I’m on Linux but it’s a good idea, there will be an equivalent, I’m sure.

Ah, it turns out that one solution in Linux is AutoKey, which is also programmable in Python. I’ll give that a go.

This is the script that I use in AutoKey:

import time
keyboard.send_key("s")
time.sleep(0.5)
keyboard.send_keys("<ctrl>+<left>")
time.sleep(0.3)
keyboard.send_keys("<ctrl>+<left>")
time.sleep(0.3)
keyboard.send_key("x")
time.sleep(0.3)
keyboard.send_keys("<alt>+<left>")
time.sleep(0.3)
keyboard.send_key("<right>")
time.sleep(0.3)
keyboard.send_key("<right>")
time.sleep(0.3)
keyboard.send_key("s")
1 Like

OK. Does it work? Hope so!

1 Like

I thought it did but now it’s only sending the “s” key, so I’ve some debugging to do. The ctrl left and alt left in your script were very helpful. I didn’t know those keys. Thanks.

1 Like

Hi @Prajna No problem - glad to have helped. I had another idea, if that doesn’t work - you could try making some creative custom keyboard shortcuts within Shotcut (help>actions and shortcuts) - something like this:

On the numberpad:
Split = 1
Select previous clip = 2
Rilpple delete= 3
Select previous cut (called “skip previous”) = 4
Next frame = 5

Then you could press 1,2,2,3,4,5,5 each time, which would be much quicker than the way you did it previously.
I haven’t tested it myself but it might be worth a try?

1 Like

According to the docs my script should work. I’ll test it again and see if I can figure out why it’s misbehaving and maybe find a forum that can help. There are two versions of autokey, a gtk and a Qt one and I’m not sure which I should be using in Linux Mint, I went for the Qt version.

Anyway, just knowing the keys will make editing quicker. It’s a pity that apps don’t give a list of what shortcut keys are undefined, so you don’t accidentally clobber a shortcut that’s already defined.

1 Like

Fortunately the custom shortcut panel is brilliant in Shotcut (courtesy of @brian) - you can define 2 shortcuts for each action, thus keeping the original.

I posted about it here:
Keyboard shortcuts

1 Like

Hmm… I installed via the Mint App Store and it installed 22.01.30. I’d rather install a .deb rather than flatpak but can’t find a more up to date .deb than the one I have installed. Anyway, if I can get AutoKeys working that would be ideal, since then it is just one keypress. The shortcut panel looks great but really great would be to be able to assign a macro rather than just a key.

1 Like

Well, I’ve looked at AutoKey, XDOTool, and a few others but not found anything that is easy to set up and use. AutoKey, with my above script, should work but then any keyboard events it creates are marked as ‘synthetic’ X11 events and many apps ignore synthetic events, which is probably the case with Shotcut too. Oh well, at least I can use the keys, only 720 frames to extract!

1 Like

Well I did it!

2 Likes

Brilliant, @Prajna - looks great! Hope your fingers aren’t too sore with all that typing!! :wink: :rofl:

1 Like

It wasn’t my fingers so much, @jonray, it was my wrist. Took about three days working on it on and off.

1 Like

Well done! Glad you got it finished.

1 Like