Thread Locked This thread is locked - replies are not allowed.


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 7 - Pages: 1 - Last Post: 23 Apr 22, 21:37 Last Post By: RobM Threads: [ Previous | Next ]
Lionelp

Posts: 4
Registered: 7-Dec-2014
Run bat file after generate album
Posted: 23 Aug 21, 22:20
 
Hello
It would be great to be able to run a bat file when the album generation is finished. To automatically copy / move the generated album for example.
Thank you
MarkusD

Posts: 778
Registered: 13-Apr-2006
Re: Run bat file after generate album
Posted: 24 Aug 21, 06:49   in response to: Lionelp in response to: Lionelp
 
Attachment Update.cmd (2.2 KB)
Just use a bat to compile the album and you can do anything after the compilation. Look in the code attached
davidekholm

Posts: 3,795
Registered: 18-Oct-2002
Re: Run bat file after generate album
Posted: 24 Aug 21, 12:21   in response to: Lionelp in response to: Lionelp
 
Attachment finally.bsh (640 bytes)
Also, when running jAlbum from the UI or command line, jAlbum will execute the "finally.bsh", "finally.js" or "finally.groovy" scripts if found within the skin's directory or within <progdir>/system. The file extension of these scripts will determine what language you'll be using (Java/BeanShell, JavaScript or Groovy).

Here's an attached example that copies the generated album (if generated ok) to the user's desktop and names the destination album folder the same as the image folder. It also tries to execute an external bat file, passing the path to the generated album as argument. I'd personally stay within jAlbum's scripting framework to do any post album build actions.

finally.bsh:
/**
 * This script is executed after each album build
 */
 
import se.datadosen.jalbum.*;
 
if (executedNormally) {
 
	// Copy the generated directory to the user's desktop
	File desktop = new File(System.getProperty("desktop.path"));
	File dest = new File(desktop, rootFolder.getName());
	IO.copyDirectoryContent(rootOutputDirectory, dest, true);
	window.messageBox("All went ok. Album copied to: " + dest);
 
 
	// Call batch file and pass it generated album directory
	try {
		Runtime.getRuntime().exec(new String[] { "finally.bat", rootOutputDirectory.getAbsolutePath()});
	} catch (IOException ex) {
		// Do nothing. Script not found
	}
}
 
 
JeffTucker

Posts: 7,992
Registered: 31-Jan-2006
Re: Run bat file after generate album
Posted: 24 Aug 21, 12:33   in response to: davidekholm in response to: davidekholm
 
But if the skin you're using has its own finally.bsh, don't just replace it with your own. You may end up, at best, with an album that hasn't had unneeded files removed, or, at worst, with an album that won't work at all. In my skins, for example, the finally.bsh often generates Javascript configuration files that are absolutely required for the album.
davidekholm

Posts: 3,795
Registered: 18-Oct-2002
Re: Run bat file after generate album
Posted: 24 Aug 21, 12:42   in response to: JeffTucker in response to: JeffTucker
 
Good point. <progdir>/system/finally.bsh is a free spot tough. It will be executed after any finally file within the skin.
Lionelp

Posts: 4
Registered: 7-Dec-2014
Re: Run bat file after generate album
Posted: 24 Aug 21, 13:25   in response to: davidekholm in response to: davidekholm
 
Thaaaaaaaaaaaaaaannnk !!!!!!!!!!!!!
Lionelp

Posts: 4
Registered: 7-Dec-2014
Re: Run bat file after generate album
Posted: 23 Apr 22, 21:14   in response to: davidekholm in response to: davidekholm
 
@davidekholm,

Thanks very much
Can we run a bat file?
finally.bat?? possible

I noticed that the .htaccess file of my folder disappears with each generation of the album, I would like to make a small .bat file to regenerate it.

Thank you
RobM

Posts: 3,876
Registered: 4-Aug-2006
Re: Run bat file after generate album
Posted: 23 Apr 22, 21:37   in response to: Lionelp in response to: Lionelp
 
Lionelp wrote:
@davidekholm,

Thanks very much
Can we run a bat file?
finally.bat?? possible

I noticed that the .htaccess file of my folder disappears with each generation of the album, I would like to make a small .bat file to regenerate it.

Thank you

Please don't double post. The problem was found to be related to Laza's skins and you have posted in Tiger's forum asking for it to be fixed again. If laza fails to fix it again post in a new thread, it is better than resurrecting an old thread.
Legend
Forum admins
Helpful Answer
Correct Answer

Point your RSS reader here for a feed of the latest messages in all forums