Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently May 18th, 2024, 11:30 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Script to automate reading multiple objects positions
PostPosted: June 10th, 2016, 12:41 pm 
Offline
Godlike
Godlike

Joined: November 11th, 2004, 1:18 pm
Posts: 1213
Location: New York
Opus: Opus Pro 9.75
OS: Windows 10 Pro 64 bit
System: Core i7, 16G RAM, Nvidia 640GT (desktop), plus Windows 10 and Android tablets
I have a large number of objects (frames) that I position on a page (F1, F2...F54 and F1t, F2t...F54t). Once positioned manually in the editor, I would need to get each and every object's current X and Y positions (to use later in another script).

Tedious task, since there are many objects, multiple pages (currently getting X and Y for each by mousing over, manually reading/recording for each). :cry:

Wonder if there is a way to read these objects into an array, get the X, Y using a script that I could run? Haven't been able to get my brain around how to write this script if it is even possible. (maybe something like this script and IMP example by Brendon Knifton could be modified to loop through these objects?: viewtopic.php?f=4&t=1703&hilit=read+position)

Would be appreciative for any help with the script.

_________________
Stephen


For this message Stephen has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: Script to automate reading multiple objects positions
PostPosted: June 10th, 2016, 6:02 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
For a parent frame called masterFrame full of other objects.
Code:
myChildren = masterFrame.GetNumberChildren()

for (var i=0;i<myChildren;i++) {
   myChild = masterFrame.GetChild(i);
   myChildName = myChild.GetName();
   myChildPosition = myChild.GetPosition();
   //Do something with the information
   Debug.trace(myChildName + ': ' + myChildPosition.x + ',' +myChildPosition.y + '\n');
}


</mack>

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject: Re: Script to automate reading multiple objects positions
PostPosted: June 11th, 2016, 12:16 am 
Offline
Godlike
Godlike

Joined: November 11th, 2004, 1:18 pm
Posts: 1213
Location: New York
Opus: Opus Pro 9.75
OS: Windows 10 Pro 64 bit
System: Core i7, 16G RAM, Nvidia 640GT (desktop), plus Windows 10 and Android tablets
Thank you, Mack.

Wasn't sure, at first, if using a frame to hold the many child objects would, using this script, give positions of the child objects relative to the frame's position.

Tried it out and the positions are thankfully relative to the entire page, as needed. So, it works!

Best Wishes,

_________________
Stephen


For this message Stephen has been thanked by : mackavi


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group