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


Permlink Replies: 21 - Pages: 2 [ Previous | 1 2 ] - Last Post: 03-Jan-2014 16:08 Last Post By: RobM
solenederrien

Posts: 22
Registered: 11/03/13
Re: how to remove "forbidden" images of a project?
Posted: 02-Jan-2014 20:51   in response to: RobM in response to: RobM
 
  Click to reply to this thread Reply
and what about the change in the "page layout"? I mean the "after" file is written in a single line instead of one line for one image link.
RobM

Posts: 4,258
Registered: 08/04/06
Re: how to remove "forbidden" images of a project?
Posted: 02-Jan-2014 20:56   in response to: solenederrien in response to: solenederrien
 
  Click to reply to this thread Reply
The layout change is because \r is the control character that represents a Return (key) and for some reason, it has not been properly found and replace, just the r not \r

It really needs a windows user to look at it.
gugo98

Posts: 1
Registered: 01/02/14
entre no site para mais detalhes
Posted: 02-Jan-2014 21:03   in response to: RobM in response to: RobM
 
  Click to reply to this thread Reply
conheƧa mais detalhes em.

Edited by: RobM on 02-Jan-2014 20:04
davidekholm

Posts: 21,295
Registered: 10/18/02
Re: entre no site para mais detalhes
Posted: 03-Jan-2014 11:53   in response to: gugo98 in response to: gugo98
 
  Click to reply to this thread Reply
I don't recommend poking directly inside jAlbum's config files. Future versions may store things differently and then such code will break. Moreover, there is a jAlbum API that simplifies interacting with jAlbum objects. Here's my version of an external tool that deletes excluded links. Please check it out. It can be used as a template for other tools that modifies album objects in batch.

(The reason why I do the deletion in a separate loop is that the recursive processFolder() iteration will break when deleting objects at the same time as one iterates over objects)

Here's the tool in-line too:
import se.datadosen.jalbum.*;
 
int processCount = 0;
List toDelete = new ArrayList();
 
void processFolder(AlbumObject folder) {
	for (AlbumObjectImpl ao : folder.getChildren()) {
		if (ao.isFolder()) {
			processFolder(ao);
		}
		if (!ao.isIncluded() && ao.isLink()) {
			toDelete.add(ao);
		}
	}
}
 
// Execution starts here
msg =
"This script deletes exluded links from this album project";
int option = JOptionPane.showConfirmDialog(window, msg, "Delete excluded links", JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE);
if (option != JOptionPane.YES_OPTION) return;
 
processFolder(rootFolder);
 
for (AlbumObject ao : toDelete) {
	ao.delete();
	processCount++;
}
 
// Refresh display
window.albumExplorer.refreshAction.actionPerformed(null);
window.statusBar.setText("Processed " + processCount + " objects");
window.messageBox("Processed " + processCount + " objects");
 
RobM

Posts: 4,258
Registered: 08/04/06
Re: entre no site para mais detalhes
Posted: 03-Jan-2014 13:32   in response to: davidekholm in response to: davidekholm
 
  Click to reply to this thread Reply
I have deleted the hack files I posted. I did try using album objects but could not make it work, I was over complicating things (not knowing the API well enough).
davidekholm

Posts: 21,295
Registered: 10/18/02
Re: entre no site para mais detalhes
Posted: 03-Jan-2014 13:39   in response to: RobM in response to: RobM
 
  Click to reply to this thread Reply
No problem. I hope this code helped better understand the API.
RobM

Posts: 4,258
Registered: 08/04/06
Re: entre no site para mais detalhes
Posted: 03-Jan-2014 16:08   in response to: davidekholm in response to: davidekholm
 
  Click to reply to this thread Reply
Yes, indeed. I'd figured out having to process the excluded files after identifying them, to avoid the error when deleting objects being iterated over. But then I got lost in trying to identify the links themselves. It also gives me a better way of building the list of files, when I first tried I ended up making a list of lists, yuk!

As long as I'm learning I'm happy :)
Legend
Forum admins
Helpful Answer
Correct Answer

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