Copy link to clipboard
Copied
Hi,
I'm looking for a script to select every single object (tiff, eps, ai, text frame, pdf etc..) in every single page of my document and then scaling them of a desired %. (like: "cmd+A --> scale x,y" in the active page and repeat...)
Thank you in advance.
hi,
try this code:
function myChoice(){
var myWindow = new Window('dialog','scale objects: '+String(app.activeWindow.transformReferencePoint),undefined)
myWindow.orientation = 'row'
myWindow.size = [300,150]
// ------- PAGE -------
var myPagePanel = myWindow.add('panel',undefined,'Page')
myPagePanel.size = [200,125]
myPagePanel.alignChildren = 'right'
var myStartGroup = myPagePanel.add('group')
myStartGroup.add('statictext',undefined,'Start')
var startlist = myStartGroup.add('dropdownl
...
Copy link to clipboard
Copied
This may help you:
http://in-tools.com/article/scripts-blog/scale-graphics-script/
You cn also change pages size with liquid layout option.
Copy link to clipboard
Copied
Hi, thank you for your suggestion, but liquid layout, when you need to scale graphics and text together, is very messy!
However, I tried this script and works good with images and .ai, but not with text frames! it's a good start!
Thank you.
Copy link to clipboard
Copied
Check out Quick Resize from ID Extras:
Copy link to clipboard
Copied
Quick resize is a very good script, but it scale document and objects together! I need to scale only the content of my pages.
Thank you for your answer.
Copy link to clipboard
Copied
hi,
try this code:
function myChoice(){
var myWindow = new Window('dialog','scale objects: '+String(app.activeWindow.transformReferencePoint),undefined)
myWindow.orientation = 'row'
myWindow.size = [300,150]
// ------- PAGE -------
var myPagePanel = myWindow.add('panel',undefined,'Page')
myPagePanel.size = [200,125]
myPagePanel.alignChildren = 'right'
var myStartGroup = myPagePanel.add('group')
myStartGroup.add('statictext',undefined,'Start')
var startlist = myStartGroup.add('dropdownlist')
startlist.size = [125,25]
list_add(startlist,all_page)
startlist.onChange = list_change
var myEndGroup = myPagePanel.add('group')
myEndGroup.add('statictext',undefined,'End')
var endlist = myEndGroup.add('dropdownlist')
endlist.size = [125,25]
list_add(endlist,all_page)
endlist.onChange = list_change
// ------- SCALE -------
var myScaleGroup = myPagePanel.add('group')
myScaleGroup.add('statictext',undefined,'Scale')
var myScale = myScaleGroup.add('edittext')
myScale.size = [100,25]
myScale.text = '100'
myScale.onChanging = myScale_onChanging
// ------- BUTTON -------
var myButton = myWindow.add('button',undefined,'OK')
myButton.size = [50,40]
myButton.alignment = 'top'
myButton.onClick = myButton_click
myWindow.show()
// ______________________________________ EVENTS ______________________________________
function list_add(mobj,mlist){
for(var i = 0; i < mlist.length; i++){
mobj.add('item', mlist[i].appliedSection.name+mlist[i].name)
}
mobj.selection = 0
}
function list_change(){
if(this.selection == null){this.selection = 0}
}
function myScale_onChanging(){
this.text = this.text.replace(/[^\d]+/,'')
}
function myButton_click(){
if(endlist.selection.index >= startlist.selection.index){
myRez = {
'page':all_page.slice(startlist.selection.index,endlist.selection.index+1),
'scale':myScale.text,
}
myWindow.close()
}
else{alert('End page\nmust be greater (or equal) than\nStart page')}
}
}
function main(){
var winbar = new Window('palette','scale objects')
winbar.pro = winbar.add('progressbar', undefined, 0, myRez['page'].length)
winbar.pro.preferredSize = [300,20]
winbar.pro_text = 'Page '
winbar.pro_static = winbar.add('statictext', [10, 10, 310, 25], winbar.pro_text)
winbar.pro_count = 1
winbar.show()
for(var i = 0; i < myRez['page'].length; i++){
winbar.pro_static.text = winbar.pro_text+myRez['page'][i].name
winbar.pro.value = winbar.pro_count
winbar.pro_count++
winbar.update()
try{
myRez['page'][i].pageItems.everyItem().properties = {
horizontalScale:Number(myRez['scale']),
verticalScale:Number(myRez['scale'])
}
}
catch(e){}
}
winbar.close()
alert('done!')
}
try{var doc = app.activeDocument}
catch(e){exit()}
var all_page = doc.pages.everyItem().getElements()
var myRez = ''
myChoice()
if(typeof myRez != 'string'){app.doScript('main()', ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, 'scale objects')}
Copy link to clipboard
Copied
Thank you a lot! It's a great script!
Can I modifiy it for "scaling all objects to the center of the page" and not "to the center of the object itself"?
Thanks again!
Copy link to clipboard
Copied
You can use these checkboxes:
It's all.
If you want "scaling all objects to the center of the page" the script must parse "all objects" using geometric bounds relative to the page. Maybe someone else will add this processing to the script.