0
Could smd translate this into JS-language
New Here
,
/t5/indesign-discussions/could-smd-translate-this-into-js-language/td-p/1150411
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?
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
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Community Expert
,
/t5/indesign-discussions/could-smd-translate-this-into-js-language/m-p/1150412#M277998
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
CC = myTable.cells.length;
Tt = 100 / CC;
for (i = 0; i < CC; i++)
{
myTable.cells.fillColor = "Red";
myTable.cells.fillTint = 100 - Tt * i
}
Peter
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Guru
,
/t5/indesign-discussions/could-smd-translate-this-into-js-language/m-p/1150413#M277999
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
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
_Dmitry1776_
AUTHOR
New Here
,
/t5/indesign-discussions/could-smd-translate-this-into-js-language/m-p/1150414#M278000
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.
Thanks.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Explorer
,
/t5/indesign-discussions/could-smd-translate-this-into-js-language/m-p/1150415#M278001
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
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
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
_Dmitry1776_
AUTHOR
New Here
,
/t5/indesign-discussions/could-smd-translate-this-into-js-language/m-p/1150416#M278002
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
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
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Community Beginner
,
/t5/indesign-discussions/could-smd-translate-this-into-js-language/m-p/1150417#M278003
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
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
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
_Dmitry1776_
AUTHOR
New Here
,
/t5/indesign-discussions/could-smd-translate-this-into-js-language/m-p/1150418#M278004
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 ...
-----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 ...
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
_Dmitry1776_
AUTHOR
New Here
,
/t5/indesign-discussions/could-smd-translate-this-into-js-language/m-p/1150419#M278005
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"
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"
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Community Beginner
,
/t5/indesign-discussions/could-smd-translate-this-into-js-language/m-p/1150420#M278006
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
should be:
myInDi.ScriptPreferenceS.EnableRedraw = False
"S" - after preference
robin
--
www.adobescripts.com
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
_Dmitry1776_
AUTHOR
New Here
,
LATEST
/t5/indesign-discussions/could-smd-translate-this-into-js-language/m-p/1150421#M278007
Apr 19, 2008
Apr 19, 2008
Copy link to clipboard
Copied
Yes! Thanks.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

