Permlink Replies: 0 - Pages: 1

Posts: 544
Registered: 27-Sep-2003
Convert from CompiledScript to CompiledBase
Posted: 25-May-2018 15:41
  Click to reply to this thread Reply
As you are probably aware, CompiledScript is deprecated; you should use CompiledBase instead. This describes how to convert.

You probably call updateVars in 3 places; index page, index item, slide. These must be replaced with a series of statements get("variablename"). You could create a single method "updateVars" that gets all the variables; I prefer to just get the variables that I need.

CompiledScript changes some variables from null to 0. You need to do this as well.

David said that the conversion "should be a 1-minute operation." I am flattered by his high opinion of my programming skills.

This is how I did it.
  • You may need other variables. If any variables are missing, you will get compilation errors (you do compile your Java don't you?).
  • You may not need all these variables, in which case Eclipse or NetBeans will warn you that the variable is not used (you do use an IDE don't you?).
  • Depending on your class structure, you need to declare each variable as private, protected or public.
1) Index page
protected String resPath;
protected File imageDirectory;
private String firstIndexPage;
private String previousIndexPage;
private String nextIndexPage;
private Integer indexNum;
private File outputDirectory;
private String parentIndexPage;
private String rootPath;
private Integer totalIndexes;
protected Integer level;
// updateVars();
resPath = (String)get("resPath");
imageDirectory = (File)get("imageDirectory");
firstIndexPage = (String)get("firstIndexPage");
previousIndexPage = (String)get("previousIndexPage");
nextIndexPage = (String)get("nextIndexPage");
outputDirectory = (File)get("outputDirectory");
parentIndexPage = (String)get("parentIndexPage");
rootPath = (String)get("rootPath");
totalIndexes = (Integer)get("totalIndexes");
if (totalIndexes == null)
{ totalIndexes = 1;
indexNum = (Integer)get("indexNum");
if (indexNum == null)
{ indexNum = 1;
level = (Integer)get("level");
if (level == null)
{ level = 0;
2) Index item
protected String thumbPath;
protected Integer thumbWidth;
private Map current;
private Map local;
private File currentFile;
private AlbumObject currentFolder;
private AlbumObject currentObject;
private String fileName;
// updateVars();
thumbPath = (String)get("thumbPath");
thumbWidth = (Integer)get("thumbWidth");
current = (Map)get("current");
local = (Map)get("local");
currentFile = (File)get("currentFile");
currentFolder = (AlbumObject)get("currentFolder");
currentObject = (AlbumObject)get("currentObject");
fileName = (String)get("fileName");
3) Slide
private String resPath;
private Integer imageWidth;
private Integer imageHeight;
private Map local;
private String label;
private String nextPage;
private String previousPage;
private Integer indexNum;
private File outputDirectory;
// updateVars();
resPath = (String)get("resPath");
outputDirectory = (File)get("outputDirectory");
imageWidth = (Integer)get("imageWidth");
imageHeight = (Integer)get("imageHeight");
local = (Map)get("local");
label = (String)get("label");
nextPage = (String)get("nextPage");
previousPage = (String)get("previousPage");
indexNum = (Integer)get("indexNum");
if (indexNum == null)
{ indexNum = 1;
Forum admins
Helpful Answer
Correct Answer

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