Old 10-02-2022, 04:22 PM   #1
mazegeek999
Human being with feelings
 
mazegeek999's Avatar
 
Join Date: Jan 2015
Posts: 225
Default Performing script upon save

Hi there,

Is it possible (through a defer() loop) to perform an action once a REAPER project is saved?

If the "save" command was in the undo history, I could continuously scan the most recent event in the undo history and wait for it to be a "save" command. Of course, saving has no place in the undo history, but that's the kind of logic I'm trying to apply here. Is there any place where save history is stored in REAPER?

EDIT: Apparently saving IS denoted in the undo history as "[LAST SAVE]". But I'm struggling to find where in the API to access that history. Can anyone help?

Last edited by mazegeek999; 10-02-2022 at 04:30 PM.
mazegeek999 is offline   Reply With Quote
Old 10-02-2022, 06:45 PM   #2
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,110
Default

I haven't tried it but your best bet is probably Undo_CanUndo2.

Quote:
returns string of last action,if able,NULL if not
nofish is offline   Reply With Quote
Old 10-02-2022, 07:03 PM   #3
mazegeek999
Human being with feelings
 
mazegeek999's Avatar
 
Join Date: Jan 2015
Posts: 225
Default

Quote:
Originally Posted by nofish View Post
I haven't tried it but your best bet is probably Undo_CanUndo2.
This doesn't appear to return the "[LAST SAVE]" text, unfortunately.
mazegeek999 is offline   Reply With Quote
Old 10-03-2022, 01:35 AM   #4
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,902
Default

This isnt'n the best way to handle this





Just check for IsProjectDirty and if not then save. and dont do it untill next save (chzck if dirty become false again).


Also, make this check only if the project has already been dirty once.
X-Raym is offline   Reply With Quote
Old 10-03-2022, 06:47 PM   #5
mazegeek999
Human being with feelings
 
mazegeek999's Avatar
 
Join Date: Jan 2015
Posts: 225
Default

Quote:
Originally Posted by X-Raym View Post
Just check for IsProjectDirty and if not then save. and dont do it untill next save (chzck if dirty become false again).


Also, make this check only if the project has already been dirty once.
Thank you, this does the trick.
mazegeek999 is offline   Reply With Quote
Old 10-05-2022, 02:09 PM   #6
McSound
Human being with feelings
 
McSound's Avatar
 
Join Date: Jun 2021
Location: Moscow, Russia
Posts: 282
Default

Sorry for off-top... Ok,deleted!

Last edited by McSound; 10-05-2022 at 04:17 PM.
McSound is online now   Reply With Quote
Old 10-05-2022, 02:33 PM   #7
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,902
Default

Quote:
Sorry for off-top
This would deserve its own thread :P
X-Raym is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 03:53 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.