Validating a single JTextField
I was wondering how i would stop people adding more than 5 characters into a JTextField, i dont really want a message to come up after, just the code to stop it from happening
Thanks
try
MaskFormatter format = new MaskFormatter("?????");
catch(java.text.ParseException e)
e.printStackTrace();
JFormattedTextField myField = new JFormattedTextField(format);That should do the trick....
/ why the heck didn't they just make a setMaxLength(int x) method???
Chris
Similar Messages
-
Column Validation on Single Line of Text
I have a sharepoint input form in SP2013, which contains text field with below properties
1. Type: Single line of Text
2. Under Column validation
=AND(ISNUMBER([Column name]+0),ISERROR(FIND(".",[Column name],1)))
On form submit, the above condition evaluates and throws an error if field value is non numeric field.(This is expected and working fine)
I also want to add another condition that should not allow preceding zero
example: it should throw error on 0122343(any number starting with zero)You should achieve that with the following formula :
=AND(AND(ISNUMBER([Column name]+0);ISERROR(FIND(".",[Column name],1)));LEFT([Column name],1) <> "0")
If the first character of your column is 0 it fails validation
Regards -
BEA-090513 "ServerIdentity failed validation" on single domain single server
Hi!
I'm getting loads of
<Error> <Security> <BEA-090513> <ServerIdentity failed validation, downgrading
to anonymous.>
errors though I'm running a single server in a single domain - so the information
in
http://e-docs.bea.com/wls/docs81/messages/Security.html
isn't very helpful. What can I do to remove this problem?
Thanks so much,
Hans-Peter StoerrHi I get the similar error
<Error> <Security> <BEA-090513> <ServerIdentity failed validation, downgrading to anonymous.>
<Sep 12, 2007 4:04:51 PM CDT> <Error> <Security> <BEA-090513> <ServerIdentity failed validation, downgrading to anonymous.>
####<Sep 12, 2007 2:47:32 PM CDT> <Error> <Security>sb1> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Defau
lt (self-tuning)'> <<WLS Kernel>> <> <> <1189626452736> <BEA-090513> <ServerIdentity failed validation, downgrading to anonymous.>
####<Sep 12, 2007 2:47:32 PM CDT> <Error> <Security> > <sb1> <ExecuteThread: '8' for queue: 'weblogic.socket.Muxer'> <<WLS
Kernel>> <> <> <1189626452759> <BEA-090513> <ServerIdentity failed validation, downgrading to anonymous.>
####<Sep 12, 2007 2:47:32 PM CDT> <Error> <Security> < <sb1> <ExecuteThread: '8' for queue: 'weblogic.socket.Muxer'> <<WLS
Kernel>> <> <> <1189626452760> <BEA-090513> <ServerIdentity failed validation, downgrading to anonymous.>
I tried the bea method to change the credentials that the domain is interacting with (trust certificate) but no help.The errors keep coming still.
iN order to rule out some possiblity i shutdown the other domain completley and i could still see same errors in my managed server logs.i would really appreciate anyones tips to fix this issue. -
Skip Validations in Single Form +jsf
Hello Forum
I have a requirement in which in a form i have 3 sub views
1.header 2. Side Menu 3.Footer all these are under 1 form
In Header sub view i have one input text box and command button
in the body of the form where it has many input text boxes among them few are required when ever i click command button it displays validation need for all required fields i want to skip all the validation fields and submit the page.
could anybody suggest me.Hello BaluSc
Thanks for your quick response, I am Sorry that i couldn't explain it properly.This is my requirement
<h:form>
<h:inputText id="search" value="#{search.searchKeyword}" size="50" maxlength="50"/>
<h:commandButton action="#{search.callAction}" value="Search"/>
<h:inputText id="eno" value="#{search.eno}" size="50" maxlength="50" required="true"/>
<h:inputText id="ename" value="#{search.ename}" size="50" maxlength="50" required="true"/>
<h:commandButton action="#{search.callAction}" value="Save"/>
</h:form>
Thanks in Advance -
Combine select and update into single statement,without bind-variable
I have a problem, that I think is not possible to solve the way I want to, but I just wanted to check before leaving the idea...
I am looking for a way to combine the select and the update statement into one single statement. This is what I wan't to achive: select some data, and update the data selected before returning them.
On this site http://www.psoug.org/reference/update.html I see that the following are possible:
var bnd1 NUMBER
var bnd2 VARCHAR2(30)
var bnd3 NUMBER
UPDATE employees
SET job_id ='SA_MAN', salary = salary + 1000,
department_id = 140
WHERE last_name = 'Jones'
RETURNING salary*0.25, last_name, department_id
INTO :bnd1, :bnd2, :bnd3;
I need to have this as a single statement, and cannot use bind-variables. So I was hoping that something like this could be possible:
UPDATE customer c
SET c.HAS_CREDIT ='1'
WHERE c.HAS_CREDIT = '0'
RETURNING c.CUSTOMER_NO, c.FIRSTNAME, c.LASTNAME
where c.HAS_CREDIT = '1'
But this doesn't compile, complaining of missing into (ORA-00925: missing INTO keyword). And even though I would like this to be possible because this would solve my current problem, I think it would be very confusing. For instance; would the where clause of the returning part be operating after the update or before?
Any comments or suggestions on how to get it work in a single statement, or should I just leave this path straight away?Hi,
RETURNING only works with bind variables, see
http://download-uk.oracle.com/docs/cd/B19306_01/appdev.102/b14261/returninginto_clause.htm#sthref3006
The real problem is that the form of RETURNING clause with bind variables is only valid for single row update or insert statements.
To update (or insert) multiple rows and return the data, you will need to use
RETURNING BULK COLLECT INTO clause. See
http://download-uk.oracle.com/docs/cd/B19306_01/appdev.102/b14261/tuning.htm#sthref2236
Cheers,
Colin -
I want to Pick the Single file from The source Directory
Hi,
My Scenario is File to RFC .. I'm getting the files in the source Directory.. File names are SENDER_(TIMESTAP).XML .. but the problem is... When ever Files are available in the Source Directory Immediately XI was picking all the files at a time.. But I want to to Pick a single file at a time..
for Making this what we have to do.. After Processing the first file then only my Sender adapter should pick the next file... (even though Multiple files are available in my Source Directory)
Regards
JainHi,
the other option was use Adapter specific attributes in the Sender Communication channel..
or
while droping the files ask them to drop using time stamp in another directory and an external validation is required .. and after validation push single file to Source directory using batch file..
i.e use a batch file using run time operating system or make that batch file to run at OS level ..
where the batch files needs to validate the time interval of the file and needs to push a single file to the source directory.. where from there we can directly pick a single file and process..
regards,
Kishore -
Hey, how would i go about validating that a JTextField holds a string that doesn't contain any numbers or blank spaces? Obviously you would access the string using 'JTextField'.getText() but how would you parse through the letters to validate it?
Heres the full code I'm working with. It's a GUI character creater and I need to validate the Name field, like I said it can't have numbers, blank spaces, or generally be null.
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.IllegalFormatException;
import javax.swing.*;
public class CharacterCreator extends JFrame {
JButton CreateButton, ExitButton;
JPanel MainPanel, ButtonPanel, Center, TextPanel, DropBox, RadioPanel, CheckBoxPanel, NamePanel, LevelPanel;
JLabel TextArea, job, gender, level, heroic, name;
JTextField textField1, textField2;
String textCheck, textCheck1, textCheck2;
JComboBox box;
ButtonGroup buttonGroup;
JCheckBox checkBox;
JRadioButton button1, button2;
int intCheck;
public CharacterCreator(){
this.setTitle("War Quest Character Creator");
this.setSize(500, 400);
this.setLocation(100, 100);
this.addWindowListener(new ExitListener());
CreateButton = new JButton("Create");
CreateButton.addActionListener(new CreateListener());
ExitButton = new JButton("Exit");
ExitButton.addActionListener(new ExitListener());
TextArea = new JLabel();
TextArea.setSize(500,500);
JPanel TextPanel = new JPanel(new FlowLayout());
TextPanel.add(TextArea);
JPanel ButtonPanel = new JPanel(new FlowLayout());
ButtonPanel.add(CreateButton);
ButtonPanel.add(ExitButton);
JPanel Center = new JPanel();
Center.setLayout(new BoxLayout(Center, BoxLayout.Y_AXIS ));
Center.add(createNamePanel());
Center.add(createComboBoxPanel());
Center.add(createLevelPanel());
Center.add(createRadioPanel());
Center.add(createCheckPanel());
JPanel MainPanel = new JPanel(new BorderLayout());
MainPanel.add(ButtonPanel, BorderLayout.SOUTH);
MainPanel.add(TextPanel, BorderLayout.NORTH);
MainPanel.add(Center, BorderLayout.CENTER);
this.setContentPane(MainPanel);
private JPanel createLevelPanel(){
textField1 = new JTextField();
textField1.setEditable(true);
textField1.setText("Enter Level");
level = new JLabel("Level:");
JPanel textFieldPanel = new JPanel();
textFieldPanel.add(level);
textFieldPanel.add(textField1);
return textFieldPanel;
private JPanel createNamePanel(){
textField2 = new JTextField();
textField2.setEditable(true);
textField2.setText("Enter Name");
name = new JLabel("Name:");
JPanel textFieldPanel1 = new JPanel();
textFieldPanel1.add(name);
textFieldPanel1.add(textField2);
return textFieldPanel1;
private JPanel createCheckPanel(){
checkBox = new JCheckBox();
heroic = new JLabel("Heroic:");
JPanel checkboxPanel = new JPanel();
checkboxPanel.add(heroic);
checkboxPanel.add(checkBox);
return checkboxPanel;
private JPanel createRadioPanel(){
button1 = new JRadioButton("Male");
button1.setSelected(true);
button2 = new JRadioButton("Female");
buttonGroup = new ButtonGroup();
buttonGroup.add(button1);
buttonGroup.add(button2);
gender = new JLabel("Gender:");
JPanel radioButtonPanel = new JPanel();
radioButtonPanel.add(gender);
radioButtonPanel.add(button1);
radioButtonPanel.add(button2);
return radioButtonPanel;
private JPanel createComboBoxPanel() {
String[] options = new String[3];
options[0]="Barbarian";
options[1]="Rogue";
options[2]="Archer";
box = new JComboBox(options);
box.setEditable(false);
box.setEnabled(true);
box.setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR));
box.getInputContext();
job = new JLabel("Job:");
JPanel comboBoxPanel = new JPanel();
comboBoxPanel.add(job);
comboBoxPanel.add(box);
return comboBoxPanel;
public void create(){
textCheck1 = textField1.getText();
try{
intCheck = Integer.parseInt(textCheck1);
catch(IllegalArgumentException nfe) {
System.out.println("NumberFormatException: Level must be a number between 1-70");
return;
if(intCheck>70){
throw new NumberFormatException("NumberFormatException: Level must be a number between 1-70");
else{
TextArea.setText("Character Successfully Created");
if(button1.isSelected()){
System.out.println("Character: \n"+"Name: "+textField2.getText()+"\n"+"Job: "+box.getSelectedItem()+"\n"+"Level: "+textField1.getText()+"\n"+"Gender: Male"+"\n"+"Heroic: "+checkBox.isSelected()+"\n");
else if(button2.isSelected()){
System.out.println("Character: \n"+"Name: "+textField2.getText()+"\n"+"Job: "+box.getSelectedItem()+"\n"+"Level: "+textField1.getText()+"\n"+"Gender: Male"+"\n"+"Heroic: "+checkBox.isSelected()+"\n");
private void exit() {
System.exit(0);
private class ExitListener extends WindowAdapter implements ActionListener {
public void windowClosing(WindowEvent e) {
exit();
public void actionPerformed(ActionEvent e) {
exit();
private class CreateListener extends WindowAdapter implements ActionListener {
public void actionPerformed(ActionEvent e) {
create();
public static void main(String[] args) {
CharacterCreator character = new CharacterCreator();
character.setVisible(true);
} If I were to use a JFormatedTextField instead of a regular one, how would I then format the field? The sub-methods and Javadoc on the sun site don't make a lot of sense as a Java beginner. The way I originally though about doing this was by nesting another loop in the create() method that would parse the string and check for numbers or spaces but I couldn't figgure out how to do that either. If someone could help I'd appreciate it. Thanks. -
About Mass processing/Collective Processing Validation
Dear SAP MDG guru,
I have a question regarding mass processing/Collective processing in MDG
Are there any Badi, Or class that we can use in the screen collective processing (like below screen shot), i know that it had a check button like the screeshot below,
But it always give a no errors found, eventhough when you go to the single processing of each object,you can save it, even its give error message, and you can approve collective processing with the error data, and its really weird
so can anyone help me, can we use the check button to leverage the validation?Hi
You can refer below link
Definition of Validations and Derivations - SAP Help Portal
It says SAP Triggered function
CHECK_ENTITY (Check entity): The system executes the function assigned to this event when entity values are validated during single or collective processing, when mass changes are made, or during the upload process.
So please see Technical help may be help to get your answer -
Can't remove focus when validating
I have a validation on a JTextField that stops the user focussing on the next input field until the correct data is entered. Its simple and works like this:
private void docnumFieldFocusLost(java.awt.event.FocusEvent evt)
if (!evt.isTemporary())
if (!validDocnum())
docnumField.requestFocusInWindow();
docnumField.setBackground(new Color(251, 51, 0));
displayMsg(errortype, title, msg);
}One option I want to give the user is to abandon the input altogether by clicking a Reset button (to return the field to blank) or Exit button (to leave the GUI completely). But I cant get out of the original focus on the docnumField.
I have tried:
private void resetButtonMouseClicked(java.awt.event.MouseEvent evt)
docnumField.setRequestFocusEnabled(false);
docnumField.setText("");
resetValues();
}but the attempt to focus on the resetButton component fails because the other focus can't be broken. I would be most thankful for a suggestion to break this 'loop'.Did you remove camera from the multitask bar?
-
Jtextfields and accepting tabs instead or in addiction to CR
I'm wondering, (I've done a quick search and found nothing exactly like it, but maybe someone can help). How does one set up (simply) a single jtextfield to accept a tab as an actionevent (or to fire an action event). Here is what I'm trying to do. When the person inputs a name or something and then tabs to the next component (Jtextfield or jspinner in this case) it fires off an event saything that the content has changed and that the Controller must now update the Model from the input within the view (Jtextfield). Is there a simple way to do this?
Thanks in advance.Here is a sample program that will detect the tab key using the suggestions I made earlier (alternate method is commented out):
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.util.*;
public class Test1 extends JPanel implements ActionListener {
Test1() {
myJTextField tf1,tf2,tf3;
tf1=new myJTextField(10);
tf1.addActionListener(this);
tf2=new myJTextField(10);
tf2.addActionListener(this);
tf3=new myJTextField(10);
tf3.addActionListener(this);
add(tf1);
add(tf2);
add(tf3);
tf1.requestFocus();
public void actionPerformed(ActionEvent e) {
System.out.println("ENTER detected -- Do what you want here and move on");
public static void main(String s[]) {
WindowListener l = new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
JFrame f = new JFrame("Test1");
f.addWindowListener(l);
f.getContentPane().add("Center", new Test1());
f.pack();
f.setSize(new Dimension(400,300));
f.setVisible(true);
class myJTextField extends JTextField {
myJTextField(int col) {
super(col);
setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS,Collections.EMPTY_SET);
setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS,Collections.EMPTY_SET);
/* uncomment this section and remove the processKeyBinding
KeyStroke tab=KeyStroke.getKeyStroke(KeyEvent.VK_TAB,0);
getActionMap().put("tabAction", new tabAction());
getInputMap(JComponent.WHEN_FOCUSED).put(tab,"tabAction");
getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(tab,"tabAction");
public boolean processKeyBinding(KeyStroke ks, KeyEvent e, int condition, boolean pressed) {
if (ks == KeyStroke.getKeyStroke(KeyEvent.VK_TAB,0)) { // TAB
System.out.println("TAB detected! do what you want here and move on");
return true;
return super.processKeyBinding(ks,e,condition,pressed);
/* uncomment this section and remove the processKeyBinding
private class tabAction extends AbstractAction {
public void actionPerformed(ActionEvent e) {
System.out.println("TAB detected! do what you want here and move on");
}Since I don't know what you're trying to do once you have detected either the ENTER or TAB key, I leave that part up to you.
;o)
V.V. -
JTextField and keylistener HELP`!
Hi, guys. I am working on my first java project. What i would like to have is a keylistener which detects if the key pressed is a numerical value or character. i hope you guys understand what i mean. A validation check restricting JTextFields to only accept numerical or either charaters and not both.
Hope someone may help...
`bluez.Hi ,
just a hint: try a forum search before you post a new question was answered many times. A forum search with "numeric textfield" found this:
http://forum.java.sun.com/thread.jsp?forum=54&thread=107812
Might help.
Phil -
How to apply the constraint ONLY to new rows
Hi, Gurus:
I have one question as follows:
We need to migrate a legacy system to a new production server. I am required to add two columns to every table in order to record who updates the row most recently through triggers, and I should apply not null constraint to the columns . However, since legacy system already has data for every table, and old data does not have value for the 2 new columns. If we apply the constraint, all of existing rows will raise exception. I wonder if there is possibility to apply the constraint ONLY to new rows to come in future.
Thanks.
SamWe need to migrate a legacy system to a new production server. I am required to add two columns to every table in order to record who updates the row most recently through triggers, and I should apply not null constraint to the columns .
The best suggestion I can give you is that you make sure management documents the name of the person that came up with that hair-brained requirement so they can be sufficiently punished in the future for the tremendous waste of human and database resources they caused for which they got virtually NOTHING in return.
I have seen many systems over the past 25+years that have added columns such as those: CREATED_DATE, CREATED_BY, MODIFIED_DATE, MODIFIED_BY.
I have yet to see even ONE system where that information is actually useful for any real purpose. Many systems have application/schema users and those users can modify the data. Also, any DBA can modify the data and many of them can connect as the schema owner to do that.
Many tables also get updated by other applications or bulk load processes and those processes use generic connections that can NOT be tied back to any particular system.
The net result is that those columns will be populated by user names that are utterly useless for any auditing purposes.
If a user is allowed to modify a table they are allowed to modify a table. If you want to track that you should implement a proper security strategy using Oracle's AUDIT functionality.
Cluttering up ALL, or even many, of your tables with such columns is a TERRIBLE idea. Worse is adding triggers that server no other purpose but capture useless infomation but, because they are PL/SQL cause performance impacts just aggravates the total impact.
It is certainly appropriate to be concerned about the security and auditability of your important data. But adding columns and triggers such as those proposed is NOT the proper solution to achieve that security.
Before your organization makes such an idiotic decision you should propose that the same steps be taken before adding that functionality that you should take before the addition of ANY MAJOR structural or application changes:
1. document the actual requirement
2. document and justify the business reasons for that requirement
3. perform testing that shows the impact of that requirement on the production system
4. determine the resource cost (people, storage, etc) of implementing that requirement
5. demonstrate how that information will actually be used EFFECTIVELY for some business purpose
As regards items #1 and #2 above the requirement should be stated in terms of the PROBLEM to be solved, not some preconceived notion of the solution that should be used.
Your org should also talk to other orgs or other depts in your same org that have used your proposed solution and find out how useful it has been for them. If you do this research you will likely find that it hasn't met their needs at all.
And in your own org there are likely some applications with tables that already have such columns. Has anyone there EVER used those columns and found them invaluable for identifying and resolving any actual problem?
If you can't use them and their data for some important process why add them to begin with?
IMHO it is a total waste of time and resources to add such columns to ALL of your tables. Any such approach to auditing or security should, at most, be limited to those tables with key data that needs to be protected and only then when you cannot implement the proper 'best practices' auditing.
A migration is difficult enough without adding useless additional requirements like those. You have FAR more important things you can do with the resources you have available:
1. Capture ALL DDL for the existing system into a version control system
2. Train your developers on using the version control system
3. Determining the proper configuration of the new server and system. It is almost a CERTAINTY that settings will get changed and performance will suffer even though you don't think you have changed anything at all.
4. Validating that the data has been migrated successfully. That can involve extensive querying and comparison to make sure data has not been altered during the migration. The process of validating a SINGLE TABLE is more difficult if the table structures are not the same. And they won't be if you add two columns to every table; every single query you do will have to specify the columns by name in order to EXCLUDE your two new columns.
5. Validating the performance of the app on the new system. There WILL BE problems where things don't work like they used to. You need to find those problems and fix them
6. Capturing the proper statistics after the data has been migrated and all of the indexes have been rebuilt.
7. Capturing the new execution plans to use a a baseline for when things go wrong in the future.
If it is worth doing it is worth doing right. -
[Solved] how do i build my ISO image with archiso?
hi all
i've been following this wiki and it's been going really well (it hasn't gone wrong...). but the wiki page just sort of stops halfway through the configuration bit
a google search brought me to this page which suggests using the "build.sh" script located in my chroot environment's /tmp/releng/ directory.
running this script returns the error "build.sh: line 207: syntax error near unexpected token '('
line 207 of the file reads:
paste -d"\n" <(sed "s|%ARCH%|i686|g" ${script_path}/aitab.${_iso_type}) \
i don't really know much about scripts so i can't see what's wrong
any advice?
sorry if i've missed a wiki or something n00bish like that. also i'm aware that someone who doesn't know what they're doing shouldn't be attempting archiso but i thought it would be a fun learning experience
here's the full build.sh in case it is helpful:
#!/bin/bash
set -e -u
iso_name=archlinux
iso_label="ARCH_$(date +%Y%m)"
iso_version=$(date +%Y.%m.%d)
install_dir=arch
arch=$(uname -m)
work_dir=work
out_dir=out
verbose=""
script_path=$(readlink -f ${0%/*})
# Base installation (root-image)
make_basefs() {
mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" -p "base" create
mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" -p "memtest86+ syslinux mkinitcpio-nfs-utils nbd curl" create
# Additional packages (root-image)
make_packages() {
mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" -p "$(grep -v ^# ${script_path}/packages.${arch})" create
# Copy mkinitcpio archiso hooks (root-image)
make_setup_mkinitcpio() {
if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
local _hook
for _hook in archiso archiso_shutdown archiso_pxe_common archiso_pxe_nbd archiso_pxe_http archiso_pxe_nfs archiso_loop_mnt; do
cp /lib/initcpio/hooks/${_hook} ${work_dir}/root-image/lib/initcpio/hooks
cp /lib/initcpio/install/${_hook} ${work_dir}/root-image/lib/initcpio/install
done
cp /lib/initcpio/install/archiso_kms ${work_dir}/root-image/lib/initcpio/install
cp /lib/initcpio/archiso_shutdown ${work_dir}/root-image/lib/initcpio
cp /lib/initcpio/archiso_pxe_nbd ${work_dir}/root-image/lib/initcpio
cp ${script_path}/mkinitcpio.conf ${work_dir}/root-image/etc/mkinitcpio-archiso.conf
: > ${work_dir}/build.${FUNCNAME}
fi
# Prepare ${install_dir}/boot/
make_boot() {
if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
local _src=${work_dir}/root-image
local _dst_boot=${work_dir}/iso/${install_dir}/boot
mkdir -p ${_dst_boot}/${arch}
mkarchroot -n -r "mkinitcpio -c /etc/mkinitcpio-archiso.conf -k /boot/vmlinuz-linux -g /boot/archiso.img" ${_src}
mv ${_src}/boot/archiso.img ${_dst_boot}/${arch}/archiso.img
mv ${_src}/boot/vmlinuz-linux ${_dst_boot}/${arch}/vmlinuz
cp ${_src}/boot/memtest86+/memtest.bin ${_dst_boot}/memtest
cp ${_src}/usr/share/licenses/common/GPL2/license.txt ${_dst_boot}/memtest.COPYING
: > ${work_dir}/build.${FUNCNAME}
fi
# Prepare /${install_dir}/boot/syslinux
make_syslinux() {
if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
local _src_syslinux=${work_dir}/root-image/usr/lib/syslinux
local _dst_syslinux=${work_dir}/iso/${install_dir}/boot/syslinux
mkdir -p ${_dst_syslinux}
for _cfg in ${script_path}/syslinux/*.cfg; do
sed "s|%ARCHISO_LABEL%|${iso_label}|g;
s|%INSTALL_DIR%|${install_dir}|g;
s|%ARCH%|${arch}|g" ${_cfg} > ${_dst_syslinux}/${_cfg##*/}
done
cp ${script_path}/syslinux/splash.png ${_dst_syslinux}
cp ${_src_syslinux}/*.c32 ${_dst_syslinux}
cp ${_src_syslinux}/*.com ${_dst_syslinux}
cp ${_src_syslinux}/*.0 ${_dst_syslinux}
cp ${_src_syslinux}/memdisk ${_dst_syslinux}
mkdir -p ${_dst_syslinux}/hdt
wget -O - http://pciids.sourceforge.net/v2.2/pci.ids | gzip -9 > ${_dst_syslinux}/hdt/pciids.gz
cat ${work_dir}/root-image/lib/modules/*-ARCH/modules.alias | gzip -9 > ${_dst_syslinux}/hdt/modalias.gz
: > ${work_dir}/build.${FUNCNAME}
fi
# Prepare /isolinux
make_isolinux() {
if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
mkdir -p ${work_dir}/iso/isolinux
sed "s|%INSTALL_DIR%|${install_dir}|g" ${script_path}/isolinux/isolinux.cfg > ${work_dir}/iso/isolinux/isolinux.cfg
cp ${work_dir}/root-image/usr/lib/syslinux/isolinux.bin ${work_dir}/iso/isolinux/
cp ${work_dir}/root-image/usr/lib/syslinux/isohdpfx.bin ${work_dir}/iso/isolinux/
: > ${work_dir}/build.${FUNCNAME}
fi
# Customize installation (root-image)
# NOTE: mkarchroot should not be executed after this function is executed, otherwise will overwrites some custom files.
make_customize_root_image() {
if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
cp -af ${script_path}/root-image ${work_dir}
chmod 750 ${work_dir}/root-image/etc/sudoers.d
chmod 440 ${work_dir}/root-image/etc/sudoers.d/g_wheel
mkdir -p ${work_dir}/root-image/etc/pacman.d
wget -O ${work_dir}/root-image/etc/pacman.d/mirrorlist http://www.archlinux.org/mirrorlist/all/
sed -i "s/#Server/Server/g" ${work_dir}/root-image/etc/pacman.d/mirrorlist
chroot ${work_dir}/root-image /usr/sbin/locale-gen
chroot ${work_dir}/root-image /usr/sbin/useradd -m -p "" -g users -G "audio,disk,optical,wheel" arch
: > ${work_dir}/build.${FUNCNAME}
fi
# Split out /lib/modules from root-image (makes more "dual-iso" friendly)
make_lib_modules() {
if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
mv ${work_dir}/root-image/lib/modules ${work_dir}/lib-modules
: > ${work_dir}/build.${FUNCNAME}
fi
# Split out /usr/share from root-image (makes more "dual-iso" friendly)
make_usr_share() {
if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
mv ${work_dir}/root-image/usr/share ${work_dir}/usr-share
: > ${work_dir}/build.${FUNCNAME}
fi
# Make [core] repository, keep "any" pkgs in a separate fs (makes more "dual-iso" friendly)
make_core_repo() {
if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
local _url _urls _pkg_name _cached_pkg _dst _pkgs
mkdir -p ${work_dir}/repo-core-any
mkdir -p ${work_dir}/repo-core-${arch}
pacman -Sy
_pkgs=$(comm -2 -3 <(pacman -Sql core | sort | sed 's@^@core/@') \
<(grep -v ^# ${script_path}/core.exclude.${arch} | sort | sed 's@^@core/@'))
_urls=$(pacman -Sddp ${_pkgs})
pacman -Swdd --noprogressbar --noconfirm ${_pkgs}
for _url in ${_urls}; do
_pkg_name=${_url##*/}
_cached_pkg=/var/cache/pacman/pkg/${_pkg_name}
_dst=${work_dir}/repo-core-${arch}/${_pkg_name}
cp ${_cached_pkg} ${_dst}
repo-add -q ${work_dir}/repo-core-${arch}/core.db.tar.gz ${_dst}
if [[ ${_pkg_name} == *any.pkg.tar* ]]; then
mv ${_dst} ${work_dir}/repo-core-any/${_pkg_name}
ln -sf ../any/${_pkg_name} ${_dst}
fi
done
: > ${work_dir}/build.${FUNCNAME}
fi
# Process aitab
# args: $1 (core | netinstall)
make_aitab() {
local _iso_type=${1}
if [[ ! -e ${work_dir}/build.${FUNCNAME}_${_iso_type} ]]; then
sed "s|%ARCH%|${arch}|g" ${script_path}/aitab.${_iso_type} > ${work_dir}/iso/${install_dir}/aitab
: > ${work_dir}/build.${FUNCNAME}_${_iso_type}
fi
# Build all filesystem images specified in aitab (.fs .fs.sfs .sfs)
make_prepare() {
mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" prepare
# Build ISO
# args: $1 (core | netinstall)
make_iso() {
local _iso_type=${1}
mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" checksum
mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" -L "${iso_label}" -o "${out_dir}" iso "${iso_name}-${iso_version}-${_iso_type}-${arch}.iso"
# Build dual-iso images from ${work_dir}/i686/iso and ${work_dir}/x86_64/iso
# args: $1 (core | netinstall)
make_dual() {
local _iso_type=${1}
if [[ ! -e ${work_dir}/dual/build.${FUNCNAME}_${_iso_type} ]]; then
if [[ ! -d ${work_dir}/i686/iso || ! -d ${work_dir}/x86_64/iso ]]; then
echo "ERROR: i686 or x86_64 builds does not exist."
_usage 1
fi
local _src_one _src_two _cfg
if [[ ${arch} == "i686" ]]; then
_src_one=${work_dir}/i686/iso
_src_two=${work_dir}/x86_64/iso
else
_src_one=${work_dir}/x86_64/iso
_src_two=${work_dir}/i686/iso
fi
mkdir -p ${work_dir}/dual/iso
cp -a -l -f ${_src_one} ${work_dir}/dual
cp -a -l -n ${_src_two} ${work_dir}/dual
rm -f ${work_dir}/dual/iso/${install_dir}/aitab
rm -f ${work_dir}/dual/iso/${install_dir}/boot/syslinux/*.cfg
if [[ ${_iso_type} == "core" ]]; then
if [[ ! -e ${work_dir}/dual/iso/${install_dir}/any/repo-core-any.sfs ||
! -e ${work_dir}/dual/iso/${install_dir}/i686/repo-core-i686.sfs ||
! -e ${work_dir}/dual/iso/${install_dir}/x86_64/repo-core-x86_64.sfs ]]; then
echo "ERROR: core_iso_single build is not found."
_usage 1
fi
else
rm -f ${work_dir}/dual/iso/${install_dir}/any/repo-core-any.sfs
rm -f ${work_dir}/dual/iso/${install_dir}/i686/repo-core-i686.sfs
rm -f ${work_dir}/dual/iso/${install_dir}/x86_64/repo-core-x86_64.sfs
fi
paste -d"\n" <(sed "s|%ARCH%|i686|g" ${script_path}/aitab.${_iso_type}) \
<(sed "s|%ARCH%|x86_64|g" ${script_path}/aitab.${_iso_type}) | uniq > ${work_dir}/dual/iso/${install_dir}/aitab
for _cfg in ${script_path}/syslinux.dual/*.cfg; do
sed "s|%ARCHISO_LABEL%|${iso_label}|g;
s|%INSTALL_DIR%|${install_dir}|g" ${_cfg} > ${work_dir}/dual/iso/${install_dir}/boot/syslinux/${_cfg##*/}
done
mkarchiso ${verbose} -w "${work_dir}/dual" -D "${install_dir}" checksum
mkarchiso ${verbose} -w "${work_dir}/dual" -D "${install_dir}" -L "${iso_label}" -o "${out_dir}" iso "${iso_name}-${iso_version}-${_iso_type}-dual.iso"
: > ${work_dir}/dual/build.${FUNCNAME}_${_iso_type}
fi
purge_single ()
if [[ -d ${work_dir} ]]; then
find ${work_dir} -mindepth 1 -maxdepth 1 \
! -path ${work_dir}/iso -prune \
| xargs rm -rf
fi
purge_dual ()
if [[ -d ${work_dir}/dual ]]; then
find ${work_dir}/dual -mindepth 1 -maxdepth 1 \
! -path ${work_dir}/dual/iso -prune \
| xargs rm -rf
fi
clean_single ()
rm -rf ${work_dir}
rm -f ${out_dir}/${iso_name}-${iso_version}-*-${arch}.iso
clean_dual ()
rm -rf ${work_dir}/dual
rm -f ${out_dir}/${iso_name}-${iso_version}-*-dual.iso
make_common_single() {
make_basefs
make_packages
make_setup_mkinitcpio
make_boot
make_syslinux
make_isolinux
make_customize_root_image
make_lib_modules
make_usr_share
make_aitab $1
make_prepare $1
make_iso $1
_usage ()
echo "usage ${0} [options] command <command options>"
echo
echo " General options:"
echo " -N <iso_name> Set an iso filename (prefix)"
echo " Default: ${iso_name}"
echo " -V <iso_version> Set an iso version (in filename)"
echo " Default: ${iso_version}"
echo " -L <iso_label> Set an iso label (disk label)"
echo " Default: ${iso_label}"
echo " -D <install_dir> Set an install_dir (directory inside iso)"
echo " Default: ${install_dir}"
echo " -w <work_dir> Set the working directory"
echo " Default: ${work_dir}"
echo " -o <out_dir> Set the output directory"
echo " Default: ${out_dir}"
echo " -v Enable verbose output"
echo " -h This help message"
echo
echo " Commands:"
echo " build <mode> <type>"
echo " Build selected .iso by <mode> and <type>"
echo " purge <mode>"
echo " Clean working directory except iso/ directory of build <mode>"
echo " clean <mode>"
echo " Clean working directory and .iso file in output directory of build <mode>"
echo
echo " Command options:"
echo " <mode> Valid values 'single' or 'dual'"
echo " <type> Valid values 'netinstall', 'core' or 'all'"
exit ${1}
if [[ ${EUID} -ne 0 ]]; then
echo "This script must be run as root."
_usage 1
fi
while getopts 'N:V:L:D:w:o:vh' arg; do
case "${arg}" in
N) iso_name="${OPTARG}" ;;
V) iso_version="${OPTARG}" ;;
L) iso_label="${OPTARG}" ;;
D) install_dir="${OPTARG}" ;;
w) work_dir="${OPTARG}" ;;
o) out_dir="${OPTARG}" ;;
v) verbose="-v" ;;
h|?) _usage 0 ;;
_msg_error "Invalid argument '${arg}'" 0
_usage 1
esac
done
shift $((OPTIND - 1))
if [[ $# -lt 1 ]]; then
echo "No command specified"
_usage 1
fi
command_name="${1}"
if [[ $# -lt 2 ]]; then
echo "No command mode specified"
_usage 1
fi
command_mode="${2}"
if [[ ${command_name} == "build" ]]; then
if [[ $# -lt 3 ]]; then
echo "No build type specified"
_usage 1
fi
command_type="${3}"
fi
if [[ ${command_mode} == "single" ]]; then
work_dir=${work_dir}/${arch}
fi
case "${command_name}" in
build)
case "${command_mode}" in
single)
case "${command_type}" in
netinstall)
make_common_single netinstall
core)
make_core_repo
make_common_single core
all)
make_common_single netinstall
make_core_repo
make_common_single core
echo "Invalid build type '${command_type}'"
_usage 1
esac
dual)
case "${command_type}" in
netinstall)
make_dual netinstall
core)
make_dual core
all)
make_dual netinstall
make_dual core
echo "Invalid build type '${command_type}'"
_usage 1
esac
echo "Invalid build mode '${command_mode}'"
_usage 1
esac
purge)
case "${command_mode}" in
single)
purge_single
dual)
purge_dual
echo "Invalid purge mode '${command_mode}'"
_usage 1
esac
clean)
case "${command_mode}" in
single)
clean_single
dual)
clean_dual
echo "Invalid clean mode '${command_mode}'"
_usage 1
esac
echo "Invalid command name '${command_name}'"
_usage 1
esac
Last edited by gav989 (2012-02-12 10:59:11)thanks for that, according to this it should be run like
/path/to/build.sh build single netinstall
from inside the chroot
posting this for my own reference and in case it helps others, will mark as solved
thanks again for your help
Last edited by gav989 (2012-02-12 10:58:04) -
Page Exporter Utility (PEU) 5 Script
I love this script, It really has potential to shave valuable time off of our production (exporting Hundreds of pages manually to single files is tedious and time consuming). The problem I'm having is I'm hesitant to us it because it dosn't show warnings when there is a missing link or font. There's also no warning when it overwrites a file. My question is dose anyone know how to unsuppress the warnings? I've looked over the script and don't see anything that is actively suppressing them.
Thanks
Dan
// PageExporterUtility5.0.js
// An InDesign CS JavaScript
// 08 NOV 2007
// Copyright (C) 2007 Scott Zanelli. Lonelytree Software. (www.lonelytreesw.com)
// Coming to you from Quincy, MA, USA
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
var peuINFO = new Array();
peuINFO["csVersion"] = parseInt(app.version);
// Save the old interaction level
if(peuINFO.csVersion == 3) { //CS1
peuINFO["oldInteractionPref"] = app.userInteractionLevel;
app.userInteractionLevel = UserInteractionLevels.interactWithAll;
else { //CS2+
peuINFO["oldInteractionPref"] = app.scriptPreferences.userInteractionLevel;
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;
// See if a document is open. If not, exit
if((peuINFO["numDocsToExport"] = app.documents.length) == 0){
byeBye("Please open a document and try again.",true);
// Global Variable Initializations
var VERSION_NAME = "Page Exporter Utility 5.0"
var pseudoSingleton = 0;
var progCurrentPage = 0;// Used for progress bar
var progTotalPages = 0; // Used for progress bar
var commonBatchINFO = getNewTempENTRY(); // Used if "Set For All Batch Jobs" is selected
commonBatchINFO["infoLoaded"] = false;
peuInit(); // Initialize commonly needed info
// Store information needed for batch processing (valid for single also)
var printINFO = new Array();
// Get all needed info by looping for each document being exported
for(currentDoc = 0; currentDoc < peuINFO.numDocsToExport; currentDoc++) {
// Get name of document and set it as the base name
// minus the extention if it exists
var tempENTRY = getNewTempENTRY(); // "Struct" for current document info
tempENTRY.theDoc = app.documents[currentDoc]
tempENTRY.singlePage = (tempENTRY.theDoc.documentPreferences.pagesPerDocument==1)?true:false;
tempENTRY.getOut = true;
var baseName = (tempENTRY.theDoc.name.split(".ind"))[0];
// Display the dialog box and loop for correct info
if((!commonBatchINFO.infoLoaded && peuINFO.batchSameForAll) || (!peuINFO.batchSameForAll) ){// get all info
do{
tempENTRY.getOut = true; // For handling input errors
var mainDialog = createMainDialog(tempENTRY.theDoc.name, currentDoc+1, peuINFO.numDocsToExport);
// Exit if cancel button chosen
if(!mainDialog.show() ){
mainDialog.destroy();
byeBye("Exporting has canceled by user.",peuINFO.sayCancel);
if(formatTypeRB.selectedButton == 4 - peuINFO.adjustForNoPS){
changePrefs();
tempENTRY.getOut = false;
continue;
// Read info from dialog items and keep as defaults and place in tempENTRY
peuINFO.defaultDir = outputDirs.selectedIndex;
// The index of the selected directory is the same as the
// index in the array of directories.
tempENTRY.outDir = peuINFO.dirListArray[peuINFO.defaultDir];
// Type of renaming to do
tempENTRY.nameConvType = namingConvention.selectedButton
// The base name to add page info to
tempENTRY.baseName = removeColons(removeSpaces(newBaseName.editContents) );
// The start [and end] page numbers
var startEndPgs = startEndPgs.editContents;
// Wether to do spreads or not
peuINFO.doSpreadsON = (doSpreads.checkedState)?1:0;
tempENTRY.doSpreadsON = peuINFO.doSpreadsON;
// Wether to send entire file as one document
peuINFO.doOneFile = (oneFile.checkedState)?1:0;
tempENTRY.doOneFile = peuINFO.doOneFile;
// Export format type
tempENTRY.formatType = formatTypeRB.selectedButton + peuINFO.adjustForNoPS;
// Set persistence during warnings
peuINFO.editStartEndPgs = startEndPgs;
baseName = tempENTRY.baseName;
peuINFO.exportDefaultType = tempENTRY.formatType;
// Determine if page replacement token exists when the page token option is used
if(peuINFO.pageNamePlacement == 2){
var temp = tempENTRY.baseName.indexOf("<#>");
if(temp == -1){//Token isn't there
alert("There is no page item token (<#>) in the base name. Please add one or change the page naming placement preference.");
tempENlert.getOut = false;
pseudoSingleton--; // Allow prefs to be accessed again, but just once
continue;
else
pseudoSingleton++;
else // Try to remove any <#>s as a precaution
tempENTRY.baseName = tempENTRY.baseName.replace(/<#>/g,"");
// Layer Versioning & Batch options
if(currentDoc < 1){
peuINFO.layersON = (doLayers.checkedState)?1:0;
if(peuINFO.numDocsToExport > 1){
peuINFO.batchSameForAll = (commonBatch.checkedState)?1:0;
peuINFO.batchON = (doBatch.checkedState)?1:0;
if(!peuINFO.batchON)
peuINFO.numDocsToExport = 1;
//Check if spreads chosen with 'Add ".L"' option as this isn't supported.
if(peuINFO.doSpreadsON && tempENTRY.nameConvType == 1){
alert ("Spreads cannot be used with the 'Add \".L\"' option.\nThis combination is not supported. (1.1)");
tempENTRY.nameConvType = 0;
tempENTRY.getOut = false;
continue;
else if(peuINFO.doSpreadsON && tempENTRY.nameConvType == 4){
alert ("Spreads cannot be used with the 'Numeric Override' option.\nThis combination is not supported. (1.2)");
tempENTRY.nameConvType = 0;
tempENTRY.getOut = false;
continue;
// Check if "Send Entire File At Once" is selected with JPG or EPS
if(peuINFO.doOneFile && tempENTRY.formatType > 1 ){
alert ("The 'Send Entire File At Once' option can only be used with PostScript or PDF formats. (1.3)");
tempENTRY.getOut = false;
continue;
// Check if: batch printing and using the "Same for all jobs options" and a page range other than "All" was used
if(peuINFO.doBatch && peuINFO.batchSameForAll && startEndPgs != "All"){
alert ("The 'Set For All Batch Jobs' option can only be used with a Page Range of 'All'. Page Range has been reset to 'All'. (1.4)");
startEndPgs = "All";
// Create page info, skip if doing entire file as one
var tempPageCount = 0;
if(tempENTRY.doOneFile)
tempPageCount = 1;
else{
// Get names of all the pages. Needed when pages are named using sectioning
tempENTRY = recordPgNames(tempENTRY);
// Check Page Validity and get Page counts of entered section(s)
var temp = checkPages(tempENTRY, startEndPgs);
tempENTRY = temp[0];
tempPageCount = temp[1];
temp = null; // Free it up
} while(!tempENTRY.getOut);
// Remove dialog from memory
mainDialog.destroy();
// Determine if tag will fit correctly
tempENTRY.useTag = usePgInfoTag(tempENTRY.theDoc.viewPreferences.horizontalMeasurementUnits,tempENTRY.theDoc.documentPreferences.pageWidth);
// Get the format info for this document
switch(tempENTRY.formatType){
case 0://PS
tempENTRY.psINFO = getPSoptions(tempENTRY.theDoc.name.split(".ind")[0]);
break;
case 1://PDF
tempENTRY.pdfPRESET = getPDFoptions(tempENTRY);
break;
case 2: // EPS Formatting
tempENTRY.epsINFO = getEPSoptions(tempENTRY.theDoc.name.split(".ind")[0]);
peuINFO.origSpread = app.epsExportPreferences.epsSpreads;// Used to reset to original state when done
app.epsExportPreferences.epsSpreads = peuINFO.doSpreadsON;
break;
case 3: // JPEG Formatting
tempENTRY.jpegINFO = getJPEGoptions(tempENTRY.theDoc.name.split(".ind")[0]);
break;
// If Specific Directory was chosen for the output directory, get it now
if(peuINFO.defaultDir == 0){
tempENTRY.outDir = getDirectory("Please select the output directory:",peuINFO.startingDirectory);
if(tempENTRY.outDir != null)
tempENTRY.outDir += "/";
else
byeBye("Exporting has been canceled by user.", peuINFO.sayCancel);
// Set the common elements for all batch jobs if it was selected
if(!commonBatchINFO.infoLoaded && peuINFO.batchSameForAll){
commonBatchINFO.infoLoaded = true;
commonBatchINFO.pageNamePlacement = tempENTRY.pageNamePlacement;
commonBatchINFO.outDir = tempENTRY.outDir;
commonBatchINFO.nameConvType = tempENTRY.nameConvType
commonBatchINFO.doSpreadsON = tempENTRY.doSpreadsON;
commonBatchINFO.doOneFile = tempENTRY.doOneFile;
commonBatchINFO.formatType = tempENTRY.formatType;
commonBatchINFO.psINFO = tempENTRY.psINFO;
commonBatchINFO.pdfPRESET = tempENTRY.pdfPRESET
commonBatchINFO.epsINFO = tempENTRY.epsINFO
commonBatchINFO.jpegINFO = tempENTRY.jpegINFO;
} // End each/first of batch
else{ // Get the base name for other batch jobs
do{
tempENTRY.getOut = true;
var nameDialog = app.dialogs.add({name:(VERSION_NAME + ": Base Name for \"" + tempENTRY.theDoc.name + "\"" + ((peuINFO.numDocsToExport==1)?"":" (" + (currentDoc+1) + " of " + peuINFO.numDocsToExport + " documents)") ), canCancel:true} );
with (nameDialog){
with (dialogColumns.add() ){
with(dialogRows.add() ){
staticTexts.add({staticLabel:"Enter the Base Name for \"" + tempENTRY.theDoc.name + "\""} );
var newBaseName = textEditboxes.add({editContents:baseName, minWidth:135} );
with(dialogRows.add() )
staticTexts.add({staticLabel:"", minWidth:400} );
if(!nameDialog.show() ){
nameDialog.destroy();
byeBye("User canceled export.",peuINFO.sayCancel);
else{
tempENTRY.baseName = removeColons(removeSpaces(newBaseName.editContents) );
nameDialog.destroy();
// Determine if page replacement token exists when the page token option is used
if(peuINFO.pageNamePlacement == 2){
var temp = tempENTRY.baseName.indexOf("<#>");
if(temp == -1){//Token isn't there
alert("There is no page item token (<#>) in the base name. Please add one or click cancel in the next dialog box.");
tempENTRY.getOut = false;
else // Try to remove any <#>s as a precaution
tempENTRY.baseName = tempENTRY.baseName.replace(/<#>/g,"");
}while(!tempENTRY.getOut);
// Get names of all the pages. Needed when pages are named using sectioning
tempENTRY = recordPgNames(tempENTRY);
// Set pgStart and pgEnd, forcing "All" pages to output
tempENTRY = (checkPages(tempENTRY, "All"))[0];
// The page count is all pages due to common batching
tempPageCount = tempENTRY.theDoc.pages.length;
// This info is common, get it from commonBatchINFO:
tempENTRY.pageNamePlacement = commonBatchINFO.pageNamePlacement;
tempENTRY.outDir = commonBatchINFO.outDir;
tempENTRY.nameConvType = commonBatchINFO.nameConvType
tempENTRY.doSpreadsON = commonBatchINFO.doSpreadsON;
tempENTRY.doOneFile = commonBatchINFO.doOneFile;
tempENTRY.formatType = commonBatchINFO.formatType;
tempENTRY.psINFO = commonBatchINFO.psINFO;
tempENTRY.pdfPRESET = commonBatchINFO.pdfPRESET
tempENTRY.epsINFO = commonBatchINFO.epsINFO
tempENTRY.jpegINFO = commonBatchINFO.jpegINFO;
// Get any layering info
if(peuINFO.layersON){
tempENTRY.layerINFO = layerManager(tempENTRY.theDoc);
if (tempENTRY.layerINFO == null) // Only one layer, turn it off for this doc
tempENTRY.layersON = false;
else
tempENTRY.layersON = true;
// Sum up pages for the grand total for use in progress bar
var temp = 1;
if(peuINFO.doProgressBar && tempENTRY.layersON){
// Figure tally for progress bar to include versions
for(i=0;i < tempENTRY.layerINFO.verControls.length; i++)
if (tempENTRY.layerINFO.verControls[i] == 1)
temp++;
if(!peuINFO.baseLaersAsVersion)
temp--;
progTotalPages += (tempPageCount*temp);
// All info for this doc is finally gathered, add it to the main printINFO array
printINFO.push(tempENTRY);
// Only one chance to change prefs: trigger singleton
pseudoSingleton++;
}// end of main for loop
savePrefs(); // Record any changes
// Initiallize progress bar if available
if(peuINFO.doProgressBar)
app.createProgressBar("Exporting Pages...", 0, progTotalPages, true);
// Export by looping through all open documents if using batch option, otherwise just the front document is exported
for(currentDoc = 0; currentDoc < printINFO.length; currentDoc++){
var currentINFO = printINFO[currentDoc];
// Set message in progress bar if available
if(peuINFO.doProgressBar){
var progCancel = app.setProgress(currentINFO.theDoc.name);
if(progCancel)
byeBye("User canceled export.",peuINFO.sayCancel);
// Set format options here so it's done just once per document
setExportOption(currentINFO);
// "Do one file" or PS/PDF with one page:
if (currentINFO.doOneFile || currentINFO.singlePage){
// Remove page token if it was entered and this name positioning option is set
currentINFO.baseName = currentINFO.baseName.replace(/<#>/g,"");
if(currentINFO.layersON){
var theLayers = currentINFO.theDoc.layers;
var baseControls = currentINFO.layerINFO.baseControls;
var versionControls = currentINFO.layerINFO.verControls;
var lastVersion = -1;
// Loop for versioning
for(v = 0; v < versionControls.length; v++){
if(!versionControls[v])
continue;
if(lastVersion != -1)// Turn the last layer back off
theLayers[lastVersion].visible = false;
lastVersion = v;
theLayers[v].visible = true;
currentINFO.outfileName = addPartToName(currentINFO.baseName, theLayers[v].name, peuINFO.layerBeforeON)
// Export this version
exportPage(currentINFO, PageRange.allPages);
// Advance progress bar if available
if(peuINFO.doProgressBar)
advanceBar();
// If Base layer/s is/are to be output as a version, do it now
if(peuINFO.baseLaersAsVersion){
lastVersion = -1;
// Turn off all versioning layers
for(v = 0; v < currentINFO.layerINFO.baseControls.length; v++){
if(currentINFO.layerINFO.baseControls[v])// its a base layer, keep track of last base version layer number
lastVersion = v;
else
theLayers[v].visible = false;
if (!lastVersion == -1){// Only export if there was a base version
currentINFO.outfileName = addPartToName(currentINFO.baseName, theLayers[lastVersion].name, peuINFO.layerBeforeON);
// Export the base layer(s)
exportPage(currentINFO, PageRange.allPages);
// Advance progress bar if available
if(peuINFO.doProgressBar)
advanceBar();
else{ // No layer versioning, just export
currentINFO.outfileName = currentINFO.baseName;
// Export the base layer(s)
exportPage(currentINFO, PageRange.allPages);
// Advance progress bar if available
if(peuINFO.doProgressBar)
advanceBar();
if(!peuINFO.batchON)
byeBye("Done exporting as a single file.",true);
else{ // Do single pages/spreads
if (!currentINFO.hasNonContig)
// Pages are contiguous, can just export
outputPages(currentINFO.pgStart, currentINFO.pgEnd, currentINFO);
else{ // Export non-contiguous
// Loop through array of page sections
for (ii = 0; ii < currentINFO.nonContigPgs.length; ii++){
temp = currentINFO.nonContigPgs[ii];
// Here we handle the start/end pages for any non-contig that has "-"
if (temp.indexOf("-") != -1){
temp2 = temp.split("-");
outputPages(temp2[0],temp2[1], currentINFO);
else // The non-contiguous page is a single page
outputPages(temp, temp, currentINFO);
// Set the spread settings back to what it was originally
try{
switch (currentINFO.formatType){
case 0: // PostScript Formatting
theDoc.printPreferences.printSpreads = peuINFO.origSpread;
break;
case 1: // PDF Formatting
currentINFO.pdfPRESET.exportReaderSpreads = peuINFO.origSpread;
break;
case 2: // EPS Formatting
app.epsExportPreferences.epsSpreads = peuINFO.origSpread;
break;
case 3: // JPEG Formatting
app.jpegExportPreferences.exportingSpread = peuINFO.origSpread;
break;
catch(e){/*Just ignore it*/}
byeBye("The requested pages are done being exported.",true); // Last line of script execution
/* Operational Functions */
* Handle exporting
function outputPages(pgStart, pgEnd, currentINFO){
var pgRange;
var layerName = "";
var numVersions;
var currentPage;
var lastVersion = -1;
var numericallyLastPage;
if (currentINFO.layersON){
var theLayers = currentINFO.theDoc.layers;
var baseControls = currentINFO.layerINFO.baseControls;
var versionControls = currentINFO.layerINFO.verControls;
numVersions = versionControls.length;
// Compensate for base layers as a version
if(peuINFO.baseLaersAsVersion)
numVersions++;
else
numVersions = 1;
for (v = 0; v < numVersions; v++){
if(currentINFO.layersON){
if(v == (numVersions - 1) && peuINFO.baseLaersAsVersion){
var currentLayer = -1;
// Base layer(s) are to be output as a version
// Turn off all versioning layers
for(slbm = 0; slbm < baseControls.length; slbm++){
if(baseControls[slbm])// its a base layer, use its name for page name
currentLayer = slbm;
else
theLayers[slbm].visible = false;
// Check if there was no base layer at all
if (currentLayer == -1)
layerName = "**NO_BASE**"
else
layerName = theLayers[currentLayer].name;
else{
if(!versionControls[v])
continue;
if(lastVersion != -1)// Turn the last layer back off
theLayers[lastVersion].visible = false;
lastVersion = v;
theLayers[v].visible = true;
layerName = theLayers[v].name;
if (currentINFO.nameConvType == 4){
currentPage = pgStart;
numericallyLastPage = pgEnd;
else if (currentINFO.doSpreadsON){
currentPage = pgStart - 1;
numericallyLastPage = pgEnd;
else {
currentPage = getPageOffset(pgStart, currentINFO.pageNameArray , currentINFO.pageRangeArray);
numericallyLastPage = getPageOffset(pgEnd, currentINFO.pageNameArray, currentINFO.pageRangeArray);
if(layerName != "**NO_BASE**"){
do{
currentINFO.outfileName = getPageName(currentPage, layerName, currentINFO);
if (currentINFO.doSpreadsON){
pgRange = currentINFO.pageRangeArray[getPageOffset(currentINFO.theDoc.spreads[currentPage].pages[0].name, currentINFO.pageNameArray, currentINFO.pageRangeArray)];
else if (currentINFO.nameConvType == 4)
pgRange = currentINFO.pageRangeArray[currentPage-1];
else
pgRange = currentINFO.pageRangeArray[currentPage];
// Do the actual export:
exportPage(currentINFO, pgRange);
// Update progress bar if available
if(peuINFO.doProgressBar)
advanceBar();
currentPage++;
} while(currentPage <= numericallyLastPage);
* Export the page
function exportPage(currentINFO, pgRange){
var outFile = currentINFO.outDir + currentINFO.outfileName;
switch (currentINFO.formatType){
case 0: // PostScript Formatting
with(currentINFO.theDoc.printPreferences){
printFile = new File(outFile + ((currentINFO.psINFO.ext)?".ps":""));
pageRange = pgRange;
// Needed to get around blank pages using separations
try{
currentINFO.theDoc.print(false);
catch(e){/*Just skip it*/}
break;
case 1: // PDF Formatting
app.pdfExportPreferences.pageRange = pgRange;
currentINFO.theDoc.exportFile(ExportFormat.pdfType, (new File(outFile + ".pdf")), false, currentINFO.pdfPRESET);
break;
case 2: // EPS Formatting
app.epsExportPreferences.pageRange = pgRange;
currentINFO.theDoc.exportFile(ExportFormat.epsType, (new File(outFile + ".eps")), false);
break;
case 3: // JPEG Formatting
if(pgRange == PageRange.allPages){
app.jpegExportPreferences.jpegExportRange = ExportRangeOrAllPages.exportAll;
else{
app.jpegExportPreferences.jpegExportRange = ExportRangeOrAllPages.exportRange;
app.jpegExportPreferences.pageString = pgRange;
currentINFO.theDoc.exportFile(ExportFormat.jpg, (new File(outFile + ".jpg")), false);
break;
* Create a name for the page being exported
function getPageName(currentPage, layerName, currentINFO){
var pgRename = "";
if (currentINFO.doSpreadsON)
currentINFO["currentSpread"] = currentINFO.theDoc.spreads[currentPage].pages;
switch (currentINFO.nameConvType){
case 3: // Odd/Even pages/spreads = .LA.F/LA.B, LB.F/LB.B ...
pgRename = makeLotName(currentPage+1, peuINFO.subType);
break;
case 2: // Odd/Even pages/spreads = .F/.B
pgRename = ((currentPage+1)%2 == 0) ? "B" : "F";
break;
case 1: // Add ".L" to the page name
pgRename = "L" + currentINFO.pageNameArray[currentPage];
break;
case 0: case 4:// As is or Numeric Override
// Optionally add "P" and any zeros if options chosen and is numerically named
// otherwise, just the "seperatorChar" is added to page name
if (currentINFO.doSpreadsON){
// Loops through number of pages per spread
// and adds each page name to the final name (P08.P01)
for (j = 0; j < currentINFO.currentSpread.length; j++){
if(currentINFO.currentSpread[j].appliedSection.includeSectionPrefix)
var tempPage = currentINFO.pageRangeArray[getPageOffset(currentINFO.currentSpread[j].name, currentINFO.pageNameArray, currentINFO.pageRangeArray)];
else
var tempPage = currentINFO.pageNameArray[getPageOffset(currentINFO.currentSpread[j].name, currentINFO.pageNameArray, currentINFO.pageRangeArray)];
var tempPageNum = parseInt(tempPage,10);
/* If section name starts with a number, need to compare length of orig vs parsed
* to see if the page name is solely a number or a combo num + letter, etc.
if (! isNaN(tempPageNum) && ((""+tempPage).length == (""+tempPageNum).length )){
if (peuINFO.addZeroON)
tempPage = addLeadingZero(tempPageNum, currentINFO.theDoc.pages.length);
if (peuINFO.addPon)
tempPage = "P" + tempPage;
pgRename = (j==0) ? tempPage : pgRename + peuINFO.charList[peuINFO.seperatorChar] + tempPage;
else {
// Create a new name for an individual page
if (currentINFO.nameConvType == 4)
pgRename = currentPage;
else
pgRename = currentINFO.pageNameArray[currentPage];
if (! isNaN(parseInt(pgRename,10)) && (""+pgRename).length == (""+parseInt(pgRename,10)).length) {
if (peuINFO.addZeroON)
pgRename = addLeadingZero(pgRename, currentINFO.theDoc.pages.length);
if (peuINFO.addPon)
pgRename = "P" + pgRename;
break;
if(currentINFO.layersON)
pgRename = addPartToName(pgRename, layerName, peuINFO.layerBeforeON);
// Add page name to base name based on option selected
if(peuINFO.pageNamePlacement == 2)
pgRename = removeColons(currentINFO.baseName.replace(/<#>/g,pgRename) );
else
pgRename = addPartToName(currentINFO.baseName, pgRename,peuINFO.pageNamePlacement);
return pgRename;
* Add a name part before or after a given base string
function addPartToName(theBase, addThis, addBefore){
//Remove any colons
theBase = removeColons(theBase);
addThis = removeColons(addThis);
return (addBefore) ? (addThis + peuINFO.charList[peuINFO.seperatorChar] + theBase ):(theBase + peuINFO.charList[peuINFO.seperatorChar] + addThis);
* Find the offset page number for a page by its name
function getPageOffset(pgToFind, pageNameArray, pageRangeArray){
var offset;
for(offset = 0; offset<pageRangeArray.length;offset++){
if((""+ pgToFind).toLowerCase() == (("" + pageNameArray[offset]).toLowerCase() ) || (""+ pgToFind).toLowerCase() == (("" + pageRangeArray[offset]).toLowerCase() ) )
return offset;
return -1;
* Replace any colons with specialReplaceChar
function removeColons(tempName){
return tempName.replace(/:/g,peuINFO.charList[peuINFO.specialReplaceChar]);
* Remove spaces from front and end of name
function removeSpaces(theName){
// Trim any leading or trailing spaces in base name
var i,j;
for(i = theName.length-1;i>0 && theName.charAt(i) == " ";i--);// Ignore any spaces on end of name
for(j = 0; j<theName.length && theName.charAt(j) == " ";j++);// Ignore any spaces at front of name
theName = theName.substring(j,i+1);
return theName
* Add leading zero(s)
function addLeadingZero(tempPageNum, pageCount){
if(peuINFO.zeroPadding == 0){
// Normal padding
if((tempPageNum < 10 && pageCount < 100) || (tempPageNum > 9 && pageCount > 99 && tempPageNum < 100))
return addSingleZero(tempPageNum);
else if(tempPageNum < 10 && pageCount > 99)
return addDoubleZero(tempPageNum);
else
return ("" + tempPageNum);
}else if(peuINFO.zeroPadding == 1){
// Pad to 2 digits
if(tempPageNum < 10)
return addSingleZero(tempPageNum);
else
return ("" + tempPageNum);
}else{
// Pad to 3 digits
if(tempPageNum < 10)
return addDoubleZero(tempPageNum);
else if(tempPageNum < 100)
return addSingleZero(tempPageNum);
else
return ("" + tempPageNum);
* Add leading zero helper for single
function addSingleZero(pgNum){
return ("0" + pgNum);
* Add leading zero helper for double
function addDoubleZero(pgNum){
return ("00" + pgNum);
* Create lot name from page number
function makeLotName(thePage, subType){
var iii = thePage;
var curr = 0;
var alphaBet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
var lotName = "L";
if(subType == 0){
while(iii>52){
curr = Math.floor((iii-1)/52)-1;
lotName += alphaBet[curr];
if(curr >= 0)
iii -= 52*(1+curr);
else
iii -= 52;
lotName += alphaBet[Math.floor((iii-1)/2)%26];
else
for(iii=thePage; iii>0; iii-=52)
lotName += alphaBet[Math.floor((iii-1)/2)%26];
return lotName += (thePage & 0x1)?".F":".B";
* Advance progress bar one unit
function advanceBar(){
var progCancel = app.setProgress(++progCurrentPage);
if(progCancel)
byeBye("User canceled export.",peuINFO.sayCancel);
* Create an Empty tempENTRY "struct"
function getNewTempENTRY(){
var newTempENTRY = new Array();
newTempENTRY["theDoc"] = null;
newTempENTRY["singlePage"] = null;
newTempENTRY["getOut"] = null;
newTempENTRY["outDir"] = null;
newTempENTRY["outfileName"] = "";
newTempENTRY["nameConvType"] = null;
newTempENTRY["baseName"] = null;
newTempENTRY["doSpreadsON"] = null;
newTempENTRY["doOneFile"] = null;
newTempENTRY["formatType"] = null;
newTempENTRY["layersON"] = null;
newTempENTRY["hasNonContig"] = false;
newTempENTRY["nonContigPgs"] = null;
newTempENTRY["pageNameArray"] = new Array();
newTempENTRY["pageRangeArray"] = new Array();
newTempENTRY["psINFO"] = null;
newTempENTRY["pdfPRESET"] = null;
newTempENTRY["epsINFO"] = null;
newTempENTRY["jpegINFO"] = null;
newTempENTRY["layerINFO"] = null;
newTempENTRY["useTag"] = null;
newTempENTRY["pgStart"] = null;
newTempENTRY["pgEnd"] = null;
return newTempENTRY;
* Record all the page/spread names
function recordPgNames(tempENTRY){
// Get names of all the pages. Needed when pages are named using sectioning
for (i = 0; i < tempENTRY.theDoc.documentPreferences.pagesPerDocument; i++){
var aPage = tempENTRY.theDoc.pages.item(i);
tempENTRY.pageNameArray[i] = aPage.name;
tempENTRY.pageRangeArray[i] = (aPage.appliedSection.includeSectionPrefix)? aPage.name : (aPage.appliedSection.name + aPage.name);
return tempENTRY;
* Set the export options
function setExportOption(currentINFO){
// Set any options here instead of with each page
switch (currentINFO.formatType){
case 0: // PostScript Formatting
setPSoptions(currentINFO);
break;
case 1: // PDF Formatting
// Nothing to do
break;
case 2: // EPS Formatting
setEPSoptions(currentINFO.epsINFO);
break;
case 3: // JPEG Formatting
setJPEGoptions(currentINFO.jpegINFO);
break;
* Get PostScript format options
function getPSoptions(docName){
var psOptions = new Array();
psOptions["ignore"] = true;
var tempGetOut, PSdlog, pgHeight, pgWidth;
var changeAddPSextention, tempBaseName;
var printPreset;
do{
tempGetOut = true;
PSdlog = app.dialogs.add({name:"PostScript Options for \"" + docName + "\"", canCancel:true} );
with (PSdlog)
with (dialogColumns.add() ){
with (dialogRows.add() )
staticTexts.add({staticLabel:"Print Presets:"} );
printPreset = dropdowns.add({stringList:peuINFO.psPrinterNames , minWidth:236, selectedIndex:peuINFO.defaultPrintPreset} );
with (dialogRows.add() )
staticTexts.add({staticLabel:"Override PS Page Size (" + peuINFO.measureLableArray[peuINFO.measurementUnits] + ")"} );
with (borderPanels.add() )
with (dialogColumns.add() )
with (dialogRows.add() ){
staticTexts.add({staticLabel:"Width:", minWidth:45} );
pgWidth = textEditboxes.add({editContents:"0", minWidth:53} );
staticTexts.add({staticLabel:"Height:", minWidth:45} );
pgHeight = textEditboxes.add({editContents:"0", minWidth:54} );
with (dialogRows.add() ){
staticTexts.add({staticLabel:"Add \".ps\" to end of file name"} );
changeAddPSextention = dropdowns.add({stringList:["No","Yes"], selectedIndex:peuINFO.addPSextention} )
if((PSdlog.show()) ){
// Get the page height + width
pgHeight = parseFloat(pgHeight.editContents);
pgWidth = parseFloat(pgWidth.editContents);
// Check entered H & W for error
if(isNaN(pgHeight) || isNaN(pgWidth) || pgHeight < 0 || pgWidth < 0 ){
alert ("Both page height and width must be numeric and greater than zero (3.1).");
pgHeight = "0";
pgWidth = "0";
tempGetOut = false;
continue;
if(pgHeight > 0 && pgWidth > 0) // User changed size, use the new size
psOptions.ignore = false;
psOptions["height"] = pgHeight + peuINFO.measureUnitArray[peuINFO.measurementUnits];
psOptions["width"] = pgWidth + peuINFO.measureUnitArray[peuINFO.measurementUnits];
psOptions["ext"] = changeAddPSextention.selectedIndex;
peuINFO.addPSextention = psOptions["ext"];
psOptions["preset"] = printPreset.selectedIndex
peuINFO.defaultPrintPreset = psOptions.preset;
savePrefs();
PSdlog.destroy();
else{
PSdlog.destroy();
byeBye("Exporting has been canceled by user.",peuINFO.sayCancel);
} while(!tempGetOut);
return psOptions;
* Set Postscript options
function setPSoptions(theINFO){
with(currentINFO.theDoc.printPreferences){
activePrinterPreset = peuINFO.csPSprinters[theINFO.psINFO.preset];
peuINFO.origSpread = printSpreads; // Used to reset to original state when done
printSpreads = theINFO.doSpreadsON;
if(colorOutput != ColorOutputModes.separations && colorOutput != ColorOutputModes.inripSeparations)
printBlankPages = true;
if (theINFO.useTag)
pageInformationMarks = true;
else
pageInformationMarks = false;
if(!theINFO.psINFO.ignore){
try{
paperSize = PaperSizes.custom;
paperHeight = theINFO.psINFO.height;
paperWidth = theINFO.psINFO.width;
catch(Exception){
alert ("The current PPD doesn't support custom page sizes. The page size from the Print Preset will be used (3.2).");
* Get PDF options
function getPDFoptions(theINFO){
var PDFdlog = app.dialogs.add({name:"PDF Options for \"" + theINFO.theDoc.name.split(".ind")[0] + "\"", canCancel:true} );
var temp = new Array();
for(i=0;i<app.pdfExportPresets.length;i++)
temp.push(app.pdfExportPresets[i].name);
// Test if default PDFpreset is greater # than actual list.
// This occurs if one was deleted and the last preset in the list was the default
if(peuINFO.defaultPDFpreset > temp.length-1)
peuINFO.defaultPDFpreset = 0;
with (PDFdlog)
with (dialogColumns.add() ){
with (dialogRows.add() )
staticTexts.add({staticLabel:"PDF Export Preset:"} );
pdfPresets = dropdowns.add({stringList: temp, minWidth:50, selectedIndex:peuINFO.defaultPDFpreset} );
if(PDFdlog.show() ){
temp = app.pdfExportPresets[pdfPresets.selectedIndex];
peuINFO.defaultPDFpreset = pdfPresets.selectedIndex;
peuINFO.origSpread = temp.exportReaderSpreads;
try{
temp.exportReaderSpreads = theINFO.doSpreadsON;
temp.pageInformationMarks = (theINFO.useTag && temp.cropMarks)?true:false;
}catch(e){/*ignore it*/}
PDFdlog.destroy();
return temp;
else{
PDFdlog.destroy();
byeBye("PDF exporting has been canceled by user.", peuINFO.sayCancel);
* Get JPEG options
function getJPEGoptions(docName){
var temp = new Array();
var JPEGdlog = app.dialogs.add({name:"JPEG Options for \"" + docName + "\"", canCancel:true} );
with (JPEGdlog)
with (dialogColumns.add() ){
with (dialogRows.add() )
staticTexts.add({staticLabel:"Quality:"} );
JPEGquality = dropdowns.add({stringList:(new Array("Low","Medium","High","Maximum")) , minWidth:50, selectedIndex:peuINFO.defaultJPEGquality} );
with (dialogRows.add() )
staticTexts.add({staticLabel:"Encoding Type:"} );
JPEGrender = dropdowns.add({stringList:["Baseline","Progressive"] , minWidth:50, selectedIndex:peuINFO.defaultJPEGrender } );
if(JPEGdlog.show() ){
peuINFO.defaultJPEGquality = JPEGquality.selectedIndex;
temp["qualityType"] = peuINFO.defaultJPEGquality;
peuINFO.defaultJPEGrender = JPEGrender.selectedIndex;
temp["renderType"] = peuINFO.defaultJPEGrender;
else{
JPEGdlog.destroy();
byeBye("JPEG exporting has been canceled by user.",peuINFO.sayCancel);
JPEGdlog.destroy();
return temp;
* Set JPEG options
function setJPEGoptions(theINFO){
with(app.jpegExportPreferences){
peuINFO.origSpread = exportingSpread; // Used to reset to original state when done
exportingSpread = currentINFO.doSpreadsON;
exportingSelection = false; // Export the entire page
if(peuINFO.csVersion > 3)
jpegExportRange = ExportRangeOrAllPages.exportRange;
switch (theINFO.qualityType){
case 0:
jpegQuality = JPEGOptionsQuality.low;
break;
case 1:
jpegQuality = JPEGOptionsQuality.medium;
break;
case 2:
jpegQuality = JPEGOptionsQuality.high;
break;
case 3:
jpegQuality = JPEGOptionsQuality.maximum;
break;
jpegRenderingStyle = (theINFO.renderType)? JPEGOptionsFormat.baselineEncoding : JPEGOptionsFormat.progressiveEncoding;
* Get EPS options
function getEPSoptions(docName){
var epsOptions = new Array();
var epsDialog = app.dialogs.add({name:"EPS Options for \"" + docName + "\"", canCancel:true} );
var oldBleed = peuINFO.bleed;
with (epsDialog){
// Left Column
with (dialogColumns.add() ){
with (dialogRows.add() )
with (borderPanels.add() )
with (dialogColumns.add() ){
with (dialogRows.add() )
staticTexts.add({staticLabel:"Flattener Presets:"} );
changeFlattenerPreset = dropdowns.add({stringList:peuINFO.flattenerNames , minWidth:180, selectedIndex:peuINFO.defaultFlattenerPreset} );
with (dialogRows.add() )
changeIgnoreOverride = checkboxControls.add({staticLabel:"Ignore Overrides", checkedState:peuINFO.ignoreON} );
with (dialogRows.add() )
staticTexts.add({staticLabel:"Preview Type:"} );
changePreviewPreset = dropdowns.add({stringList:peuINFO.previewTypes , minWidth:180, selectedIndex:peuINFO.defaultPreview} );
with (dialogRows.add() ){
staticTexts.add({staticLabel:"Bleed:"} );
changeBleedVal = realEditboxes.add({editValue:peuINFO.bleed, minWidth:60} );
staticTexts.add({staticLabel:peuINFO.measureLableArray[peuINFO.measurementUnits]} );
with (dialogRows.add() )
staticTexts.add({staticLabel:"OPI Options:"} );
with (dialogRows.add() ){
staticTexts.add({staticLabel:"Omit:"} );
changeOpiEPS = checkboxControls.add({staticLabel:"EPS", checkedState:peuINFO.epsON} );
changeOpiPDF = checkboxControls.add({staticLabel:"PDF", checkedState:peuINFO.pdfON} );
changeOpiBitmap = checkboxControls.add({staticLabel:"Bitmapped", checkedState:peuINFO.bitmapON} );
// Right column
with (dialogColumns.add() ){
with(borderPanels.add() ){
with(dialogColumns.add() ){
with (dialogRows.add() ){
staticTexts.add({staticLabel:"PostScript level:"} );
var changePSlevel = dropdowns.add({stringList:["2","3"] , minWidth:75, selectedIndex:peuINFO.psLevel} );
with (dialogRows.add() ){
staticTexts.add({staticLabel:"Color mode:"} );
if(peuINFO.csVersion == 3)
var changeColorMode = dropdowns.add({stringList:["Unchanged","Grayscale", "RGB", "CMYK"] , minWidth:100, selectedIndex:peuINFO.colorType } );
else
var changeColorMode = dropdowns.add({stringList:["Unchanged","Grayscale", "RGB", "CMYK","PostScript Color Management"] , minWidth:100, selectedIndex:peuINFO.colorType } );
with (dialogRows.add() ){
staticTexts.add({staticLabel:"Font embedding:"} );
var changeFontEmbedding = dropdowns.add({stringList:["None","Complete", "Subset"] , minWidth:100, selectedIndex:peuINFO.fontEmbed } );
with (dialogRows.add() ){
staticTexts.add({staticLabel:"Type of data to send:"} );
var changeDataToSend = dropdowns.add({stringList:["All","Proxy"] , minWidth:50, selectedIndex:peuINFO.dataSent } );
with (dialogRows.add() ){
staticTexts.add({staticLabel:"Data type:"} );
var changeDataType = dropdowns.add({stringList:["Binary","ASCII"] , minWidth:50, selectedIndex:peuINFO.dataType } );
with (dialogRows.add() ){
staticTexts.add({staticLabel:"Perform OPI replacement:"} );
var changeOPIreplace = dropdowns.add({stringList:["No","Yes"] , minWidth:50, selectedIndex:peuINFO.opiReplacement} );
do{
var getOut = true;
if((epsDialog.show()) ){
// Use these to update the prefs file
peuINFO.defaultFlattenerPreset = changeFlattenerPreset.selectedIndex;
peuINFO.ignoreON = (changeIgnoreOverride.checkedState)?1:0;
peuINFO.defaultPreview = changePreviewPreset.selectedIndex;
peuINFO.bleed = changeBleedVal.editContents;
peuINFO.epsON = (changeOpiEPS.checkedState)?1:0;
peuINFO.pdfON = (changeOpiPDF.checkedState)?1:0;
peuINFO.bitmapON = (changeOpiBitmap.checkedState)?1:0;
peuINFO.psLevel = changePSlevel.selectedIndex;
peuINFO.colorType = changeColorMode.selectedIndex;
peuINFO.fontEmbed = changeFontEmbedding.selectedIndex;
peuINFO.dataSent = changeDataToSend.selectedIndex;
peuINFO.dataType = changeDataType.selectedIndex;
peuINFO.opiReplacement = changeOPIreplace.selectedIndex;
// Check if bleed value is OK
peuINFO.bleed = parseFloat(peuINFO.bleed)
if (isNaN(peuINFO.bleed)){
alert("Bleed value must be a number (1.1).");
getOut = false;
peuINFO.bleed = oldBleed;
else if (peuINFO.bleed < 0){
alert("Bleed value must be greater or equal to zero (1.2).");
getOut = false;
peuINFO.bleed = oldBleed;
else {
// Check if bleed is too big
try {
app.epsExportPreferences.bleedBottom = "" + peuINFO.bleed + peuINFO.measureUnitArray[peuINFO.measurementUnits];
catch (Exception){
alert("The bleed value must be less than one of the following: 6 in | 152.4 mm | 432 pt | 33c9.384");
getOut = false;
peuINFO.bleed = oldBleed;
else{
epsDialog.destroy();
byeBye("EPS Export canceled by user.", peuINFO.sayCancel);
}while(!getOut);
// These are used for exporting
epsOptions["defaultFlattenerPreset"] = changeFlattenerPreset.selectedIndex;
epsOptions["ignoreON"] = peuINFO.ignoreON;
epsOptions["defaultPreview"] = changePreviewPreset.selectedIndex;
epsOptions["bleed"] = peuINFO.bleed;
epsOptions["epsON"] = peuINFO.epsON;
epsOptions["pdfON"] = peuINFO.pdfON;
epsOptions["bitmapON"] = peuINFO.bitmapON;
epsOptions["psLevel"] = changePSlevel.selectedIndex;
epsOptions["colorType"] = changeColorMode.selectedIndex;
epsOptions["fontEmbed"] = changeFontEmbedding.selectedIndex;
epsOptions["dataSent"] = changeDataToSend.selectedIndex;
epsOptions["dataType"] = changeDataType.selectedIndex;
epsOptions["opiReplacement"] = changeOPIreplace.selectedIndex;
epsDialog.destroy();
return epsOptions;
* Apply chosen settings to the EPS export prefs
function setEPSoptions(theINFO){
with(app.epsExportPreferences){
appliedFlattererPreset = peuINFO.flattenerNames[theINFO.defaultFlattenerPreset];
bleedBottom = "" + theINFO.bleed + peuINFO.measureUnitArray[peuINFO.measurementUnits];
bleedInside = bleedBottom;
bleedOutside = bleedBottom;
bleedTop = bleedBottom;
epsSpreads = currentINFO.doSpreadsON;
ignoreSpreadOverrides = theINFO.ignoreON;
switch (theINFO.dataType){
case 0:
dataFormat = DataFormat.binary;
break;
case 1:
dataFormat = DataFormat.ascii;
break;
switch (theINFO.colorType){
case 0:
epsColor = EPSColorSpace.unchangedColorSpace;
break;
case 1:
epsColor = EPSColorSpace.gray;
break;
case 2:
epsColor = EPSColorSpace.rgb;
break;
case 3:
epsColor = EPSColorSpace.cmyk;
break;
case 4:
epsColor = EPSColorSpace.postscriptColorManagement;
break;
switch (theINFO.fontEmbed){
case 0:
fontEmbedding = FontEmbedding.none;
break;
case 1:
fontEmbedding = FontEmbedding.complete;
break;
case 2:
fontEmbedding = FontEmbedding.subset;
break;
switch (theINFO.dataSent){
case 0:
imageData = EPSImageData.allImageData;
break;
case 1:
imageData = EPSImageData.proxyImageData;
break;
switch (theINFO.defaultPreview){
case 0:
preview = PreviewTypes.none;
break;
case 1:
preview = PreviewTypes.tiffPreview;
break;
case 2:
preview = PreviewTypes.pictPreview;
break;
switch (theINFO.psLevel){
case 0:
postScriptLevel = PostScriptLevels.level2;
break;
case 1:
postScriptLevel = PostScriptLevels.level3;
break;
// Setting these three to false prevents a conflict error when trying to set the opiImageReplacement value
omitBitmaps = false;
omitEPS = false;
omitPDF = false;
if (theINFO.opiReplacement){
opiImageReplacement = true;
else {
opiImageReplacement = false;
omitBitmaps = theINFO.bitmapON;
omitEPS = theINFO.epsON;
omitPDF = theINFO.pdfON;
* Build the main dialog box
function createMainDialog (docName, thisNum, endNum){
var theDialog = app.dialogs.add({name:(VERSION_NAME + ": Enter the options for \"" + docName + "\"" + ((endNum==1)?"":" (" + thisNum + " of " + endNum + " documents)") )
, canCancel:true} );
with (theDialog){
// Left Column
with (dialogColumns.add() ){
with (dialogRows.add() )
staticTexts.add({staticLabel:"Page Naming Options"} );
with(borderPanels.add() ){
with(dialogColumns.add() ){
// Radio butons for renaming convention
namingConvention = radiobuttonGroups.add();
with(namingConvention){
radiobuttonControls.add({staticLabel:"As Is", checkedState:(peuINFO.nameConvType == 0)} );
radiobuttonControls.add({staticLabel:"Add \".L\"", checkedState:(peuINFO.nameConvType == 1)} );
radiobuttonControls.add({staticLabel:"Odd/Even = \".F/.B\"", checkedState:(peuINFO.nameConvType == 2)} );
radiobuttonControls.add({staticLabel:"Odd/Even = \"LA.F/LA.B\"" , checkedState:(peuINFO.nameConvType == 3)});
radiobuttonControls.add({staticLabel:"Numeric Override" , checkedState:(peuINFO.nameConvType == 4)});
with (dialogRows.add() )
staticTexts.add({staticLabel:""} );
with(dialogRows.add() ){
staticTexts.add({staticLabel:"Base Name"} );
newBaseName = textEditboxes.add({editContents:baseName, minWidth:100} );
// Middle Column
with (dialogColumns.add() ){
with (dialogRows.add() )
RichardM0701, are you the same person as scottbentley?
I fear your response doesn't make a lot of sense. The easiest way is to put your files into a book, which will not harm them. The easiest script is often no script at all.
I don't understand your comment about separate text boxes, files contain text boxes and definitionally multiple files means multiple separate text boxes.
I do not know what you are referring to with respect to the toc update, perhaps you could reference a particular command or script, or provide a screenshot.
It sounds like now you are interested in updating multiple tables of contents in a single fell swoop -- this would appear to have nothing to do with the original question. If that's the case, please start a new thread. -
Add New Line item while creating a new PO in ME21N
Hi All,
I have a requirement to add a new line item when user is pressing enter on the Line item 1 based on some condition.
I am using the BADI 'ME_PROCESS_PO_CUST' and Method is 'PROCESS_ITEM'.
I have tried lots of options and also look for method 'Create_Item ' but not able to understand what exactly I need to pass in that method.
Can somebody elaborate on it if somebody has work on it? Even sample code will also help me.
Thanks in advance.
With regards
Sachin GuptaHi Sachin,
Please find the sample code :
METHOD if_ex_me_process_po_cust~process_item .
DATA: ls_mepoitem TYPE mepoitem,
ls_customer TYPE mepo_badi_exampl,
ls_tbsg TYPE tbsg.
* here we check customers data
ls_mepoitem = im_item->get_data( ).
IF ls_mepoitem-loekz EQ 'D'.
* a physical deletion of the item was carried out. therrefor we have to
* delete customer data on the level of the item
ls_customer-ebeln = ls_mepoitem-ebeln.
ls_customer-ebelp = ls_mepoitem-ebelp.
CALL FUNCTION 'MEPOBADIEX_SET_DATA'
EXPORTING
im_data = ls_customer
im_physical_delete_request = 'X'.
ELSE.
* update/insert operation
CALL FUNCTION 'MEPOBADIEX_GET_DATA'
EXPORTING
im_ebeln = ls_mepoitem-ebeln
im_ebelp = ls_mepoitem-ebelp
IMPORTING
ex_data = ls_customer.
* check customers data
* check field badi_bsgru. This should be carried out only for new items. Once the PO is posted the
* field should no longer be changeable. This is done in Method FIELDSELECTION_ITEM.
IF im_item->is_persistent( ) EQ mmpur_no.
IF ls_customer-badi_bsgru IS INITIAL.
* Place the cursor onto field badi_bsgru. The metafield was defined in BAdI ME_GUI_PO_CUST,
* Method MAP_DYNPRO_FIELDS.
mmpur_metafield mmmfd_cust_01.
mmpur_message_forced 'W' 'ME' '083' text-002 '' '' ''.
ELSE.
* check whether the field is valid
SELECT SINGLE * FROM tbsg INTO ls_tbsg WHERE bsgru EQ ls_customer-badi_bsgru.
IF NOT sy-subrc IS INITIAL.
mmpur_metafield mmmfd_cust_01.
mmpur_message_forced 'E' 'ME' '083' text-004 '' '' ''.
* invalidate the object
CALL METHOD im_item->invalidate( ).
ENDIF.
ENDIF.
ENDIF.
Try to check the import and export paremeters to pass the vales.
I hope this may helpfull.
Thank you,
Thanks,
AMS
Maybe you are looking for
-
I synced my phone to my ittunes and my mom wants to back up hers on my itunes as well before she updates. can she do that without adding all my apps and data? how should i go about doing it?
-
Hi all, I have created a balance sheet report in FI using the hierarchy(based on 0GLACCEXT). The hierarchy looks as follows: Current Assets (Text node) ABC (This is the GL account under current assets) DEF (This is the GL account
-
I have set text size to Auto but it starts too small
I have created a form in Acrobat Pro 9, and set text size to Auto in all fields. I know it is limited to the height of the field, but one of the fields is a block for multi-line paragraghs. Size is set to Auto, font to Times Roman. When I open the
-
PCA for Full Balance Sheet Accounting
Dear SAP Guru, We're currently in 4.7. We've implemented PCA for Profit and Loss Accounting. There's business requirement to produce Full Balance Sheet Accounting in PCA, i.e. the one similar to Business Area. Can the standard PCA module (in 4.7) sup
-
When I preview a page in a browser it looks different from my design
Hi, I'm having problems with my font and pictures not spacing correctly. They look perfectly in dreamweaver but when I publish or preview that are further apart than they're supposed to be. I need Help!