[AS][CS3] mathtype replace script
Hi, I edited the mathtype importscript to work better with the selection method.
In CS2 it was working fine, in CS3 not any more of course after I converted my document to the new version and wanted to replace the tect to inline graphics.
Problem is off course the find function, it gives an error on «event K2 Find»
I have read some topics but need some help on what I should alter, of course «event K2 Find» but is this the only line or should it be completely rewritten?
Here is the script:
Deleted some intro info or it's too long.
-- get the source folder for the equations from the user and compile a list of the enclosed files
set the sourceFolder to choose folder with prompt "Select the directory containing the equations:"
set the fileList to list folder sourceFolder without invisibles
-- step through each file in the list, search for a matching name tag in the active document, and
-- replace with the file and move the baseline of the placed equation
repeat with i from 1 to the number of items in the fileList
set currentItem to item i of the fileList
set currentFilePath to ((sourceFolder as string) & currentItem)
-- test if the filename is not a folder and then place it
if (info for (currentFilePath as alias)) is not folder then
set searchstring to "<<" & currentItem & ">>"
place_file(searchstring, currentFilePath, get_baseline(currentFilePath as alias))
end if
end repeat
display dialog "Finished placing files from the folder " & (sourceFolder as string) & "."
* place_file():
on place_file(fileName, filePath, fileBaseline)
tell application "Adobe InDesign CS3"
-- test that a document is open
if (count documents) > 0 then
set myDocument to active document
tell myDocument
-- search for all references of the filename
b «event K2 Find» story given «class for »:fileName
set hitz to the result
set lapz to the number of items of hitz
if lapz > 0 then
-- repeat for each reference to the file
repeat until lapz = 0
select item lapz of hitz
-- get a reference to the selected text
set myInsertionPoint to item lapz of hitz
set myRef to myInsertionPoint
tell item 1 of myRef
set myInsertion to index of first character
set myInsertion2 to index of second character
set myStory to parent of first character
-- delete the string at the reference point
set contents to ""
end tell
-- place the file at the insertion point
tell (insertion point myInsertion of myStory)
place filePath
end tell
-- select the inline graphic
select text from insertion point myInsertion to insertion point myInsertion2 of myStory
set graphicLocation to object reference of selection
set myGraphic to item 1 of all graphics of item 1 of graphicLocation
set mySelection to parent of myGraphic
-- move the graphic equivalent to the baseline for that inline graphic
move mySelection by {"0pt", fileBaseline}
set lapz to (lapz - 1)
end repeat
end if
end tell
end if
end tell
end place_file
(********** get_baseline():***************)
on get_baseline(myFile)
set matchText to "%%Baseline: "
set theBaseline to ""
-- read in the EPS file
open for access myFile
set fileLines to read myFile as string using delimiter {return}
close access myFile
-- find the line with the baseline
set lapz to the number of items in fileLines
repeat until (lapz = 0) or theBaseline begins with the matchText
set theBaseline to item lapz of fileLines
set lapz to (lapz - 1)
end repeat
-- extract the baseline number
set theBaseline to characters -2 thru -1 of theBaseline as string
-- return the baseline number
return theBaseline & "pt" as string
end get_baseline
Hi Shane, I have placed it like this and it works now, many thanx
on place_file(fileName, filePath, fileBaseline)
tell application "Adobe InDesign CS3"
-- test that a document is open
if (count documents) > 0 then
set myDocument to active document
set find text preferences to nothing
set find what of find text preferences to fileName
tell myDocument
-- search for all references of the filename
find text
set hitz to the result
set lapz to the number of items of hitz
if lapz > 0 then
-- repeat for each reference to the file
Similar Messages
-
The page for cs3 download replacement not working
The page for cs3 download replacement not working
Make sure you have cookies enabled and clear your cookie cache. If it continues to fail try using a different browser.
CS3 - http://helpx.adobe.com/creative-suite/kb/cs3-product-downloads.html
You can also download the trial version of the software thru the page linked below and then use your current serial number to activate it.
Be sure to follow the steps outlined in the Note: Very Important Instructions section on the download pages at this site and have cookies enabled in your browser or else the download will not work properly.
CS3 and CS4: http://prodesigntools.com/download-adobe-cs4-and-cs3-free-trials-here.html -
Text find and change problem in CS3 and CS4 script
I use the script below to find some text and change into others.
There is one thing the script can't do it for me.
Example:
(g) Management
(1) that no law which is enacted in the Cayman Islands imposing any tax to be levied on profits, income, gains or appreciation shall apply to the Company or its operations; and
(2) that the aforesaid tax or any tax in the nature of estate duty or inheritance tax shall not be payable on or in respect of the shares, debentures or other obligations of the Company.
Example:(END)
I got a lot of topics or points in the passage. And I want to change the space between '(g)' and 'Management' into a tab character. So I revised the plain text file 1text.
PS: 1text.txt is filled with what to change.
text {findWhat:"^p(^?) "} {changeTo:"^p(^?)^t"} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false} Find all space-dash-space and replace with an en dash.
The result is:
(^?)^tManagement
(^?)^tthat no law which is enacted in the Cayman Islands imposing any tax to be levied on profits, income, gains or appreciation shall apply to the Company or its operations; and
(^?)^tthat the aforesaid tax or any tax in the nature of estate duty or inheritance tax shall not be payable on or in respect of the shares, debentures or other obligations of the Company.
PS: ^t is a tab character.
result (END)
This is not what I want.
It should be '(g)^tManagement'.
PS: ^t is a tab character.
Please someboady help me out to revised the script below to change the text into what I want. Thanks so much.
Here is the script.
//FindChangeByList.jsx
//An InDesign CS4 JavaScript
@@@BUILDINFO@@@ "FindChangeByList.jsx" 2.0.0.0 10-January-2008
//Loads a series of tab-delimited strings from a text file, then performs a series
//of find/change operations based on the strings read from the file.
//The data file is tab-delimited, with carriage returns separating records.
//The format of each record in the file is:
//findType<tab>findProperties<tab>changeProperties<tab>findChangeOptions<tab>description
//Where:
//<tab> is a tab character
//findType is "text", "grep", or "glyph" (this sets the type of find/change operation to use).
//findProperties is a properties record (as text) of the find preferences.
//changeProperties is a properties record (as text) of the change preferences.
//findChangeOptions is a properties record (as text) of the find/change options.
//description is a description of the find/change operation
//Very simple example:
//text {findWhat:"--"} {changeTo:"^_"} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false} Find all double dashes and replace with an em dash.
//More complex example:
//text {findWhat:"^9^9.^9^9"} {appliedCharacterStyle:"price"} {include footnotes:true, include master pages:true, include hidden layers:true, whole word:false} Find $10.00 to $99.99 and apply the character style "price".
//All InDesign search metacharacters are allowed in the "findWhat" and "changeTo" properties for findTextPreferences and changeTextPreferences.
//If you enter backslashes in the findWhat property of the findGrepPreferences object, they must be "escaped"
//as shown in the example below:
//{findWhat:"\\s+"}
//For more on InDesign scripting, go to http://www.adobe.com/products/indesign/scripting/index.html
//or visit the InDesign Scripting User to User forum at http://www.adobeforums.com
main();
function main(){
var myObject;
//Make certain that user interaction (display of dialogs, etc.) is turned on.
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;
if(app.documents.length > 0){
if(app.selection.length > 0){
switch(app.selection[0].constructor.name){
case "InsertionPoint":
case "Character":
case "Word":
case "TextStyleRange":
case "Line":
case "Paragraph":
case "TextColumn":
case "Text":
case "Cell":
case "Column":
case "Row":
case "Table":
myDisplayDialog();
break;
default:
//Something was selected, but it wasn't a text object, so search the document.
myFindChangeByList(app.documents.item(0));
else{
//Nothing was selected, so simply search the document.
myFindChangeByList(app.documents.item(0));
else{
alert("No documents are open. Please open a document and try again.");
function myDisplayDialog(){
var myObject;
var myDialog = app.dialogs.add({name:"FindChangeByList"});
with(myDialog.dialogColumns.add()){
with(dialogRows.add()){
with(dialogColumns.add()){
staticTexts.add({staticLabel:"Search Range:"});
var myRangeButtons = radiobuttonGroups.add();
with(myRangeButtons){
radiobuttonControls.add({staticLabel:"Document", checkedState:true});
radiobuttonControls.add({staticLabel:"Selected Story"});
if(app.selection[0].contents != ""){
radiobuttonControls.add({staticLabel:"Selection", checkedState:true});
var myResult = myDialog.show();
if(myResult == true){
switch(myRangeButtons.selectedButton){
case 0:
myObject = app.documents.item(0);
break;
case 1:
myObject = app.selection[0].parentStory;
break;
case 2:
myObject = app.selection[0];
break;
myDialog.destroy();
myFindChangeByList(myObject);
else{
myDialog.destroy();
function myFindChangeByList(myObject){
var myScriptFileName, myFindChangeFile, myFindChangeFileName, myScriptFile, myResult;
var myFindChangeArray, myFindPreferences, myChangePreferences, myFindLimit, myStory;
var myStartCharacter, myEndCharacter;
var myFindChangeFile = myFindFile("/FindChangeSupport/1test.txt")
if(myFindChangeFile != null){
myFindChangeFile = File(myFindChangeFile);
var myResult = myFindChangeFile.open("r", undefined, undefined);
if(myResult == true){
//Loop through the find/change operations.
do{
myLine = myFindChangeFile.readln();
//Ignore comment lines and blank lines.
if((myLine.substring(0,4)=="text")||(myLine.substring(0,4)=="grep")||(myLine.substring(0, 5)=="glyph")){
myFindChangeArray = myLine.split("\t");
//The first field in the line is the findType string.
myFindType = myFindChangeArray[0];
//The second field in the line is the FindPreferences string.
myFindPreferences = myFindChangeArray[1];
//The second field in the line is the ChangePreferences string.
myChangePreferences = myFindChangeArray[2];
//The fourth field is the range--used only by text find/change.
myFindChangeOptions = myFindChangeArray[3];
switch(myFindType){
case "text":
myFindText(myObject, myFindPreferences, myChangePreferences, myFindChangeOptions);
break;
case "grep":
myFindGrep(myObject, myFindPreferences, myChangePreferences, myFindChangeOptions);
break;
case "glyph":
myFindGlyph(myObject, myFindPreferences, myChangePreferences, myFindChangeOptions);
break;
} while(myFindChangeFile.eof == false);
myFindChangeFile.close();
function myFindText(myObject, myFindPreferences, myChangePreferences, myFindChangeOptions){
//Reset the find/change preferences before each search.
app.changeTextPreferences = NothingEnum.nothing;
app.findTextPreferences = NothingEnum.nothing;
var myString = "app.findTextPreferences.properties = "+ myFindPreferences + ";";
myString += "app.changeTextPreferences.properties = " + myChangePreferences + ";";
myString += "app.findChangeTextOptions.properties = " + myFindChangeOptions + ";";
app.doScript(myString, ScriptLanguage.javascript);
myFoundItems = myObject.changeText();
//Reset the find/change preferences after each search.
app.changeTextPreferences = NothingEnum.nothing;
app.findTextPreferences = NothingEnum.nothing;
function myFindGrep(myObject, myFindPreferences, myChangePreferences, myFindChangeOptions){
//Reset the find/change grep preferences before each search.
app.changeGrepPreferences = NothingEnum.nothing;
app.findGrepPreferences = NothingEnum.nothing;
var myString = "app.findGrepPreferences.properties = "+ myFindPreferences + ";";
myString += "app.changeGrepPreferences.properties = " + myChangePreferences + ";";
myString += "app.findChangeGrepOptions.properties = " + myFindChangeOptions + ";";
app.doScript(myString, ScriptLanguage.javascript);
var myFoundItems = myObject.changeGrep();
//Reset the find/change grep preferences after each search.
app.changeGrepPreferences = NothingEnum.nothing;
app.findGrepPreferences = NothingEnum.nothing;
function myFindGlyph(myObject, myFindPreferences, myChangePreferences, myFindChangeOptions){
//Reset the find/change glyph preferences before each search.
app.changeGlyphPreferences = NothingEnum.nothing;
app.findGlyphPreferences = NothingEnum.nothing;
var myString = "app.findGlyphPreferences.properties = "+ myFindPreferences + ";";
myString += "app.changeGlyphPreferences.properties = " + myChangePreferences + ";";
myString += "app.findChangeGlyphOptions.properties = " + myFindChangeOptions + ";";
app.doScript(myString, ScriptLanguage.javascript);
var myFoundItems = myObject.changeGlyph();
//Reset the find/change glyph preferences after each search.
app.changeGlyphPreferences = NothingEnum.nothing;
app.findGlyphPreferences = NothingEnum.nothing;
function myFindFile(myFilePath){
var myScriptFile = myGetScriptPath();
var myScriptFile = File(myScriptFile);
var myScriptFolder = myScriptFile.path;
myFilePath = myScriptFolder + myFilePath;
if(File(myFilePath).exists == false){
//Display a dialog.
myFilePath = File.openDialog("Choose the file containing your find/change list");
return myFilePath;
function myGetScriptPath(){
try{
myFile = app.activeScript;
catch(myError){
myFile = myError.fileName;
return myFile;It takes me a lof of time to comprehend the sentence you write. Cause I am a Chinese. My poor English.
I have to say "you are genius". I used to use the indesign CS2. There is no GREP function in CS2. When I get the new script, I do not know how to use it. Just when I saw the
'grep {findWhat:" +"} {changeTo:" "} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false} Find all double spaces and replace with single spaces.'
Being confused.
Thanks so much. It seems I have to relearn the advanced Indesign. -
[CS3 JS] Replacing/Adding text in a table
Hello professionals....
I am currently wanting to replace text within a table.
The Table has 4 simple colums. All text in the table has the same character style.
b The situation is
i Here is a short 'cut-out' of the scripting I have done:
I read in the text bthat needs to be modified from the table with this script:
> app.findTextPreferences.appliedCharacterStyle = myRevIndexListCharStyleName;
f = myDoc.findText();
var myCurrentResponsiblePerson = f[2].contents;
var myCurrentComments = f[3].contents;
New text is set to another variable:
> var myResponsiblePersonField = textEditboxes.add({editContents:myCurrentResponsiblePerson, minWidth:myTextBoxWidth});
var myCommentField = textEditboxes.add({editContents:myCurrentComments, minWidth:myTextBoxWidth});
var myCourseRevIndexPerson = myResponsiblePersonField.editContents;
var myCourseRevIndexComment = myCommentField.editContents;
I then proceeded to to make a new 'replacement' string:
> var myCourseRevIndexList = myRevIndex+"\t"+myCourseRevIndexDate+"\t"+myCourseRevIndexPerson+"\t"+myCourseRevIndexCom ment;
return[myCourseRevIndexList]
Then I try to 'Change' the text by this:
> app.findTextPreferences.appliedCharacterStyle = myRevIndexListCharStyleName;
app.changeTextPreferences.changeTo = oneResult[0];
oneDoc.changeText();
Result - InDesign Crashes...!
What am I doing wrong?
I know it has something to do with the:
> app.findTextPreferences.appliedCharacterStyle = myRevIndexListCharStyleName;
app.changeTextPreferences.changeTo = oneResult[0];
Because when I deactivate this part - InDesign does
b not
crash!
Would it be better to
i somehow
replace the individual text 'cells'?
If so - how do I do that?
I have treid to read up, but have had no luck!
Help / insights would be greatly welcomed.
Thanks in advance.
LeeHello,
:) Sorry - I should have explained a little more!
btw - the linked 'pdf' file is blocked for me! Our IT department are very fussy!!! :(
b What is your main idea?
We have a 3 sided document (Title page, Content page, Release page) to present our product - Training Courses.
On each side of the document there are certain informations that are the same. To make life easy for the people editing these documents, it was decided to make a script to automate the input and changing of these informations.
Character Sytles were generated to define each field of information, so to aid in the find/Change of the scripting.
On the Title page there is the 'Course Title', 'Course Reference No.' and 'Document No.' information.
On the Content page there is the 'Course Title', 'Course Sub-Title', 'Reference No.' and 'Document No.' informations (naturally there is all the course info too, but that's a 'one-time-entry' only).
On the Release page there is all the above and a
b table
that contains the latest revision index information. i.e. Revsion Index, Date of Changes, Responsible Person, Comments to changes made.
This row of information has a Character Style and is read in.
I then searched the string and replaced each Array position with the previously entered text.
It seems to work OK for when you are creating the
b first document
My problem what I see coming is the fact that when it is needed to enter a revision - how would I
b add
another row
b and
then select only the last row of - then to be 'blank' information?
Did this help?
If it might help - here is the InDesign 'template' file that they start with:
http://www.freetimecorner.ch/joomla2/images/allsorts/course_description_end.txt
b NOTE
Change the 'txt' for 'indt'
In the script you'll have to change the address when he goes to open this file (
i in the top few lines -
SWF problem in Dreamweaver CS3 and strange Script file
Hi folks, I am using Dreamweaver CS3 and tried to upload a
SWF file today. The SWF includes three buttons, one for video,
another for audio and one for text. Before loading up to DW all
three parts played fine. But when I uploaded to DW and my site, the
video fails to play. A Script file, and another file downloaded I
am not sure what I am supposed to do with this script file. The
script file is called The audio and text part works fine, but the
video will not play. I am not sure why this is, but when I uploaded
the file to Dreamweaver there was a Script file called
AC_RunActiveContent.js that automatically downloaded along with a
file called .htaccess
The other file is called called .htaccess
I uploaded both files to my server, but that did not help the
video play. I tried pasting the AC_RunActiveContent.js code into my
page and uploading, but that did not help the video play either; I
just got code at the bottom of my page.
I have viewed the page in Mozilla, IE7 and Flock, but still I
cannot play the video.
Does anyone have any idea how to make the video play in
Dreamweaver; what I am supposed to do with these two code files?
For those interested in the AC_RunActiveContent.js code, I
will post below. Please try to explain simply because I am not so
tech savvy.
I thank you all.
MaryI have managed to fathom it out.
-
Error in Replace() script
Hi Guys,
Please find below a script I want to use. I recently added a line to delete the diaeresis or " in one of the columns of my .csv import file:
Function LAEP090_COMMA(strField, strRecord)
'Oracle Hyperion FDM DataPump Import Script:
'Created By: ADMIN
'Date Created: 3/3/2011 1:07:40 PM
'Purpose:
'delete diaeresis in exported .csv file before and after amount: "amount"
strfield=Replace(strfield, """, "")
LAEP090_COMMA=strfield
'make values xK
If IsNumeric(strfield) Then
LAEP090_COMMA=(strfield/1000)
Else
LAEP090_COMMA=strfield
End If
End Function
Now I know """ seems to generate the problem. Because when I do "." for another script to delete a thousand separator, it works fine.
How can I make sure the " is deleted before and after the amount?
Thanks for your help!
Kind regards,
JDeMThanks guys,
I solved it by importing a textfile instead of the .csv file. Apparently there is a problem in these files because of the language setting in some plants. but the chr(34) works!
Edited by: JDeM on 4-mrt-2011 7:31 -
Photoshop CS3 Repeat Action Script.
I need an AppleScript for Photoshop CS3 that will run the selected Action on all layers within the selected Layer Group.
I have a Layer Group of Graphics that I want to apply various effects, and distortions to. I record the action once, but then I have to manually select each layer and play the action. I would like a script that will play the selected action to every layer within the selected group.
Any ideas?This is what I have so far:
tell application "Adobe Photoshop CS3"
tell current document
set myActionSet to "" --Current Action Set
set myAction to "" --Current Action
set myLayerSet to "" --Current Layer Set
set layerCount to layers of layer set myLayerSet
repeat with i from 1 to the count of layerCount
set current layer to layer i of layer set myLayerSet
set the visible of layer i of layer set myLayerSet to true
do action myAction from myActionSet
set the visible of layer i of layer set myLayerSet to false
end repeat
end tell
end tell
I am having problems getting the first 3 variables to be what is currently selected/highlighted without manually typing them in before running the script.
I am also getting errors if a layer within the layer set is empty.
Any ideas? -
InDesign CS3 - MathType 6 Postscript error
We have using MathType 6.0 eps file to build the math in Indesign CS3 and this particular project has fully Math. Client required the Math using MT 6.0 only. I'm unable to create a PDF through postscript from Indesign CS3, whereas I would have placed the same eps file (MT 6.0) into Indesign CS2 and we should be able to create PDF through postscript. Our workflow is to create PS to PDF not to export PDF from Indesign CS2/CS3. I have attached the eps file (MT 6.0) for your reference. Kindly look at the error below Mr. Indrajith had earlier, while creating PS to PDF.
%%[ Error: typecheck; OffendingCommand: makefont ]%%
Stack:
[320.0 0.0 0.0 -320.0 0.0 0.0]
-file-
-mark-
%%[ Flushing: rest of job (to end-of-file) will be ignored ]%%
%%[ Warning: PostScript error. No PDF file produced. ] %%
JohnArulSeems to me you have two choices:
1) You can give client required Mathtype EPS files without PDF.
2) Or you can educate client. Mathtype EPS files don't always work. Illustrator AI files do.
You don't have to leave out the EPS files. You can still deliver EPS to client, in fact you'll want to save EPS (or WMF) as a source file from which to make changes. Just make the AI file for ID.
FWIW, I've been using various versions of Mathtype with different DTP applications (not just Indesign) since 1997. None of the versions I've used (I haven't tested 6.5 yet) has been 100% suitable for high-end desktop publishing. Despite that, I've always managed to make it work, and I've typeset dozens of equations books--some with literally thousands of equations in them--using Mathtype.
Sometimes the client really is wrong.
Ken -
AE text replacement script, Hebrew characters and punctuation marks
Hi,
I'm using a script to replace text on one of my AE projects. When I use English characters it work prefect, the problem is once I'm trying to replace the text with Hebrew I get small arrows (as shown in the attached screen grab) before and after punctuation marks.
Any idea what can cause this kind of behavior, is it script related or the base AE file?These appear to be glyphs that should be substituted. Could be something to do with specific text flow or multi-variate glyphs that are substituted based on the context of neighboring characters. In any case, short of manually fixing it I don't think there is any way to get this right. AE is quite limited in dealing with any of this stuff and in the past you actualyl needed the Middel East versiosn to get correct RTL writing at all...
Mylenium -
Apply Find & Replace Script to .INDB?
Hi Chaps,
Is there a way to apply a Find and Replace-type script to an InDesign Book (CS4 > .indb)?
I have a .indb file that my have a number of documents, each with the term "EURO" in a number of tables. I want to change this to "GBP" in all the documents, but would like to automate the process, rather than manually applying the script to each document.
Anybody know of a script to do this?
Many thank
SamuelDo you really need to find all the occurences in all the documents? If yes it is simple. Open all documents and then run the following script
myResetFindChangeGrep();
app.findGrepPreferences.findWhat = "\\<EURO\\b";//word Boundary is set
app.changeGrepPreferences.changeTo = "GBP";
app.changeGrep();
myResetFindChangeGrep();
alert("Done");
function myResetFindChangeGrep(){
app.findGrepPreferences = NothingEnum.nothing;
app.changeGrepPreferences = NothingEnum.nothing;
for example:
1254 EURO, 11255.EURO -->these conditions will match
1911EURO, EUROPE--> these conditions will not match.
Green4ever -
[JS] [CS3] Triggering a script
Hi all
I am looking to find the best way to trigger a script in InDesign. In the past i have used an applescript to monitor a folder, and when something appears in the folder a doScript will trigger the required script.
I am guessing there is a more efficient way just using JS. My intentions are ultimately to be using IDServer, linked to my companies web site. What I know I can do is create .csv files on the server from actions on the web site. This CSV file will hold the data I need to use in the ID environment.
I know this is very vague, but at the moment I have no solid plans, but want to make sure something can be done. I cannot use AS as the environment for the IDServer will be a Windows server.
Any pointers will be cool.
Cheers
RoyHi Michel,
To provide an example, here is a simple program, which monitors a hot folder: every 5000 milliseconds (Interval property of the Timer) it counts files with pdf extension, makes simple calculations and shows statistics.
Kasyan
Dim myPagesMax As Integer
Dim myPagesRekl As Integer
Dim myTop As Single
Dim myLeft As Single
Dim myFolderName As String
Private Sub Command1_Click()
Timer1.Enabled = True
Command1.Enabled = False
Command2.Enabled = True
Command3.Enabled = False
End Sub
Private Function CountFiles() As Integer
Set fsoRef = CreateObject("Scripting.FileSystemObject")
If Not fsoRef.FolderExists(myFolderName) Then
MsgBox ("Ïàïêà " & myFolderName & " íå ñóùåñòâóåò!"), vbCritical, "Îøèáêà"
Timer1.Enabled = False
Command1.Enabled = True
Command2.Enabled = False
CountFiles = 0
Exit Function
Unload Me
Else
Set folderRef = fsoRef.GetFolder(myFolderName)
i = 0
For Each f In folderRef.Files
If UCase(Right(f.Name, 4)) = ".PDF" Then
i = i + 1
End If
Next
CountFiles = i
End If
End Function
Private Sub Command2_Click()
Timer1.Enabled = False
Command1.Enabled = True
Command2.Enabled = False
Command3.Enabled = True
Label1.Caption = ""
Label4.Caption = ""
Label6.Caption = ""
Label12.Caption = ""
ProgressBar1.Value = 0
End Sub
Private Sub Command3_Click()
myFolderName = InputBox("Ââåäèòå ïóòü ê ïàïêå äëÿ PDF ôàéëîâ òåêóùåãî íîìåðà", "Âûáîð ïàïêè", myFolderName)
If myFolderName = "" Then Exit Sub ' leaves sub if the variable i is null
Form1.Caption = CurrentIssue
End Sub
Private Sub Form_Load()
Command2.Enabled = False
myTop = GetSetting("PdfCounter", "Settings", "Top", 0)
myLeft = GetSetting("PdfCounter", "Settings", "Left", 0)
myPagesMax = GetSetting("PdfCounter", "Settings", "PagesMax", 160)
myPagesRekl = GetSetting("PdfCounter", "Settings", "PagesRekl", 50)
myFolderName = GetSetting("PdfCounter", "Settings", "FolderName", "K:\PS\801\Original")
Form1.Top = myTop
Form1.Left = myLeft
Text1.Text = myPagesMax
Text2.Text = myPagesRekl
mySplit = Split(myFolderName, "\")
myCurIssue = mySplit(2)
Form1.Caption = myCurIssue
End Sub
Private Sub Form_Unload(Cancel As Integer)
myTop = Form1.Top
myLeft = Form1.Left
SaveSetting "PdfCounter", "Settings", "Top", myTop
SaveSetting "PdfCounter", "Settings", "Left", myLeft
SaveSetting "PdfCounter", "Settings", "PagesMax", myPagesMax
SaveSetting "PdfCounter", "Settings", "PagesRekl", myPagesRekl
SaveSetting "PdfCounter", "Settings", "FolderName", myFolderName
End Sub
Private Sub Text1_Change()
myPagesMax = CInt(Val(Text1.Text))
End Sub
Private Sub Text2_Change()
myPagesRekl = CInt(Val(Text2.Text))
End Sub
Private Sub Timer1_Timer()
If Not CountFiles = 0 Then
Label1.Caption = CountFiles
myPagesRekl = CInt(Val(Text2.Text))
myPagesOur = myPagesMax - myPagesRekl
If Not myPagesOur = 0 Then
myOnePercent = 100 / myPagesOur
End If
myPagesCur = CountFiles
myPagesLeft = myPagesOur - myPagesCur
myCurPercent = CountFiles * myOnePercent
Label4.Caption = CInt(myCurPercent)
Label6.Caption = myPagesLeft
Label12.Caption = myPagesOur
If myCurPercent > 100 Then
myCurPercent = 100
End If
ProgressBar1.Visible = True
ProgressBar1.Min = 0
ProgressBar1.Max = 100
ProgressBar1.Value = myCurPercent
Else
Label1.Caption = 0
myPagesRekl = CInt(Val(Text2.Text))
myPagesOur = myPagesMax - myPagesRekl
If Not myPagesOur = 0 Then
myOnePercent = 100 / myPagesOur
End If
myPagesCur = 0
myPagesLeft = myPagesOur
myCurPercent = 0
Label4.Caption = 0
Label6.Caption = myPagesOur
Label12.Caption = myPagesOur
ProgressBar1.Visible = True
ProgressBar1.Min = 0
ProgressBar1.Max = 100
ProgressBar1.Value = myCurPercent
End If
End Sub
Private Function CurrentIssue() As String
If Not myFolderName = "" Then
If Val(Mid(myFolderName, 7, 3)) > 0 Then
CurrentIssue = "Òåêóùèé íîìåð: " & Val(Mid(myFolderName, 7, 3))
Else: CurrentIssue = "Òåêóùèé íîìåð íå âûáðàí."
End If
Else
CurrentIssue = "Òåêóùèé íîìåð íå âûáðàí."
End If
End Function -
Character replacement script for Site Studio / idocscript
Working on creating and RSS feed of items in our CMS via the RSS feed component in Site Studio. I have the feed generating, but the Google Product search parser that I need to read the feed balks at odd (non-standard) characters like "o-slash" and an accented e. We have many items with foreign-language descriptions or authors from non-English countries that use characters outside of standard English.
I would have thought that using xml(parameter) would have solved this problem, but it does not.
At the moment, I'm "solving" this by individually locating the error and adding a "regexReplaceAll" for each one to change it to a somewhat acceptable alternative. It gets even tougher when, for example, I have to replace for the "o-slash" by using this:
<!--$theAuthor = regexReplaceAll(xCreator, "ø", "&#248;")-->
because the server recognizes the o-slash as ø, but the xml parser (Google Product search's data feed) will accept it only if I also make the ampersand in the entity an entity as well.
My question is... is there an easier way to find and replace for all these potential pitfalls? Is there a idocscript that someone has already written and is willing to share?
Thanks in advance for any help you can give.
Barry
(using Site Studio 10gR4)Thanks, but <!--$xml(descriptionText)--> doesn't seem to work for this parser (Google products data feed) and/or the characters that are being used.
For example, the output of <!--$xml(descriptionText)--> is this:
"...lleven un método efectivo para medir la satisfacción..."
and the error is this:
"Some of the characters in your items seem to be invalid.
...lleven un método efectivo para medir la satisfacción..."
So the parser is either seeing something different than what I see (even though we're reading the same file) or it just doesn't consider "é" and "ó" to be valid xml (and I have no idea if they are or not).
I have been asking for more guidance on the Google products board, too, but was hoping that there was something else that could be done from Site Studio end.
Thanks!
Barry -
Newbee needs suggestions for a search and replace script
I can't figure out this scripting stuff. I looked at the scripting guide I downloaded from adobe some time ago. I am not a programmer.
I do not need a script that says "hello world."
I need a script that will do the following:
Search selected text from one point to another. let me explain.
I create a table of contents in InDesign CS4. We separate our book sections by "section". So the TOC looks like:
Section 1
item one.... 1
item two... 2-4
item three... 5
Section 2
item one... 1-3
item two... 4-5
item three... 6
and so forth.
I then manually go in and change the TOC to:
Section 1
item one... 1 - 1
item two... 1 - 2-4
Section 2
item one... 2 - 1-3
item two... 2 - 4-5
Where the page reference in the TOC contains the section prefix and the page number provides the page range (if more than one page). Should mention that when I create the TOC I use a place holder in the TOC style set up for the section prefix; that is, my TOC initially looks like:
Section 1
item one.... X - 1
item two.... X - 2, etc. I then highlight a range and find/change for each range.
So, the script would do the following:
Look in selected text (the entire TOC) frame which at times spans two or three pages from Section 1 to Section 2:
Change the "^t (tab before number) to "^t (section number)(space)(hyphen)(space)":
And then look at next number (i.e "4") and change the previous end of previous line from "1" to "1-3"
Then repeat for range from Section 2 to Section 3, etc.
Currently, I do it manually. That is ok, but it would be great to have a script that would do this for me.
Thanks in advance,
RPPThe last thing you need is a script.
When you want to make your TOC, go to Pages, Numbering and Section Options, and put a section prefix in like 1- for each section (both 1 and 2 in your case). Click "Include Prefix When Numbering Pages".
Then make your TOC.
It will have all the section prefixes. ("1-1", "2-2-4", examples)
Now just change the Numbering and Section Options BACK to your pre-TOC defaults. As long as you don't update the TOC under Layout/Update TOC, your TOC text will contain the prefix, but your page numbers will look normal. If you have to change the text in the TOC for any reason, do it manually.
Let me know if that works.
Greg Ledger
www.macproductionartist.wordpress.com -
InDesign CS3 & MathType 6.5 Windows
I use InMath in InDesign. We have equations/stacked Math problems in Word with MathType 6.5 used.
I want to copy and paste the text out of MathType 6.5 and paste it in InDeign as "text" to do the equations in InMath in InDesign. I have not succeded. The copy/paste from Words MathType keeps pasting in as a graphic.
Help...Seems to me you have two choices:
1) You can give client required Mathtype EPS files without PDF.
2) Or you can educate client. Mathtype EPS files don't always work. Illustrator AI files do.
You don't have to leave out the EPS files. You can still deliver EPS to client, in fact you'll want to save EPS (or WMF) as a source file from which to make changes. Just make the AI file for ID.
FWIW, I've been using various versions of Mathtype with different DTP applications (not just Indesign) since 1997. None of the versions I've used (I haven't tested 6.5 yet) has been 100% suitable for high-end desktop publishing. Despite that, I've always managed to make it work, and I've typeset dozens of equations books--some with literally thousands of equations in them--using Mathtype.
Sometimes the client really is wrong.
Ken -
This probably sounds redundant
over and over again , automating a script, but is there a way of assign
ing a keyboard shortcut
or run the
script in an action? I use mucho a script written and generously shared by JET to joinnearest points. It's a pain to have to click on file and then scripts and then select the script each time. I would like to eliminate 2 clicks (or mashes as they say in the southern states). Is there a way to do this within the script (adding a lline)?
Guidance will be appreciated.This Action-Script bug has been present for several versions, at least
Correct. I have been complaining about this bug for four versions now.
It has become my practice to do this:
I keep an Action defined in my Actions palette named JET_CurrentScript. When it becomes clear to me that I will be repeatedly using a script in a work session, I go ahead and use InsertMenuItem to insert the step in that Action.
This is not a fix or even a workaround. It just lessens the tedium in certain circumstances. It becomes just as tedious, of course, if you have to do that for multiple frequently-needed scripts with every launch (you know--like having to reset your palette settings in Swatches, Doc Info, etc.)
Illustrator's script access interface--like too much in Illustrator--is half-baked. Sloppy. Rushed-to-market. Compare to InDesign's Scripts palette.
Now that ScriptUI provides for creation of floating dialogs (and supposedly modeless palettes--something else that's quite problematic with Illustrator's scripting implementation), one can combine several scripts into one dialog to handle multiple user inputs. I may get around to doing that with closely-related groups of my scripts, but am currently just getting acquainted with the rather tedious ScriptUI model.
There are ways to make a script run when the program is launched. So it may be conceivable to devise a startup script that would launch a script containing such a multi-purpose palette. But I haven't monkeyed around with that yet, because it would be dependent upon the afore-mentioned modeless dialog working correctly--you wouldn't want a modal dialog to appear whenever you launch the program.
I'm certainly no advanced Javascripter; I'm a self-motivated, self-trained "student" and "experimenter" when the mood strikes.
I'm gratified, by the way, that some of you seem to fiind my Join scripts handy. I consider the functionality indespensible in my own work, which is why I hacked them out. But it is absolutely absurd that one has to resort to custom scripting to do something that should so obvously be a standard function in the program.
JET
Maybe you are looking for
-
Hi All, Just updated to Windows 8.1 64 bit from Windows 8. The Cardbus slot speed/bandwidth has dropped considerably to the point that it is now unusable since the update. It worked fine before, although I had a similar problem in the past which was
-
Liquid layouts not quite working... help!
Hi Guys, I am hoping one of you will be able to help. I have finished reading some books on AS3 and started working on a liquid transition animation using actionscript 3.0 (see attached .fla). Basically, I am setting the stage scaling to NO_SCALE and
-
Illustrator cs2 "quit unexpectedly"
it crashes every time i try to open it... i tried trashing the prefs and it still doesn't work. Anyone have any other ideas to help me please??
-
Aironet 1600 + Freeradius + openLDAP
Hi at all, i need to know if is possible to have this kind of configurations, because I'm going crazy to test it and nothing work. I've freeradius attached to OpenLDAP with user and password crypted with SSHA, but the Aironet don't want to authentica
-
Migrating application from 8 to 9i
Hello. After upgrading to 9i and trying my applications it gives error message about missing OCIDirPathStreamToStream in OCI.DLL Inspecting both version of dll-file confirmed that OCIDirPathStreamToStream function, while presented in ver.8, is absent