The Apply button would activate the RunCH1, 2 and 3 on line 19-21. The search strings to activate start on 156
var myResult;
var w =new Window ('dialog {text: "Running Changes", orientation: "column", alignChildren:["fill","fill"], properties: {closeButton: false}}');
w.main =w.add ('group {preferredSize: [600, 600], alignChildren: ["left","fill"]}');
w.stubs = w.main.add ('listbox', undefined, ['Changes', 'Check For Changes', 'Example']);
w.stubs.preferredSize.width = 120; w.tabGroup = w.main.add ('group {alignment: ["Fill","Fill"], orientation: "stack"}');
w.tabs =[];
w.tabs[0]= w.tabGroup.add ('group');
w.tabs[0].add('statictext {text: ""}');
w.tabs =[];
w.tabs[0]= w.tabGroup.add ('group');
w.tabs[0].add('statictext {text: "Select a change to make"}');
w.tabs[0].add ('panel');
var RunCH1= w.tabs[0].add ('checkbox {text: "Find and Replace"}');
var RunCH2= w.tabs[0].add ('checkbox {text: "GHS Running Changes"}');
var RunCH3= w.tabs[0].add ('checkbox {text: "Non-GHS Running Changes"}');
var Pan1=w.tabs[0].add ('panel {text: "Find and Replace", preferredSize: [-1, 200],orientation: "column",alignChildren: ["left","Center"]}');
Pan1.add('statictext {text: "Double Space - Single Space"}');
Pan1.add('statictext {text: "Space : - :"}');
Pan1.add('statictext {text: "Space . - ."}');
Pan1.add('statictext {text: "<CR> - Return"}');
Pan1.add('statictext {text: "Double Return - Return"}');
var Pan1=w.tabs[0].add ('panel {text: "GHS Running Changes", preferredSize: [-1, 150],orientation: "column",alignChildren: ["left","Center`"]}');
Pan1.add('statictext {text: "B1. Enter Here1"}');
Pan1.add('statictext {text: "B2. Enter Here2"}');
Pan1.add('statictext {text: "B3. Enter Here3"}');
Pan1.add('statictext {text: "B4. Enter Here4"}');
var Pan1=w.tabs[0].add ('panel {text: "Non-GHS Running Changes", preferredSize: [-1, 150],orientation: "column",alignChildren: ["left","Center`"]}');
Pan1.add('statictext {text: "B1. Enter Here5"}');
Pan1.add('statictext {text: "B2. Enter Here6"}');
Pan1.add('statictext {text: "B3. Enter Here7"}');
Pan1.add('statictext {text: "B4. Enter Here8"}');
var Pan1=w.tabs[0].add ('panel {text: "Contact Infromation", preferredSize: [-1, 62],orientation: "column",alignChildren: ["left","Center`"]}');
Pan1.add('statictext {text: "*email Address here*"}');
with(w.tabs[0])
{
with(add ('group {alignment: "left"}'))
{
add ('button {text: "Reset all warning dialogs"}');
}
}
w.tabs[1]= w.tabGroup.add ('group');
w.tabs[1].add ('statictext {text: "Changes that WILL need checked"}');
w.tabs[1].add ('panel {preferredSize: [-1, -10]}');
var Pan1=w.tabs[1].add ('panel {text: "GHS", preferredSize: [-1, 250],orientation: "column",alignChildren: ["left","Center`"]}');
Pan1.add('statictext {text: "B1. Here"}');
Pan1.add('statictext {text: "B2. Here"}');
Pan1.add('statictext {text: "B3. Here"}');
Pan1.add('statictext {text: "B4. Here"}');
Pan1.add('statictext {text: "B5. Here"}');
Pan1.add('statictext {text: "G1. Here"}');
Pan1.add('statictext {text: "G2. Here"}');
w.tabs[1].add ('panel {text: "Non-GHS", preferredSize: [-1, 100]}');
w.tabs[2]= w.tabGroup.add ('group');
w.tabs[2].add ('statictext {text: "Example Of running Changes"}');
w.tabs[2].add ('panel');
w.tabs[2].add ('statictext {text: "", preferredSize: [-1, 20]}');
// How can i make PreV1 activate the below Radio buttons? Maybe gray out the Buttons when not the Check box is not checked.
var PreV1= w.tabs[2].add ('checkbox {text: "To Preview Changes"}');
var Pan1=w.tabs[2].add ('panel {text: "", preferredSize: [-1, 200],orientation: "column",alignChildren: ["left","top"]}');
// Is there a way to make each radio button display a Different Pictrue?
Pan1.add('radioButton {text: "B1. Enter Here1"}');
Pan1.add('radioButton {text: "B2. Enter Here2"}');
Pan1.add('radioButton {text: "B3. Enter Here3"}');
Pan1.add('radioButton {text: "B4. Enter Here4"}');
Pan1.add('radioButton {text: "B1. Enter Here5"}');
Pan1.add('radioButton {text: "B2. Enter Here6"}');
Pan1.add('radioButton {text: "B3. Enter Here7"}');
Pan1.add('radioButton {text: "B4. Enter Here8"}');
/*
Image.prototype.onDraw =function()
{
if(!this.image )return;
var WH =this.size,wh =this.image.size,k = Math.min(WH[0]/wh[0], WH[1]/wh[1]), xy;
wh =[k*wh[0],k*wh[1]];
xy =[(WH[0]-wh[0])/2, (WH[1]-wh[1])/2 ];
this.graphics.drawImage(this.image,xy[0],xy[1],wh[0],wh[1]);
WH = wh = xy =null;
}
flower=w.tabs[2].add ("image", undefined, File ("~/\Desktop/\xxx.jpg"));
flower.size =[300,300];
*/
// I cannot seem to get this Apply button to work
w.buttons = w.add ('group {alignment: "right"}');
applyButton = w.buttons.add ('button {text: "Apply"}');
applyButton.onClick = function () {
applySelection
}
w.buttons.add ('button {text: "OK"}');
w.buttons.add ('button {text: "Cancel"}');
for(
var i = 0;
i < w.tabs.length;
i++){
w.tabs.orientation ='column';
w.tabs.alignChildren ='fill';
w.tabs.alignment =['fill','fill'];
w.tabs.visible =false;
}
w.stubs.onChange = showTab;
function
showTab ()
{
if(w.stubs.selection !==null){for(var i = w.tabs.length-1; i >= 0;
i--)
{
w.tabs.visible =false;
}
w.tabs[w.stubs.selection.index].visible =true;
}
}
w.onShow =function()
{
w.stubs.selection = 1;
showTab;
}
myResult = w.show();
// How do i make each CHECK BOX RunCH1/2/3 Only work when they are selected? I cannot figure out how to make 2&3 Work.
if(myResult == 1 && (RunCH1.value==true || RunCH2.value==true || RunCH3.value==true) ){
alert("Find and Replace Items Have been made.!")
Replace_TXT(" <CR> ", "^p");
Replace_TXT(" <CR>", "^p");
Replace_TXT(" ", " ");
Replace_TXT(" :", ":");
Replace_TXT(" .", ".");
Replace_TXT("^p^p", "^p");
if(myResult == 2 && (RunCH2.value==true ) );
Replace_TXT ("test", "asdfasdfasdfadsfasdfasdfasdfadfasdfasdf");
{
alert ("GHS Changes Made")
};
if(myResult == 3 && (RunCH3.value==true) ){
Replace_TXT("and", "TEST");
}
alert ("NON-GHS Changes Made")
};
w.close(true);
function Replace_TXT(input, output)
{
app.findChangeTextOptions.caseSensitive = true;
app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing;
app.findTextPreferences.findWhat = input;
app.changeTextPreferences.changeTo = output;
app.activeDocument.changeText();
}