You can record tool use in actions like brush strokes you can not do that in scripts and you can not get the mouse cursor position in a script. You can get Key events in a script. You can not get recorded keyevents the action player would be handling those. Do not think you can start recording an action in a script
In Adobe Photoshop Java script manual I see this Action manager code for redraw.
// A helper function for debugging
// It also helps the user see what is going on
// if you turn it off for this example you
// get a flashing cursor for a number time
var eventWait = charIDToTypeID("Wait")
var enumRedrawComplete = charIDToTypeID("RdCm")
var typeState = charIDToTypeID("Stte")
var keyState = charIDToTypeID("Stte")
var desc = new ActionDescriptor()
desc.putEnumerated(keyState, typeState, enumRedrawComplete)
executeAction(eventWait, desc, DialogModes.NO)
I'm aware you can record tool use via record in actions. Key events are generally unhelpful, and I dont need to start recording in a script.
What I am looking for is a "call back", or a notifier for redraw, aka what "RdCm" supplies but as an event, not as an enum. With that, I can evoke a save action during painting, effectively turning recorded tool playback in to a key framed animation I save to disk as a frame sequence.
I currently am able to shim in save actions in between each recorded brush stroke. However, this means an entire brush action is done before a save file operation, and there is no 'gesture' progress being made (ie, you dont see a stroke begin, move *in* the recorded files. You do see it on screen however.
* Is there an event type other than the four char code "All " which evokes a notifier on tool use like brush stroke or playback of recorded tool use as saved in an action?
* Is there a callback or event for document redraw, or document re-paining when pixels are applied to a layer, or in the document as a whole?
* Is there a callback or event for a document being modified from one state to another - as a result of pixels being modified?
Ideally I need a non screen recorded solution since files are in the 40Mpixel range and we want full raster near 8K frame sequences.
Thank you for taking the time to respond.
Also to be clear, the WaitForRedraw snippet is only evoked after a full action is completed. In other words,as far as I have been able to tell, the wait for redraw happens after a brush stroke moves from point a to b painting the entirety of the stroke. The wait occurs during the NEXT redraw after.
I need to "playback" a brush stroke from a to b, and during the stroke (as it paints partway from a to be and updates the canvas), have a notification that the contents of a layer, or the contents of the document, or some other mechanism, that the screen has drawn, intercede by writing that current state as an image to disk, and then let the brush continue until the next update (where I will intercede again, until the brush action has completed and I de-register for those notifications).