Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently December 23rd, 2024, 7:07 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Save position of the objects
PostPosted: May 23rd, 2009, 8:14 pm 
Offline

Joined: March 4th, 2007, 7:17 pm
Posts: 132
I'm trying to make a record to a text file positions of graphical objects. The objects, in my example, are three and its can drag. Therefore, you want to save as a text file its positions and then the opposite from the file set the positions.

Code:
for ( i = 1; i < 4; i++)
{
var names = "Image" + i
var x_coord = names.GetXPosition()
var y_coord = names.GetYPosition()
var coord = "[" + names + "]" + "\n" + "x = " + x_coord + "\n" + "y = " + y_coord
var textObj = OpenFile("coord.ini")
textObj.Write(coord)


Of course this solution does not work, because insertion of variables (names) instead of the graphical object is not allowed:(

How can i save the position of all required graphics on the page?

Another question. Users are asked to be able to create text commentary (like sticky) in the publication. To the user himself could create a new text object and write it several phrases. Maybe have someone ready solution to this problem?

Thank you for the assistance

_________________
Opus Pro 5.5
Win XP


Top
 Profile  
 
 Post subject:
PostPosted: May 24th, 2009, 6:27 am 
Offline

Joined: March 4th, 2007, 7:17 pm
Posts: 132
Found a solution for the first part of my question:
Code:
for ( i = 1; i < 4; i++)
{
var names = "Image" + i
var x = this.FindChild( names)
var y = this.FindChild( names)
x_coord = x.GetXPosition()
y_coord = y.GetYPosition()
var coord = "[" + names + "]" + "\n" + "x = " + x_coord + "\n" + "y = " + y_coord + "\n"
var textObj = OpenFile(SYSTEM_PUBLICATION_DIR + "coord.ini")
textObj.Write(coord)


Now you can save the positions of any objects in the publication as a file and when it is required to recover this position. Great!

For the second part there is no...

_________________
Opus Pro 5.5
Win XP


Top
 Profile  
 
 Post subject:
PostPosted: May 25th, 2009, 8:45 am 
Offline

Joined: May 16th, 2008, 4:50 pm
Posts: 368
Location: Berghem The Netherlands
Opus: Opus Pro 9.75
OS: Windows 10
System: `HP
Usefull. Thanks


Ad

_________________
Opus Pro v9.75
Windows 10 on HP EliteBook i7
http://www.csnmedia.nl


Top
 Profile Visit website  
 
 Post subject:
PostPosted: May 27th, 2009, 5:56 pm 
Offline

Joined: March 4th, 2007, 7:17 pm
Posts: 132
I have a new complexity to the opening of ini-files.

The script above get the path of the ini-file by using action File Browse. This opens a standard windows dialog box and the user selects the desired file. But if the user clicks Cancel, the script will still work and all the graphics will have coordinates equal to zero. I tried to set the conditions (if (path == "")), but it does not help.

Are there any analog File Browse action with scripts? To be able to set an action on pressing "Cancel"?

_________________
Opus Pro 5.5
Win XP


Top
 Profile  
 
 Post subject:
PostPosted: May 27th, 2009, 10:19 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Opus has two special variable types - null and undefined. Check for null for dialogue boxes. undefined is mostly for object properties.

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:
PostPosted: May 28th, 2009, 11:24 am 
Offline

Joined: March 4th, 2007, 7:17 pm
Posts: 132
Many thanks Mack!
You helped me very. Never knew about "undefined"
After action File Browse need to add script:

Code:
if (myPath != undefined)
{
set_coords ()
}

_________________
Opus Pro 5.5
Win XP


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 18 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