• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Could smd translate this into JS-language

New Here ,
Apr 16, 2008 Apr 16, 2008

Copy link to clipboard

Copied

I'd like to compare speed of two languages - vbs/js.
So, if smbd have spare time, translate this, pls into JS:

b Set MyInd = CreateObject("InDesign.Application.CS3")

b Set myDoc = MyInd.ActiveDocument

b Set myTable = MyInd.Selection.Item(1).Parent.Parent 'get the table into object

b CC = myTable.Cells.Count

b Tt = 100 / CC 'step of tinting

b For i = 1 To CC

b myTable.Cells.Item(i).FillColor = "Red"

b myTable.Cells.Item(i).FillTint = 100 - Tt * i

b Next

I'd like to test it on table 20x20. Cause in VBS it works extremely slow. Wonder, what about JS speed?
TOPICS
Scripting

Views

607

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 16, 2008 Apr 16, 2008

Copy link to clipboard

Copied

myTable = app.selection[0].parent.parent;
CC = myTable.cells.length;
Tt = 100 / CC;
for (i = 0; i < CC; i++)
{
myTable.cells.fillColor = "Red";
myTable.cells.fillTint = 100 - Tt * i
}

Peter

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Apr 16, 2008 Apr 16, 2008

Copy link to clipboard

Copied

var myStartTime = new Date();


var myDoc = app.activeDocument;
// some text is selected in the table
var myTable = app.selection[0].parent.parent;
var CC = myTable.cells.length;
var Tt = 100/CC
for ( i = 0; i < CC; i++ ) {
myTable.cells.fillColor = "Red";
myTable.cells.fillTint = 100 - Tt * i;
}

var myEndTime = new Date();
var myDuration = (myEndTime - myStartTime)/10000;
alert ("Duration - " + myDuration);


Kasyan

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 16, 2008 Apr 16, 2008

Copy link to clipboard

Copied

Thank, but i am shocked! JS faster (in this test) in times!!! about 5 s by JS and 50 s by VBS. Is it normal? (the sample scripts (js/vbs) work indentically by time).

Thanks.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 16, 2008 Apr 16, 2008

Copy link to clipboard

Copied

Hi Dmitry1776,

How are you running your VBScript? From Explorer, or from the Scripts panel? There shouldn't be that much difference in timing if both scripts are run from the Scripts panel. Or, at least, there's not a big difference when I run them.

Thanks,

Ole

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 16, 2008 Apr 16, 2008

Copy link to clipboard

Copied

i'm running from Script Panel. And now i noticed, if it works in background, speed the same, if in foreground - in 10 times slow.
So problem is in screen redrawing.
Then:
1. Can i turn off redrawing for script running time?
2. Why redrawing does not affect on JS-time?

Thanks

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 18, 2008 Apr 18, 2008

Copy link to clipboard

Copied

for VB:

Property EnableRedraw As Boolean
Member of InDesign.ScriptPreference
If true, enables redraw during script execution.

in JS redrawing is turned off by default - you need to call Recompose or something like that to redraw/refresh - needed when working with Text

robin

--
www.adobescripts.com

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 18, 2008 Apr 18, 2008

Copy link to clipboard

Copied

OK, thanks!

-----Original Message-----
From: Robert_Tkaczyk [mailto:member@adobeforums.com]
Sent: Friday, April 18, 2008 9:51 PM
To: adobe.scripting.indesign@adobeforums.com
Subject: Re: Could smd translate this into JS-language

A new message was posted by Robert_Tkaczyk in

InDesign Scripting --
Could smd translate this into JS-language


for VB:

Property EnableRedraw As Boolean
Member of InDesign.ScriptPreference
If true, enables redraw during script execution.

in JS redrawing is turn off by default - you need to call Recompose or
something like that to redraw/refresh - needed when working with Text

robin

--
www.adobescripts.com


------------------------------------------------------
View/reply at
Replies by email are OK.
Use the unsubscribe form at
to cancel
your email subscription.

__________ NOD32 3038 (20080418) Information __________

This ...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 19, 2008 Apr 19, 2008

Copy link to clipboard

Copied

" for VB: Member of InDesign.ScriptPreference
If true, enables redraw during script execution."

Set MyInd = CreateObject("InDesign.Application.CS3")
MyInd.ScriptPreference.EnableRedraw = True (or False) -

b writes "Method does not support"

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 19, 2008 Apr 19, 2008

Copy link to clipboard

Copied

sorry - it was copied from ObjectBrowser

should be:

myInDi.ScriptPreferenceS.EnableRedraw = False

"S" - after preference

robin

--
www.adobescripts.com

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 19, 2008 Apr 19, 2008

Copy link to clipboard

Copied

LATEST
Yes! Thanks.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines