Here’s a simple script that will remove a gap in an After Effects timeline. To use it, place the playhead in a gap — part of the timeline that has no active layers — and run the script. Layers that start after the gap get nudged up so that the gap disappears. That is all.
Download the jsx file below. It’s all open source, I’ll hoist it up on my github when I have a second.
After Effects will take care of the installation for you. In AE, go to the File menu and choose Scripts>Install Script. Point it at the unzipped .jsx file that you just downloaded and let it work its magic, then restart AE.
Running the script
Scripts without a GUI can be run from the File>Scripts> menu. Once the script is installed it should appear in this menu, or you can run it without installing it using File>Scripts>Run Script File.
Scripts with a GUI will appear in the Window menu in the list at the bottom, once they’ve been installed.