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

Select and Scale ALL object in every pages

Community Beginner ,
Nov 20, 2020 Nov 20, 2020

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.

 

TOPICS
Scripting

Views

868

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

correct answers 1 Correct answer

Participant , Nov 20, 2020 Nov 20, 2020

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
...

Votes

Translate

Translate
Community Expert ,
Nov 20, 2020 Nov 20, 2020

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.

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 ,
Nov 20, 2020 Nov 20, 2020

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.

 

 

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 Expert ,
Nov 20, 2020 Nov 20, 2020

Copy link to clipboard

Copied

Check out Quick Resize from ID Extras: 

https://www.id-extras.com/products/quickresize/

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 ,
Nov 20, 2020 Nov 20, 2020

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.

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
Participant ,
Nov 20, 2020 Nov 20, 2020

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')}

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 ,
Nov 20, 2020 Nov 20, 2020

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!

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
Participant ,
Nov 20, 2020 Nov 20, 2020

Copy link to clipboard

Copied

LATEST

You can use these checkboxes:

s1.JPGs11.JPG

 

s2.JPGs22.JPG

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.

 

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