Script to move all items on each page
I'm quite new to scripting, but I'm trying to write a script to select all elements on each page and shift the X values and are specified. The script works but only seems to move 1 point on each page, I know it's probably something really simple and I was wondering if anyone here could point me in the right direction?
This causes the:
for (a = myPages-1; a>=0; a--) { app.activeDocument.pages[a].pageItems.everyItem().select(); app.selection[0].move (null, positions) }
You are 'select' objects but only moving one...
In normal circumstances, you should use 'select' in a script - you can 'target' any object immediately. And even if you did have something selected, all objects will move again! Change for this, I have not tried, but it should make it work:
for (a=myPages-1; a>=0; a--) { app.activeDocument.pages[a].pageItems.everyItem().move (null, positions); }
Tags: InDesign
Similar Questions
-
Move all items from carton to a layer in InDesign (AS)
Just learning how to move all the guides to a layer, now I would like to just the products box to a layer. My goal is to separate the elements of page elements pastnoard on separate layers. Favorite AppleScript.
It seems like it should be very simple, but I can't work as a (ID CS5, Mac OS x 10.6.8).
If I select a point on the editing table and ask its parent, the result page is 'nothing. ' But asking you for each page element whose parent page has nothing (or 'nothing' or 'no' or 'nada' or "") returns no result.
Can I ask for each item in the page which the parent page ID is the identification number of my single page, and you will find the item on this page (except the items in cardboard), but if I ask for each page element whose ID is NOT the ID of my page, it does not find the two points that I put on the editing table.
Substances, can you get it actually works in JS?
The only thing I've found so far and who works at all in AppleScript is a solution very kludgy:
Tell application "Adobe InDesign CS5"
Tell document 1
each element of the page including the id of the parent page is greater than 1 the value myPageItems
the value myEveryItem for each page element
Repeat with myItem in myEveryItem
If is not then myItem in myPageItems
myItem move to the layer "layer of cardboard.
end if
end repeat
tell the end
tell the end
That could take some time to run on a document with a lot of page elements. It is good to be a better way...!
-
How to reset all items on a page on the page change?
Hi all!
I'm trying to reset all items whenever a user edits a page. Then when they are on page 17, they can calculate the food values, and these values get inserted into page elements.
Now, I want to be able to reset all these objects on page 17, when a user goes to one page other than 17.
I did a page process, on the laundry after the header, visit runs once per page.
The code is like this:
So basically, if the current page is not 17, then it should reset all values. Why does this work?if :APP_PAGE_ID <> 17 then :p17_set_unit := null; :p17_set_language := null; :p17_set_weight := null; :p17_new_weight := null; :p17_new_kcal := null; :P17_new_carbs := null; :p17_new_protein := null; :P17_new_fat := null; :p17_foodname := null; :p17_select_foodname := null; :p17_foodid := null; end if;
I made other processes that do the same (as when you change the language of food, all items except the point of language GET reset), but it does not work.
What I am doing wrong? Or should I fix this on a different path?
Thanks in advance.
APEX version: 4.1.1.00.23Hello, Magali,.
Oops! I missed it. We do not have the process on page 0!
You can create a Process of Application which runs in charge of pages and clears the cache for the page 17 using APEX_UTIL. CLEAR_PAGE_CACHE. Use the above condition.
Reference:
http://docs.Oracle.com/CD/E23903_01/doc/doc.41/e21676/apex_util.htm#BABCIAFJ
I hope that helps!
Kind regards
Kiran -
Remove nonprinting items from each page/double
Hi all
Below is my code that can be selected all nonprinting items on a single broadcast. As we can not select all items appear on more than a spread in InDesign.
That is why it is showing error if my spread exceeds more than one. I want to edit this script in a way so that it can remove all nonprinting items appear in more of a spread.
Can someone help me on this.
NonPIt = app.activeDocument.layers.item (0) .allPageItems;
for (a = 0; a < NonPIt.length; a ++)
If (NonPIt [a] .nonprinting is true)
{
App.Select (NonPIt [a]).
Alert ("Selected item No."+ [a] ");
}Thank you
tans
Maybe something like this:
NonPIt = app.activeDocument.layers.item(0).allPageItems; for (a=0; a
Hope that helps.
--
tomaxxi
-
Select and move items on the page...
Hello world
We are currently working with InDesign CS3 documents. I have to select all the items on each page and move it with 9 pts both both horizontal than vertical position. If it's a recto page movement-9 pts and if it's the back page must move + 9pts. So what I do is, try to select all items in page and do it in a group. After this should get the geometric limits of the Group and move it in 9 pts. I got an error when doing my selection in the group. Find the script below
//------------------------------------
var doc = app.activeDocument;
var mySelection is doc.pageItems.everyItem () .select ();.
var myGroup = doc.groups.add (mySelection);
//------------------------------------
can anyone give in this help me. Also suggest me if there is a better way to do it.
Concerning
Indana
Try this:
var dx = 9, u = 'pt'; Object.prototype.offsetX = function() { if (this.parent.constructor != Page) return; var sgn = 1 - 2*(this.parent.documentOffset%2); this.move(undefined,['' + sgn*dx + u,0]); } var items = app.activeDocument.pageItems.everyItem().getElements(); var obj; while(obj=items.pop()) obj.offsetX();
Marc
-
Export selected items on each InDesign pages in JPEG format
Hi all
I have InDesign CS5.5. I have a document with more than 50 pages, and each page has a unique image and description for the image.
I need to export each page as a JPEG. but I don't want to export at full page. I don't need the elements on each page. So, I go to each page and select all the elements and exports. When exporting, I use the same name of the image used on each page.
I tried to write a screenplay, but it exports only the current page. I do not know how to navigate to the next page and export.
is that someone can help.
Here is my script.
myDoc var = app.activeDocument;
var myNumPages = myDoc.pages.length; get the number of pages
var CheminMonFichier = myDoc.filePath; get the path of the file
myRectangle = app.activeWindow.activePage.allGraphics var; get the graph of the current page
var app.activeWindow.activePage.name = myPageName; get the name of the page.
if(myRectangle.Length >1)
{
Alert ("the page has more than one image. Remove the other image to export');
Exit();
}
var myImageName =. itemLink.name myRectangle [0]; get the name of the image
App.Select (NothingEnum.Nothing);
for (var i = 0; i < myNumPages; i ++)
{
app.jpegExportPreferences.jpegQuality = JPEGOptionsQuality.high;
app.jpegExportPreferences.exportResolution = 300;
app.jpegExportPreferences.jpegExportRange = ExportRangeOrAllPages.exportRange;
app.jpegExportPreferences.pageString = myPageName;
mySelectedItems();
}
function mySelectedItems()
{
var myObj = new Array;
myObj = app.activeWindow.activePage.pageItems;
Try
{
app.activeWindow.activePage.groups.add (myObj);
}
catch (e)
{
}
App.Select (App.activeWindow.activePage.allPageItems);
App.Selection [0] .exportFile (ExportFormat.JPG, file (CheminMonFichier + "/" + myImageName + ".")) "" "JPEG")(, false);
}
export all images of each page like this test
myDoc var = app.activeDocument;
var myDoc.filePath = myFolder.
var myImage = myDoc.allGraphics;
for (var i = 0; myImage.length > i; i ++) {}
App.Select (myImage [i]);
var MyImageNmae is myImage [i].itemLink.name;.
app.jpegExportPreferences.jpegQuality = JPEGOptionsQuality.high;
app.jpegExportPreferences.exportResolution = 300;
App.Selection [0] .exportFile (ExportFormat.JPG, file (MyFolder + "/" + MyImageNmae + ".")) "" "JPEG")(, false);
Alert (myImage, [i],.itemLink.Name)
}
-
Active script that selects all of the items spread
I'm trying to find a 'simple' script that selects all elements on the page, either a group or individual items without using a dialog window. Is there a selection simple javascript to select all the objects on a page or spread for InDesign CS3? I'm new to this sort of thing script.
Hey!
PankChat is right, but you can't 'see' the selection.
If you want to 'see' what is selected, try this:
app.select(app.activeWindow.activePage.allPageItems);
tomaxxi
-
Script to move the same objects of value of color to a layer
I have a range of color objects upward into process colors, and I would like to the moved to the individual layers of script.
so the result would be to move all items from cyan to CYAN layer, move all the magenta elements to the Magenta layer, etc. etc.
Could someone help please?
Thank you very much
something like this will do the trick.
Don't forget: this can make a mess of your z-order...
function seperate_items_to_layers_by_colour(){ var doc = app.activeDocument; var item = doc.pageItems; var C_lay = make_layer_if_needed("CYAN"); var M_lay = make_layer_if_needed("MAGENTA"); var Y_lay = make_layer_if_needed("YELLOW"); var K_lay = make_layer_if_needed("BLACK"); for(var i=0; i
-
Add textFrame on each page of the document
I tried to write a JavaScript script to add a textframe on each page of a document.
The script is written is:
myDocument var = app.activeDocument;
for (pageCounter var = 0; pageCounter < myDocument.pages.length; pageCounter ++) {}
Create a text frame on page pageCounter
var myTextFrame = myDocument.pages.item (pageCounter).textFrames.add ();
The scope of the text block
myTextFrame.geometricBounds is ['60 p', 22 ' p', '65P', "40 p"];.
Enter text in the text block.
var pageCounterPlus1 = pageCounter + 1;
{myTextFrame.contents = "Page" + pageCounterPlus1 + "" + myDocument.pages.length}In my 5 page document, the script sets a textframe on page 1, 2, page 2 and 2 and page 4, but omits pages 3 and 5.
My guess is that it's something on the pages, but I don't know how to fix it.
Any suggestions?
Thank you.
Urban Landreman
Urban salvation,
Change the original units of the rule extends to the Page:
myDocument var = app.activeDocument;
myDocument.viewPreferences.rulerOrigin = RulerOrigin.PAGE_ORIGIN;I hope this helps.
Kasyan
-
How to recover the large number of columns for all items at once
I have a table (T1) with a large number of columns (50). I am building a page on which I would like to consolidate these columns in some regions:
Region: has
Items i1 - i10
Region: B
I11 - i20 items
Region: C
I21 elements - i30
…
Etc.
The majority of the articles on this page are extracted from the same table (T1). So far, the type of each source element has the value SQL query and each item has the motion of the source is defined as:
SELECT column1 FROM t1 WHERE t1id =: global_item
What is the best practical approach to retrieve values for all items on this page? Is there a way to retrieve all the columns point at the same time, something like:
SELECT column1, Column2, Column3, column50 FROM t1 WHERE t1id is: global_item
Instead of:
I1 point source:
SELECT column1 FROM t1 WHERE t1id =: global_item
Point source i2:
SELECT Column2 FROM t1 WHERE t1id =: global_item
Point i3 source:
Column3 SELECT FROM t1 WHERE t1id =: global_item
…
Item i50 source:
SELECT column50 FROM t1 WHERE t1id =: global_item
For each item on this page, when they are displayed?
Thank you for your time.
DanielSet the source of static assignment type item and delete individual values of source of SQL query. Create a process before the header PL/SQL along the lines of
begin select column1 , column2 , column3 ... , column50 into :i1 , :i2 , :i3 ... , :i50 from t1 where t1id = :global_item; end;
OR
Create an automated process line go through the wizard for the table T1, then set the Source Type of the database column and the source values for each item in the name of the corresponding column in the T1.
-
my computer still not crash each time I have delete or move an item, how can I fix?
whenever I have move an item to another folder as some blocking window. samething when I delete 1 point he blocks as well. what I always do is to put an end to the task bar and open another window
Hello
What antivirus/antispyware/security products do you have on the machine? Be one you have NEVER
on this machine, including those you have uninstalled (they leave leftovers behind which can cause
strange problems).----------------------------------------------------
Follow these steps:
Start - type this in the search box-> find COMMAND at the top and RIGHT CLICK – RUN AS ADMIN
Enter this at the command prompt - sfc/scannow
How to analyze the log file entries that the Microsoft Windows Resource Checker (SFC.exe) program
generates in Windows Vista cbs.log
http://support.Microsoft.com/kb/928228Also run CheckDisk, so we cannot exclude as much as possible of the corruption.
How to run the check disk at startup in Vista
http://www.Vistax64.com/tutorials/67612-check-disk-Chkdsk.html==========================================
After the foregoing:
How to troubleshoot a problem by performing a clean boot in Windows Vista
http://support.Microsoft.com/kb/929135
How to troubleshoot performance issues in Windows Vista
http://support.Microsoft.com/kb/950685Optimize the performance of Microsoft Windows Vista
http://support.Microsoft.com/kb/959062
To see everything that is in charge of startup - wait a few minutes with nothing to do - then right-click
Taskbar - the Task Manager process - take a look at stored by - Services - this is a quick way
reference (if you have a small box at the bottom left - show for all users, then check that).How to check and change Vista startup programs
http://www.Vistax64.com/tutorials/79612-startup-programs-enable-disable.htmlA quick check to see that load method 2 is - using MSCONFIG then put a list of
those here.
--------------------------------------------------------------------Tools that should help you:
Process Explorer - free - find out which files, key of registry and other objects processes have opened.
What DLLs they have loaded and more. This exceptionally effective utility will show you even who has
each process.
http://TechNet.Microsoft.com/en-us/Sysinternals/bb896653.aspxAutoruns - free - see what programs are configured to start automatically when you start your system
and you log in. Autoruns also shows you the full list of registry and file locations where applications can
Configure auto-start settings.
http://TechNet.Microsoft.com/en-us/sysinternals/bb963902.aspx
Process Monitor - Free - monitor the system files, registry, process, thread and DLL real-time activity.
http://TechNet.Microsoft.com/en-us/Sysinternals/bb896645.aspxThere are many excellent free tools from Sysinternals
http://TechNet.Microsoft.com/en-us/Sysinternals/default.aspx-Free - WhatsInStartUP this utility displays the list of all applications that are loaded automatically
When Windows starts. For each request, the following information is displayed: Type of startup (registry/Startup folder), Command - Line String, the product name, Version of the file, the name of the company;
Location in the registry or the file system and more. It allows you to easily disable or remove unwanted
a program that runs in your Windows startup.
http://www.NirSoft.NET/utils/what_run_in_startup.htmlThere are many excellent free tools to NirSoft
http://www.NirSoft.NET/utils/index.htmlWindow Watcher - free - do you know what is running on your computer? Maybe not. The window
Watcher says it all, reporting of any window created by running programs, if the window
is visible or not.
http://www.KarenWare.com/PowerTools/ptwinwatch.aspMany excellent free tools and an excellent newsletter at Karenware
http://www.KarenWare.com/===========================================
Vista and Windows 7 updated drivers love then here's how update the most important.
This is my generic how updates of appropriate driver:
This utility, it is easy see which versions are loaded:
-Free - DriverView utility displays the list of all device drivers currently loaded on your system.
For each driver in the list, additional useful information is displayed: load address of the driver,
Description, version, product name, company that created the driver and more.
http://www.NirSoft.NET/utils/DriverView.htmlFor drivers, visit manufacturer of emergency system and of the manufacturer of the device that are the most common.
Control Panel - device - Graphics Manager - note the brand and complete model
your video card - double - tab of the driver - write version information. Now, click on update
Driver (this can do nothing as MS is far behind the certification of drivers) - then right-click.
Uninstall - REBOOT it will refresh the driver stack.Repeat this for network - card (NIC), Wifi network, sound, mouse, and keyboard if 3rd party
with their own software and drivers and all other main drivers that you have.Now in the system manufacturer (Dell, HP, Toshiba as examples) site (in a restaurant), peripheral
Site of the manufacturer (Realtek, Intel, Nvidia, ATI, for example) and get their latest versions. (Look for
BIOS, Chipset and software updates on the site of the manufacturer of the system here.)Download - SAVE - go to where you put them - right click - RUN AD ADMIN - REBOOT after
each installation.Always check in the Device Manager - drivers tab to be sure the version you actually install
presents itself. This is because some restore drivers before the most recent is installed (sound card drivers
in particular that) so to install a driver - reboot - check that it is installed and repeat as
necessary.Repeat to the manufacturers - BTW in the DO NOT RUN THEIR SCANNER device - check
manually by model.Look at the sites of the manufacturer for drivers - and the manufacturer of the device manually.
http://pcsupport.about.com/od/driverssupport/HT/driverdlmfgr.htmHow to install a device driver in Vista Device Manager
http://www.Vistax64.com/tutorials/193584-Device-Manager-install-driver.htmlIf you update the drivers manually, then it's a good idea to disable the facilities of driver under Windows
Updates, that leaves about Windows updates but it will not install the drivers that will be generally
older and cause problems. If updates offers a new driver and then HIDE it (right click on it), then
get new manually if you wish.How to disable automatic driver Installation in Windows Vista - drivers
http://www.AddictiveTips.com/Windows-Tips/how-to-disable-automatic-driver-installation-in-Windows-Vista/
http://TechNet.Microsoft.com/en-us/library/cc730606 (WS.10) .aspx===========================================
Refer to these discussions because many more excellent advice however don't forget to check your antivirus
programs, the main drivers and BIOS update and also solve the problems with the cleanboot method
first.Problems with the overall speed of the system and performance
http://support.Microsoft.com/GP/slow_windows_performance/en-usPerformance and Maintenance Tips
http://social.answers.Microsoft.com/forums/en-us/w7performance/thread/19e5d6c3-BF07-49ac-a2fa-6718c988f125Explorer Windows stopped working
http://social.answers.Microsoft.com/forums/en-us/w7performance/thread/6ab02526-5071-4DCC-895F-d90202bad8b3Hope these helps.
-
Script to remove all the images, text blocks, and the page numbers on a layer
I have a 364 pages with 322 illustrations, photographs mainly, for offset printing.
The photographs will be be overprinted with the varnish on a plate in the fifth, and I set it up as follows:
On a new layer, (double layer 1) all photos are removed, but not their mounts.
The frames are then filled with 100% black.
All text blocks and page numbers must also be deleted.
I realize I could have done this job easier if I put all the images on their own layer first, but unfortunately I do not have.
And I don't do myself, script, so I was wondering if anyone has a script that will do...
With the help of CC 2015.1 on Windows 7.
Today, I don't have time to finish, which gave time to until now is the following:
var myDocuments = app.documents.everyItem(); var myLayers = myDocuments.layers.everyItem(); var myStories = app.activeDocument.stories.everyItem().getElements(); var myDoc = app.activeDocument; var myLayer = "palette"; //Add your layer name here var NewLayer = myDoc.layers.item(myLayer).duplicate(); myDocuments.pageItems.everyItem().locked = false; myLayers.locked = false; myDoc.layers.item(myLayer).visible = false; NewLayer.name = "SampleNew"; //Add your new layer name here re(); function re(){ var link, image; var openDocs = app.documents; var openDocsLen = openDocs.length; for (var d = 0; d < openDocsLen; d ++){ currDoc = openDocs[d], links = currDoc.links, counter = 0; myLayer.locked = true; myDocuments.layers.item(myLayer).locked = true; for (var i = links.length-1; i >= 0; i--) { if (links[i].hasOwnProperty('relink')) { try { link = links[i]; image = link.parent; image.remove(); counter++; } catch (err) { $.writeln(i + " - " + err); } } } } } var myStories = app.activeDocument.stories.everyItem().getElements(); for (i = myStories.length - 1; i >= 0; i--){ var myTextFrames = myStories[i].textContainers; for (j = myTextFrames.length - 1; j >= 0; j--){ myTextFrames[j].remove(); } }
If nobody finished the second finalized.
Hug!
-
Move all the items assigned an object Style to a specific layer?
Hi all
I just posted this in the regular InDesign forum but thought you Scripting Guys can have some smart solutions too:
I'm working on a long document in InDesign (think the or not!) in which I have a lot of shots of models and images of the still life as it comes to women's fashion catalog. I only work in InDesign as all Photoshop work is ensured by our repro House, off site. At the present time the way in which I communicate all work comp that needs to be done is by placing a solid box of magenta or cyan on the image for maximum visibility. Of course, I have a style of object applied to these boxes, and I also like to keep a layer separate from the work immediately so that they can be off print times.
Often I forgot to move a box to the correct layer or sometimes just slows me to do. What I would ideally like to do is assign a layer to the style of the object, but seeing that this is not possible, I was wondering if there is another solution to get all these boxes one layer in one foul swoop and so save me a piece of time.
Thanks in advance!
Ah, sorry about that. The script makes the unfounded assumption that each object has a style of object applied to it.
Try this variant:
myDoc = app.documents [0];
myPIs = myDoc.pageItems.everyItem () .getElements ();
for (var j = myPIs.length - 1; j > = 0; j-) {}
try {}
If (. appliedObjectStyle.name myPIs [j] = 'Repro Note') {}
.itemLayer myPIs [j] = 'Repro Notes. "
}
} catch (e) {}; ignore the elements that have no style object
}
Dave
-
ITunes is downloading all items purchased from my iPhone, including tv shows and movies, using all the memory and batteries, does anyone know how to stop this?
Hi anthony248,
If you don't want the automatic downloads enabled on your iPhone, follow the steps outlined in the article below, except that you will turn off the switch rather than turn them on. I'll also include a link about the storage capacity of your iPhone and how to delete items that you don't want.
Check your storage space on your iPhone, iPad and iPod touch
Take care
-
Not all the items on the Page appear in the window Session
Version 4.2.5.00.08
Hello
I have a page with elements of Page 48, and when I click on the Session icon in the bar than 37 see the same developer when lines is set to 5000 and the view is defined on Page elements and I click on the Set button.
I tried another page with Page 37 items and only 17 show in the window Session.
I checked in Firefox version 39.0 and IE 11.0.9600.17914
Anyone know how to do to have ALL elements of the Page view?
Can what information I provide?
Thank you
Joe
Hey Joe,
This previous discussion may help you: Re: popup for Session State
Thank you
Erick
Maybe you are looking for
-
Photosmart HP 7520: 10 Windows Error Message update for HP 7520
Daily I get this message. This message started when I got a netbook XP approximately 1-1/2 years he is a. I was hoping that this message would have disappeared when I bought my new laptop running Win 10, but it didn't. I don't even have anymore of th
-
Need some information on the Satellite A100-474 screen refresh rate
Hello.Good time of day. I try install asp linux on my laptop. To configure X Windows I have to configure horizontal and vertical refresh of the screen (Toshiba TruBrite WXGA TFT).Any ideas how I can find these values? With respect and graditude, Rave
-
HP 15-n096sa hard drive enclosure
I have recently buy a hp from ebay and they send me winout hard drive. I buy a hard drive, but the problem is that I don't have a shopping cart. Where can I find a shopping cart of 15-n096sa Hp
-
This is not directly related to the LabVIEW but he wanted everyone to be aware of something that could dramatically change this and all the forums software such as we know them today. I was going to post this on breakpoint , but I wanted more people
-
SystemInfo shows a das Systemtreiber der cdfs deaktiviert ist. Also ich wie Aktiviere
RECHNER der liesst CD, aber keine DVD. VIELLEICHT liegt're ja a dem Systemtreiber cdfs deaktivierten?