Welcome Guest

Pages: 1
Conditional Artwork to folder.jpg (Only if it does not already exist)
Gary-SwiftPostOctober 20, 2024, 05:38
Beginner
Posts: 49
Registered:
April 29, 2014, 06:12
Normal topicConditional Artwork to folder.jpg (Only if it does not already exist)

I would like create an action with a conditional "Artwork to folder.jpg", with the condition being that the folder.jpg file does not already exist.

I'm stuck on determining the absolute path of the file in the "Test if File Exists" function.

I would additionally like to "hook" this action into the save action so that it runs automatically when I save files.

Is this possible?

Test if file "./folder.jpg" exists (Set result)
if false
    Artwork to folder.jpg
endif

Image

2MR2PostOctober 20, 2024, 08:25
Avatar photo
Administrator
Posts: 2276
Registered:
August 23, 2012, 19:27
Normal topicConditional Artwork to folder.jpg (Only if it does not already exist)

In your action the folder path is missing. The paths are interpreted by the OS so ./ is not a file’s containing folder. The folder path can be extracted via a Get Property statement or inline via an escape sequence.

Download the zip at:

https://2manyrobots.com/actions/Save-to-folder.jpg-(if-necessary).zip

The zip contains two actions:

Save folder.jpg (if necessary) - efficient (Version 1.0)
Save folder.jpg (if necessary) - slow (Version 1.0)

The ’slow’ one is almost the same as yours but tests for every selected file.

The ‘efficient’ one only tests each folder once.

As far as having it run whenever you save a file, you can specify and action in Settings-Actions-General-Auto-run on Save

Note that the setting is only honoured for certain save operations. Do a Help>Search Yate Help and search for the Automatically Running an Action When Saving Files topic for additional information.

While you can only specify one auto-save action, you can always specify an action which calls others.

Gary-SwiftPostOctober 24, 2024, 07:11
Beginner
Posts: 49
Registered:
April 29, 2014, 06:12
Normal topicConditional Artwork to folder.jpg (Only if it does not already exist)

Sorry, I'm late with my reply!

I will check this later tonight and report back.

Thank you so much for your help, I really appreciate it. 😎

Gary-SwiftPostOctober 26, 2024, 06:53
Beginner
Posts: 49
Registered:
April 29, 2014, 06:12
Normal topicConditional Artwork to folder.jpg (Only if it does not already exist)

This is great. It's exactly what I asked for.

However, I now realise that I only want it to run if all loaded files are already in the the same folder.

This is in relation the "Auto-run on save" option. I don't want it to run if I am bulk editing a lot of folders.

I'm trying to figure it out myself but I'm struggling a bit with it.

2MR2PostOctober 26, 2024, 09:40
Avatar photo
Administrator
Posts: 2276
Registered:
August 23, 2012, 19:27
Normal topicConditional Artwork to folder.jpg (Only if it does not already exist)

I've created a shell of an action to test for your criteria. Download:

https://2manyrobots.com/actions/Auto-Run-on-Save---Shell.zip

I've documented it. THis is the action (or a copy of it) that should be specified as the auto-run on Save action.

Note that it currently does not do anything. Look at line 11 which is disabled. I commented it out so as not to include the same action again which you might have modified.

Gary-SwiftPostOctober 26, 2024, 09:40
Beginner
Posts: 49
Registered:
April 29, 2014, 06:12
Normal topicConditional Artwork to folder.jpg (Only if it does not already exist)

Ok, I think I figured this out. It's not exactly as I described, but it sufficient for my needs.

I did the following:

Test if the Album field is the same in every file, Set result
if true
    Run action 'Save folder.jpg (if necessary) - efficient'
endif

Image

Gary-SwiftPostOctober 26, 2024, 09:46
Beginner
Posts: 49
Registered:
April 29, 2014, 06:12
Normal topicConditional Artwork to folder.jpg (Only if it does not already exist)

I've created a shell of an action to test for your criteria

Sorry, I replied before I saw that you had responded.

Thanks for the updated version. I'm going to check it out now.

2MR2PostOctober 26, 2024, 09:46
Avatar photo
Administrator
Posts: 2276
Registered:
August 23, 2012, 19:27
Normal topicConditional Artwork to folder.jpg (Only if it does not already exist)

We're crossing responses. 🙂 Your method will work but only looks at selected files. The one I just sent you looks at all loaded files.

Remember a Save in the UI saves all modified files even if not selected.

Gary-SwiftPostOctober 26, 2024, 10:35
Beginner
Posts: 49
Registered:
April 29, 2014, 06:12
Normal topicConditional Artwork to folder.jpg (Only if it does not already exist)

Success!

Your version is much better.

Thanks again.

Pages: 1
Mingle Forum by Cartpauj | Version: 1.1.0beta | Page loaded in: 0.097 seconds.