Skip to content

Adobe Functions

Tomshi edited this page May 25, 2024 · 37 revisions

A list of Adobe function definitions, complete with examples.

All adobe functions are contained within classes respective to their programs and are called like: prem.func(), ae.func(), ps.func()

My scripts are heavily reliant on using specific versions of the adobe suite and I cannot guarantee their success using untested versions. The compatible versions can be found by looking within the ..\Support Files\ImageSearch\ folder for each program. ie in ..\Support Files\ImageSearch\Premiere\ you'll see v22.3.1 - that's a supported version (although versions other than the one I currently use cannot be guaranteed to behave exactly as expected. To see which version I test my scripts on, check the top of the individual class file).
If you have (complete) images for another version (and it doesn't require any code changes) feel free to create a pull request on github to potentially get it added to the supported versions!

Warning

These adobe functions heavily rely on the user to correctly set their keyboard shortcuts within;
..\Support Files\KSA\Keyboard Shortcuts.ini
And in the case of Premiere Pro, heavily rely on the user to correctly set their UIA values


Table of Contents:


After Effects

ae.ScaleAndPos()

This function allows the user to quickly begin keyframing the scale & position values. Simply hover over the desired track and activate this function.


ae.motionBlur()

This function will open up the composition settings window within After Effects, navigate its way to the "advanced" tab, find "shuttle angle" and increase it to a value of 360.


ae.timeline()

A weaker version of right click premiere.ahk

This function will gather the coordinates of the After Effects timeline and store them, then it will allow the user to move the playhead at the press of a button. Set this button to something quick to access like a mouse button (Xbutton1/2) or if you wish to use the keyboard, something a little more obscure like Ctrl + Capslock.


ae.wiggle()

This function is to quickly input a command into one of the properties of After Effects.

ae.wiggle( [command {, delete}] )

command

Type: String

This parameter is the command you wish to enter into the property field.

delete

Type: Boolean

This parameter is to determine whether you need the function to delete an extra '(' or ']' that may get automatically generated by AE as the command is input.


ae.zoomCompWindow()

Trying to zoom in on the preview window can be really annoying when the hotkey only works while the window is focused

ae.zoomCompWindow( [coords, command {, mousespeed := 2}] )

coords

Type: Object

This parameter is the coordinates of your tools bar. requires {x: , x2: , y: , y2: }

command

Type: String

This parameter is the hotkey to send to after effects to zoom however you wish

mousespeed

Type: Integer

This parameter is the speed you wish for the mouse to move. Defaults to 2


Photoshop

ps.Prop()

This function will warp the mouse to one of a photo's values (scale, x/y, rotation, etc), click and hold it so the user can drag to increase/decrease the value, then return once the user let's go.

Tapping the button will reset the property.

ps.Prop( [image] )

image

Type: String - Filename

This parameter is the filename of the property itself & the file extenstion - ie. scale.png NOT scale. Will require screenshots of said property in the appropriate ImageSearch folder.


ps.Save()

This function is to speed through the twitch emote saving process within photoshop - adjusting the image size and saving all 3 sizes.


ps.Type()

This function is to quickly select a different file extension during the file saving process. When you try and save a copy of something in photoshop, it defaults to psd, this is a function to instantly pick the actual filetype you want.

ps.Type( [filetype] )

filetype

Type: String - Filename

This parameter is the filename of the filetype you wish to save as itself - ie. png. Will require screenshots of said filetype in the appropriate ImageSearch folder.


Premiere

⚠️ Timeline Coords

This class contains variables that store the coordinates of the Premiere Pro timeline, this allows any scripts that require them to easily move on without needing to retrieve them constantly. This however poses a problem as the class will only be able to store those coordinates within its own instance, meaning if another script is launched that also requires those coordinates, it will need to retrieve them again for no reason.

Because of this I designed some functions that allows other scripts to communicate with My Scripts.ahk and share timeline coordinates so the other instance of the class can simply store them without needing to retrieve them itself.

⚠️ UIA

Some functions within the Prem { class require the use of the UIA lib to function correctly. Please ensure you have taken the time to fill out that class before proceeding.

prem.preset()

This function will drag and drop any previously saved preset onto the clip you're hovering over. Your saved preset MUST be in a folder for this function to work. This function contains custom code if the preset is called loremipsum and is intended for creating a custom text layer and then dragging your preset on top of it.

Your preset must also be in it's own folder like so;

image

prem.preset( [item] )

item

Type: String

This parameter is the name of the preset you wish to drag onto your desired clip. Try to use names that will result in only one item appearing in the list after doing a search in the effects panel.


prem.fxSearch()

This function is to highlight the effects window and highlight the search box to allow manual typing.


prem.zoom()

This function on first run will ask you to select a clip with the exact zoom you wish to use for the current session. Any subsequent activations of the script will simply zoom the current clip to that zoom amount (and x/y/anchor point position). You can reset this zoom by refreshing the script.
This script takes advantage of some predetermined values maintained within the Prem { class. They are kept within the subclass ClientInfo {. prem.zoom() will check the name of the current client folder and if ClientInfo { contains an object of the same name, it will cycle through those predetermined values.

For better performance with prem.zoom()'s ability to cycle between different zoom levels, encase any hotkeys that call the function within #MaxThreadsBuffer

Example #1

#MaxThreadsBuffer True
n::prem.zoom()
#MaxThreadsBuffer false

prem.valuehold()

This function will warp to the desired value of the current track (scale, x/y, rotation, etc), then click and hold it so the user can drag to increase/decrease the value. Tapping the button you assign this function will reset the desired value.

This function also has functionality to adjust the blend mode for the current track.

prem.valuehold( [filepath {, optional := 0, blendMode := ""}] )

filepath

Type: String - Filename

The filename of the property itself - ie. scale NOT scale.png or scale2. Will require screenshots of said property in the appropriate ImageSearch folder.

If you wish to adjust the blendmode, this string needs to be blend\blendmode

optional

Type: Integer

This value is used to add extra x axis movement to avoid the first "blue" text for some properties. This parameter can be omitted.

blendMode

Type: String - Filename

The filename of the blend mode you wish to change the current track to.


prem.wheelEditPoint()

This function allows you to move back and forth between edit points from anywhere in premiere

prem.wheelEditPoint( [window, direction {, keyswait := "all"}] )

window

Type: String - Hotkey

This parameter is the hotkey within premiere to focus the desired window.

direction

Type: String - Hotkey

This parameter is the hotkey within premiere for the direction you want the playhead to go in relation to "edit points"

keyswait

Type: String

This parameter is the a string you wish to pass to keys.allWait()'s first parameter.


prem.movepreview()

This function is to adjust the framing of a video within the preview window in premiere pro. Let go of this hotkey to confirm, simply tap this hotkey to reset values.
This function mimics what happens either when you double click the preview window, or when you click the "motion" button in a video's "effect control" window.


prem.reset()

This function moves the cursor to the reset button to reset the "motion" effects


prem.gain()

This function is to increase/decrease gain for the current clip. This function will check to ensure the timeline is in focus and a clip is selected.

prem.gain( [amount] )

amount

Type: Number

This parameter is the value you want the gain to adjust (eg. -2, 6, etc)


prem.numpadGain()

This function once bound to ~Numpad1-9:: allows the user to quickly adjust the gain of a selected track by simply pressing NumpadSub/NumpadAdd then their desired value. It will wait for 2 keys to be pressed so that a double digit number can be inputed. If only a single digit is required, press any other key (ie. enter).

If no second input is pressed, the function will continue after 2s

prem.numpadGain()

Example #1

~Numpad1::
~Numpad2::
~Numpad3::
~Numpad4::
~Numpad5::
~Numpad6::
~Numpad7::
~Numpad8::
~Numpad9::prem.numpadGain()

There's probably a way to just write this as a loop in a couple of lines but ensuring prem { is properly passed through can be a bit messy


prem.mouseDrag()

Press a button (ideally a mouse button), this function then changes to the "hand tool" and clicks so you can drag and easily move along the timeline, then it will swap back to the tool of your choice (selection tool for example).

This function will (on first use) check the coordinates of the timeline and store them, then on subsequent uses ensures the mouse position is within the bounds of the timeline before firing - this is useful to ensure you don't end up accidentally dragging around UI elements of Premiere.

This function is best used bound to a mouse button (Xbutton1/2)

This function contains KSA values that need to be set correctly.

⚠️ This script may not function correctly if multiple sequences are open. Unfortunately, attempting to highlight the timeline while it's already active will cycle through sequences. The script will do a pixel search at some of the stored coordinates of the timeline and check for the focus outline to determine if this timeline focusing is required - this should mitigate this issue under most cicumstances, but in the event out outlier event occurs, this issue can be somewhat mitigated by toggling whether the function focuses the timeline by calling prem().__toggleTimelineFocus(). This particular solution isn't perfect and makes the function somewhat weaker, but can help when keeping multiple sequences open is necessary and you're running into those edge cases. ⚠️

prem.mousedrag( [premtool, toolorig] )

premtool

Type: String - Hotkey

This parameter is the hotkey you want the function to send to swap the current tool to another (ie, hand tool, zoom tool, etc). (consider using KSA values).

toolorig

Type: String - Hotkey

This parameter is the hotkey you want the function to send to bring you back to your tool of choice (consider using KSA values).


prem.getTimeline()

A function to retrieve the coordinates of the Premiere timeline. These coordinates are then stored within the Prem { class.

⚠️ It is important to note that this function will need to retrieve the coordinates for every instance of the class; ie. if you have two scripts that both include the Prem { class, they will both need to individually retrieve and store the timeline coordinates. Some of my scripts attempt to share this information with each other, but if you notice multiple scripts retrieving and storing the same information this can be expected. ⚠️
prem.getTimeline()

prem.moveKeyframes()

Quickly and easily move any number of frames in the desired direction.

prem.moveKeyFrames( [direction, frames {, windowHotkey := KSA.effectControls}] )

direction

Type: String - Hotkey

This parameter is the direction you wish to move.

frames

Type: Integer

This parameter is the amount of frames you wish to move in that direction.

windowHotkey

Type: String

This parameter is the hotkey you wish to send to premiere to focus your window of choice. Defaults to the Effect Controls window.


prem.openEditingDir()

Quickly and easily run/activate an asset folder.

prem.openEditingDir( [dir] )

dir

Type: String

This parameter is the path directory you wish to open.


prem.accelScroll()

This function handles accelorating scrolling within premiere. It specifically expects the first activation hotkey to be either alt or shift.

This function will attempt to only fire within the timeline.

prem.accelScroll( [{altAmount := 3, scrollAmount := 5}] )

altAmount

Type: Integer

The amount of accelerated scrolling you want

scrollAmount

Type: Integer

The amount of accelerated scrolling you want


prem.timelineFocusStatus()

This function will check for the blue outline around the timeline (using stored values within the class) that a focused window in premiere will ususally have.

prem.timelineFocusStatus()

Return Value

Type: Trilean

Returns true/false/-1. -1 indicates that the timeline coordinates could not be determined.


prem.Previews()

This function handles different hotkeys related to Previews (both rendering & deleting them). This function will attempt to save the project before doing anything.

prem.Previews( [which, sendHotkey] )

which

Type: String

@hether you wish to delete or render a preview. If deleting, pass "delete" else pass an empty string.

sendHotkey

Type: String

Which hotkey you wish to send.


prem.searchPlayhead()

This function checks to see if the playhead is within the defined coordinates.

prem.searchPlayhead( [coordObj {, playheadCol := this.playhead}] )

coordObj

Type: Integer

An object containing the cursor coordinates you want pixelsearch to check

playheadCol

Type: Hexadecimal

The colour you wish pixelsearch to look for


prem.thumbScroll()

This function will search for the playhead and then slowly begin scrubbing forward until the hotkey is released. This function was designed to make scrubbing for thumbnail screenshots easier.

prem.searchPlayhead()

prem.delayPlayback()

This function requires you to properly set your ripple trim previous/next keys correctly within KSA as well as requires you to make those same keys call prem.rippleTrim() in your main ahk script.

If the user immediately attempts to resume playback after ripple trimming the playhead will sometimes not be placed at the new clip and will inadvertently begin playback where you might not expect it This function attempts to delay playback immediately after a trim to mitigate this behaviour. This function might require some adjustment from the user depending on how fast/slow their pc is

prem.delayPlayback( [{delay := 150}] )

delayMS

Type: Integer

The delay in ms that you want the function to wait before attempting to resume playback. Defaults to a value set within the class


prem.rippleTrim()

Tracks how long it has been since the user used a ripple trim. This function is to provide proper functionality to prem.delayPlayback()

prem.rippleTrim()

Example #1

;// if my ripple trim buttons within both Premiere and KSA are `q` and `w`
q::
w::prem.rippleTrim()

prem.anchorToPosition()

A function to simply copy the current anchor point coordinates and transfer them to the position value. This function is designed for use in the Transform Effect and not the motion tab.

prem.anchorToPosition()

prem.zoomPreviewWindow()

Trying to zoom in on the preview window can be really annoying when the hotkey only works while the window is focused

prem.zoomPreviewWindow( [command] )

command

Type: String

This parameter is the hotkey to send to premiere to zoom however you wish


prem.swapChannels()

This function is mostly designed for my own workflow and isn't really built out with an incredible amount of logic.
It is designed to swap the L/R channel on a single track stereo file. attempting to use this script on anything else will either produce unintended results or will simply not function at all.

prem.swapChannels( [{mouseSpeed := 2}] )

mouseSpeed

Type: Integer

Set the mouse speed


PremiereRemote

This section is any functions directly tied to PremiereRemote.

prem.__remoteFunc()

This function is syntatic sugar to activate a PremiereRemote function.

prem.__remoteFunc( [whichFunc {, needResult := false, params*}] )

whichFunc

Type: String

This parameter is the function you wish to call

needResult

Type: Boolean

This parameter determines whether the user needs this function to return a result back from the cmd window.

params

Type: Varadic/String

These paramaters are any additional paramaters you need to pass to your function. do not add the & that goes between paramaters, this function will add that itself

Return Value

Type: String

if the user sets needResult to true this function will return a string containing the response.


prem.save()

Calls a PremiereRemote function to directly save the current project.

prem.save( [{andWait := true}] )

andWait

Type: Boolean

This parameter determines whether you wish for the function to wait for the Save Project window to open/close.

Return Value

Type: Trilean/String

  • true: successful
  • false: PremiereRemote/saveProj func/projPath func not found
  • "timeout": waiting for the save project window to open/close timed out

prem.__checkPremRemoteDir()

This function checks for the existence of PremiereRemote. Can also check for the existence of a specific function within the index.tsx file.

prem.__checkPremRemoteDir( [{checkFunc := ""}] )

checkFunc

Type: String

This parameter allows the user to also check for a specific function within the index.tsx file.

Return Value

Type: Boolean


prem.__checkPremRemoteFunc()

This function checks the PremiereRemote index file for the desired function.

prem.__checkPremRemoteFunc( [checkFunc] )

checkFunc

Type: String

This parameter is the function name you wish to search for. ie projPath.

Return Value

Type: Boolean


Premiere - Excalibur

A collection of functions used in combination with the Excalibur extension for Premiere Pro

Excalibur.lockTracks()

A function to help quickly and easily lock/unlock multiple audio/video tracks.

prem.Excalibur.lockTracks( [{which := "Video"}] )

which

Type: String

This parameter determines when you wish to lock/unlock either the audio or video tracks


PremHotkeys

A class designed to house functions that other functions use to set a variety of Hotkey adjustments. An example being prem.thumbScroll() sets Shift & Ctrl to speed up/slow down scrubbing respectively; the function to set those hotkeys is kept within this class.

Clone this wiki locally