Johnwhite
Contributor
Johnwhite
Contributor
Activity
Aug 10, 2019
11:49 AM
thank you Sunil thank so much John
... View more
Aug 09, 2019
08:03 AM
Hi experts, my script like this: var docs = app.documents; for (var i = docs.length-1; i >= 0; i--) { var myCells = docs.stories.everyItem().tables.everyItem().cells.everyItem().getElements(); for(var n = 0; n < myCells.length; n++) { var mCellStyles = docs.allCellStyles; if (/^9[9876]/.test (myCells .appliedCellStyle.name)) { myCells .contents = " "; var myRow = myCells .parent.rows; myRow.cells[-1].rightInset ="2 mm"; } } } aim to let last column of cells if the cell applied cell style 96 97 98 99, rightInset ="2 mm"; but not working, could someone please show me how. thanks regard John
... View more
Aug 09, 2019
03:38 AM
thank you Peter, thank so much. John
... View more
Aug 09, 2019
01:43 AM
thank you guys, I change this like to: if (myCells .appliedCellStyle == myCellstyle) but still not working, could you please tell me how to fix it? thanks regard John
... View more
Aug 09, 2019
01:12 AM
Hi experts, my script like this: var docs = app.documents; for (var i = docs.length-1; i >= 0; i--) { var myCells = docs.stories.everyItem().tables.everyItem().cells.everyItem().getElements(); for(var n = 0; n < myCells.length; n++) { var mCellStyles = docs.allCellStyles; for ( var k = 0; k < mCellStyles.length; k++) { myCellstyle = mCellStyles .name.match(/^99|8|7|6/); if (myCells .appliedCellStyle = myCellstyle) { myCells .contents = " " } } } } aim to let if the cell which applied cell styles name.match 99 98 97 96 the contents = " " but it seems not working, could someone please tell me how to fix it. thanks regard John
... View more
Aug 08, 2019
05:37 AM
thank you Man, thank so much.
... View more
Aug 08, 2019
01:56 AM
Hi experts, How to use script to change my tool = selection tool? something like: app.tools=SelectionTool my aim: not matter what tool is in use, I want to change it to selection tool. thanks please regard John
... View more
Jul 16, 2019
02:56 AM
Hi experts, how to make a superscript characterStyle? my script like this: var myDocument = app.activeDocument; var myCharacterStyle = myDocument.characterStyles.item ("sup" ); !myCharacterStyle.isValid && myCharacterStyle = myDocument.characterStyles.add({name:"sup"}); myCharacterStyle.baselineShift = superScript; but not working could someone please show me how. thanks regard John
... View more
Jul 16, 2019
02:18 AM
thank you Man, thank so much. John
... View more
Jul 16, 2019
02:10 AM
thank you Man, but still not working. thanks regard John
... View more
Jul 16, 2019
12:24 AM
Hi experts, my script like this: var myDoc = app.activeDocument; var myCells = myDoc.stories.everyItem().tables.everyItem().cells.everyItem(); if (myCells.fillColor = "Black") { myCells.fillColor = "PANTONE 300 C" } aim to fine the cells if fillColor = "Black", then change the fillColr = "PANTONE 300 C" but not working, could someone please show me how. thanks regard John
... View more
Jul 12, 2019
12:21 AM
Hi experts, how to define pdf present include hyperline = true my script like this: cPreset.includeHyperlink = true; but not working. Could some one please show me how? thanks regard John
... View more
Jul 06, 2019
10:04 AM
Thank you guys, in my side not working. the error come from line 75 bottomEdgeStrokeType = app.activeDocument.strokeStyles.item(mChoice.e); error reason: parameter invalid. John
... View more
Jul 05, 2019
11:55 PM
Hi experts, my script like this: #target indesign var mMsg = {title: "addBottomEdge"}; //~ app.doScript( main, ScriptLanguage.JAVASCRIPT , [], UndoModes.ENTIRE_SCRIPT, mMsg.title ); main (); function main () { // initial code try { doJob ( checkSelection () ); } catch (e) { mMsg.text = e; mMsg.line = e.line; errorClose (mMsg); } } function mDialog () { mMsg.funName = "mDialog"; var colorList = app.activeDocument.swatches.everyItem().name, strokeTypeList = app.activeDocument.strokeStyles.everyItem().name, curPartHistory = eval( app.extractLabel(mMsg.title) ); if (!curPartHistory || false) curPartHistory = { w: 0, c: 0, e: 0 }; var w1 = new Window("dialog","", undefined, {closeButton: false}), mPanel = w1.add("panel", undefined, "Add cell’s bottom edge"), mSpace = mPanel.add("group"), topLine = mPanel.add("group"), mSt = topLine.add("statictext", undefined, "Line weight: "), mEd = topLine.add("edittext", undefined, String(curPartHistory.w) ), mSt1 = topLine.add("statictext", undefined, "pt"), botLine = mPanel.add("group"), mSt2 = botLine.add("statictext", undefined, "Line color: "), mDD = botLine.add("dropdownlist", undefined, colorList), botLine = mPanel.add("group"), mSt3 = botLine.add("statictext", undefined, "Stroke type: "), mLL = botLine.add("dropdownlist", undefined, strokeTypeList), mButtons = w1.add("group"); mButtons.add ('button', undefined, "取り消す", {name: "Cancel"}); mButtons.add ('button', undefined, "OK", {name: "OK"}); mSt1.graphics.font = ScriptUI.newFont ("Verdana", "Italic", 10); mPanel.alignChildren= "left"; mEd.characters = 3; mDD.selection = curPartHistory.c<colorList.length ? mDD.items[curPartHistory.c] : mDD.items[0]; mLL.selection = curPartHistory.e<strokeTypeList.length ? mLL.items[curPartHistory.e] : mLL.items[0]; w1.location = [150,150]; //||||||||||||||||||||||||||||||||||||||||||||||||| DIALOG OUTPUT ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| if (w1.show() ==1 ) { with (curPartHistory) { w = Number(mEd.text); c = mDD.selection.index; e = mLL.selection.index; } app.insertLabel(mMsg.title, curPartHistory.toSource() ); return curPartHistory; } else exit(); } function doJob ( cTarget ) { var mChoice = mDialog (); with (cTarget) { bottomEdgeStrokeWeight = mChoice.w + "pt" ; bottomEdgeStrokeColor = app.activeDocument.swatches.item(mChoice.c); bottomEdgeStrokeType = app.activeDocument.strokeStyles.item(mChoice.e); } } function checkSelection () { // return cells (1st row) or exit() mMsg.funName = "Check Selection"; var mTarget, firstCell, lastCell; if ( !app.documents.length || !app.selection.length || !app.selection[0].hasOwnProperty ("autoGrow")) { mMsg.line = $.line - 1; mMsg.text = "Nothing selected.\nMy target is a part of table."; errorClose (mMsg); } return app.selection[0]; } function errorClose (Msg) { // finish job with error var cContact = "...", //||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| cContact_Msg = "...", info = "xxxx", //||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| conLine, conLineDescr, conLineText, conInfo, errWin = new Window ("dialog", Msg.title, undefined, {closeButton: false}), firstLine = errWin.add("statictext", undefined, "Error detected!\r ", {multiline: true}), funLine = errWin.add("group"), funLineDescr = funLine.add("statictext", undefined, "Function name: "), funLineText = funLine.add("statictext", undefined, Msg.funName), lineLine = errWin.add("group"), lineLineDescr = lineLine.add("statictext", undefined, "Line number: "), lineLineText = lineLine.add("statictext", undefined, Msg.line), errLine = errWin.add("group"), errLineDescr = errLine.add("statictext", undefined, "Error message: "), errLineText = errLine.add("statictext", undefined, Msg.text, {multiline: true}), b = errWin.add("group"); b.alignment = "center"; errLine.alignChildren = "top"; // variables defined if (cContact_Msg.length) { conLine = errWin.add("group"); conLineDescr = conLine.add("statictext", undefined, cContact); conLineText = conLine.add("statictext", undefined, cContact_Msg); conInfo = errWin.add("statictext", undefined, info, {multiline: true}); conLineDescr.graphics.font = ScriptUI.newFont ("Verdana", "Bold", 12); conLineDescr.graphics.foregroundColor = errWin.graphics.newPen (errWin.graphics.PenType.SOLID_COLOR, [1, 0.3, 0], 1); conInfo.graphics.foregroundColor = firstLine.graphics.foregroundColor = errWin.graphics.newPen (errWin.graphics.PenType.SOLID_COLOR, [0.7, 0.7, 0.7], 1); firstLine.graphics.foregroundColor = errWin.graphics.newPen (errWin.graphics.PenType.SOLID_COLOR, [1, 0.3, 0], 1); conInfo.graphics.font = ScriptUI.newFont ("Verdana", "Bold", 10); } errWin.alignChildren = "left"; firstLine.alignment = "center"; conInfo.alignment = "right"; funLineDescr.graphics.font = lineLineDescr.graphics.font = errLineDescr.graphics.font = firstLine.graphics.font = ScriptUI.newFont ("Verdana", "Bold", 12); b.add ('button', undefined, "OK", {name: "OK"}); errWin.show(); with (app.activeDocument.viewPreferences) { horizontalMeasurementUnits = cMH; verticalMeasurementUnits = cMV; rulerOrigin = cRO; } app.activeDocument.zeroPoint = cZP; exit(); } it error on line 75 bottomEdgeStrokeType = app.activeDocument.strokeStyles.item(mChoice.e); it seem has some thing wrong on define the history. Could someone please tell me how to fix it, please. thanks regard John
... View more
Jul 04, 2019
04:01 PM
Hi Man, thank you for your help. but how to show the line type in the dropdownlist? something like this: thanks regard John
... View more
Jul 04, 2019
10:37 AM
Hi experts, my script like this: function mDialog () { mMsg.funName = "mDialog"; var colorList = app.activeDocument.swatches.everyItem().name, strokeTypeList = app.activeDocument.strokeType.everyItem().name, curPartHistory = eval( app.extractLabel(mMsg.title) ); if (!curPartHistory || false) curPartHistory = { w: 0, c: 0 }; var w1 = new Window("dialog","", undefined, {closeButton: false}), mPanel = w1.add("panel", undefined, "Add cell’s bottom edge"), mSpace = mPanel.add("group"), topLine = mPanel.add("group"), mSt = topLine.add("statictext", undefined, "Line weight: "), mEd = topLine.add("edittext", undefined, String(curPartHistory.w) ), mSt1 = topLine.add("statictext", undefined, "pt"), botLine = mPanel.add("group"), mSt2 = botLine.add("statictext", undefined, "Line color: "), mDD = botLine.add("dropdownlist", undefined, colorList), botLine = mPanel.add("group"), mSt3 = botLine.add("statictext", undefined, "Stroke type: "), mLL = botLine.add("dropdownlist", undefined, strokeTypeList), mButtons = w1.add("group"); mButtons.add ('button', undefined, "取り消す", {name: "Cancel"}); mButtons.add ('button', undefined, "OK", {name: "OK"}); mSt1.graphics.font = ScriptUI.newFont ("Verdana", "Italic", 10); mPanel.alignChildren= "left"; mEd.characters = 3; mDD.selection = curPartHistory.c<colorList.length ? mDD.items[curPartHistory.c] : mDD.items[0]; w1.location = [150,150]; //|||||||||||||||||||||||||||||||||||||||||||| DIALOG OUTPUT ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| if (w1.show() ==1 ) { with (curPartHistory) { w = Number(mEd.text); c = mDD.selection.index; } app.insertLabel(mMsg.title, curPartHistory.toSource() ); return curPartHistory; } else exit(); } if read my color swatches like this: colorList = app.activeDocument.swatches.everyItem().name, How can define the stroke, and read the stroke type in list: strokeTypeList = app.activeDocument.strokeType.everyItem().name, above like seems not the correct syntax could some one show me how, please. thanks regar John
... View more
Jun 26, 2019
04:58 AM
Hi experts, my script like this: var myDocs = app.activeDocument; var mMasters = myDocs.masterSpreads.everyItem().getElements(); var cObjectsTextFrame = mMasters.textFrames.everyItem().getElements(); if (!cObjectsTextFrame.contents || !cObjectsTextFrame.contents.match(/\S/) ) cObjectsTextFrame.remove(); not working on .everyItem().getElements() could some one please tell me how to define .everyItem().getElements() thanks regard John
... View more
Jun 26, 2019
04:52 AM
thank you Man, my question is how to define .everyItem().getElements(); ? how come my script always not working on .everyItem().getElements(); thanks regard John
... View more
Jun 25, 2019
04:59 PM
thank you Jongware the erro came from var cObjectsTextFrame = mMasters.textFrames.everyItem().getElements(); how to define .textFrames.everyItem().getElements(); ? thanks John
... View more
Jun 25, 2019
04:02 PM
Hi experts, my script like this: var myDocs = app.activeDocument; var mMasters = myDocs.masterSpreads.everyItem().getElements(); var cObjectsTextFrame = mMasters.textFrames.everyItem().getElements(); if (!cObjectsTextFrame.contents || !cObjectsTextFrame.contents.match(/\S/) ) cObjectsTextFrame.remove(); for remove masterSpreads text frame object. but not working, could someone please help me to fix it. thanks regard John
... View more
Jun 23, 2019
10:36 AM
Hi experts, my script like this: var myDocument = app.activeDocument; var myPage = myDocument.pages.everyItem().getElements(); var myTextFrame = myPage.textFrames.add(); myTextFrame.geometricBounds = [0, 0, 280, 210]; myTextFrame.contents = "This is some example text." but not working, could some one please tell me to fix it. thanks regard John
... View more
Jun 10, 2019
11:38 AM
Hi experts, a script like this: var notify = true; // set to true if you want a popup measage to say that the mail is sending var delay = 1.5 // the number of seconds you want the popup to appear var ToAddress = "xxxxxxxxxxxx@gmail.com"; // You might need to change this var MessageSubject = "Chinese Version of translation"; // You might need to change this // bodyText set at line 27 Below var myAttachments = File.openDialog ("Select the files you wish to attach", "All Files: *.*", true); if (!myAttachments) { alert("Sorry mate I can't send your attachments if you don't select them\rPlease try again next year\rThanks"); exit(); } var n, MessageAttachments = [], bodyFileNames = [], fName = ""; for (n = 0; n < myAttachments.length; n++) { fName = myAttachments .fsName; MessageAttachments = 'newMail.Attachments.Add("' + fName + '")'; bodyFileNames = fName; } MessageAttachments = MessageAttachments.join("\r") + "\r"; bodyFileNames = bodyFileNames.join("\" & vbNewLine & \""); // the \" & vbNewLine & \" is a way off putting in line feads MessageBody = "Howdy i spent yonks of time making this. \" & vbNewLine & \"" + bodyFileNames; // You might need to change this //VBS code very very very heavily based on the answer of ShaddowFox333 http://www.tek-tips.com/viewthread.cfm?qid=728333 myVBS = '''Dim ToAddress Dim FromAddress Dim MessageSubject Dim MessageBody Dim MessageAttachment Dim ol, ns, newMail ToAddress = "''' + ToAddress + '''" MessageSubject = "''' + MessageSubject + '''" MessageBody = "''' + MessageBody + '''" Set ol = CreateObject("Outlook.Application") Set ns = ol.getNamespace("MAPI") Set newMail = ol.CreateItem(olMailItem) newMail.Subject = MessageSubject newMail.Body = MessageBody & vbCrLf newMail.RecipIents.Add(ToAddress) ''' + MessageAttachments + "newMail.Send"; try { app.doScript (myVBS, ScriptLanguage.VISUAL_BASIC, undefined, UndoModes.AUTO_UNDO); if (notify) { var tempFile = new File (Folder.temp + "/" + +new Date + ".vbs"); tempFile.open('w'); tempFile.write('''Set shell = CreateObject("Wscript.Shell") delay = ''' + delay + ''' shell.Popup "Sending document by outlook", delay, "InDesign Mail Manager", 64 Set fso = CreateObject("Scripting.FileSystemObject") fso.DeleteFile("''' + tempFile.fsName + '''"),DeleteReadOnly '''); tempFile.close(); tempFile.execute(); } } catch (e) {alert ("Drat goofed up")} for send email. but it only has one email address to send, how can I make it can send to multi email address? I mean how can I change this like: var ToAddress = "xxxxxxxxxxxx@gmail.com"; // You might need to change this thanks regard John
... View more
May 30, 2019
06:38 AM
Hi experts, if my script like this app.activeDocument.undo(); for undo activeDocument last changed but if it is nothing to undo it will give me an error; how can make the script something like if (app.activeDocument.undo.isValid) {app.activeDocument.undo();} ??? thanks regard John
... View more