Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently December 22nd, 2024, 7:25 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 16 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Unwanted EXIT from program
PostPosted: February 2nd, 2005, 12:59 am 
Offline

Joined: November 3rd, 2004, 4:52 pm
Posts: 99
Location: Worcester. UK
Hi,

I do not understand why the attached program exits immediately on pressing the Begin button on the Enter Name page.

I have twelve different books. Pupils might be using them in a number of classes, and might have similar names.

I have a variable BOOKNAME to which a two letter text is given, in this case it is CT

I have a variable CLASSNAME where the user can input up to three numbers/characters

There is a variable USERNAME where the user enters their name.

CLASSNAME + BOOKNAME + USERNAME should be the name of the file (USERNAME) in which the name of the page at which the user exited USERPAGENAME is held.

When the CLASSNAME is entered and OK pressed, they are hidden, and the enter USERNAME boxes are displayed. However, when I hit BEGIN instruction, the program exits.

It's probably all to do with my limited understanding of programming!

All advice gratefully received.

Jhn


You do not have the required permissions to view the files attached to this post.


For this message JMahoney has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject:
PostPosted: February 2nd, 2005, 3:16 am 
Offline

Joined: November 28th, 2004, 6:05 am
Posts: 141
Location: USA
Hi John

Not sure why, but drop in a Delay 0.1 between Read from...
and Close File on Begin_text to solve the problem.

Cheers
Chris

_________________
Opus Resources and Services


For this message Chris Jones has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject:
PostPosted: February 2nd, 2005, 5:48 pm 
Offline

Joined: November 3rd, 2004, 4:52 pm
Posts: 99
Location: Worcester. UK
Thanks Chris,

Dropped in the delay - no effect. Wound it up to 1 sec, still no effect.

Whether there is text in the input box, or none, immediately I hit Begin - Opus is instantly closed.

Help!

John


For this message JMahoney has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject:
PostPosted: February 2nd, 2005, 8:50 pm 
Offline

Joined: November 3rd, 2004, 12:12 pm
Posts: 117
Location: France - Bretagne
Hi,

as chris wrote, if you put a delay AFTER the "close file" and BEFORE the "script", everything work well

Benoit

_________________
Opus Pro 06, Win XP.


For this message benoit has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject:
PostPosted: February 2nd, 2005, 10:47 pm 
Offline

Joined: November 3rd, 2004, 4:52 pm
Posts: 99
Location: Worcester. UK
Thanks Benoit,

Changed the delay location. Sometimes it works, sometimes not.

If you click BEGIN with nothing in input box, it crashes out.

If you put a name in, sometimes it works, sometimes it doesn't.

Very flaky and I cannot use it as it is.

!!

John


For this message JMahoney has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject:
PostPosted: February 2nd, 2005, 11:06 pm 
Offline

Joined: October 25th, 2004, 12:27 pm
Posts: 526
Location: Digital Workshop
Hi,

Thank you for your enquiry.

It is not recommended to mix script actions and standard actions in this fashion, especially when time-sensitive file actions are involved. What appears to be happening in this case is that the script actions are being processed at the same time as the Close File action, Windows thinks the Opus editor is acting in an unusual fashion and the Opus.exe process is being forcibly closed to prevent any damage to the file in question.

I have tested this publication in the latest internal build of Opus, and the problem appears to have been resolved. This will therefore be fixed in the next Service Release.

In the meantime, I would recommend replacing the Read from disk file and Close File actions with their script equivalents. In other words, your Begin button should trigger the following script actions:

Code:
if (USERNAME == "") {
//Warning_Text.Show ()
//wait (3)
//Warning_Text.Hide ()
} else {
text = OpenFile(USERNAME + ".txt")
USERPAGENAME = text.Read(false)
text.Close()
USERNAME = BOOKNAME + CLASSNAME + USERNAME
if (USERPAGENAME == "") {
GotoPage("Para_1")
} else {
GotoPage(USERPAGENAME)
}
}


I have attached a modified version of your publication which should work as required.

Kind regards,


You do not have the required permissions to view the files attached to this post.

_________________
Robin Garrett
Digital Workshop Technical Support


For this message Robin Garrett has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject:
PostPosted: February 3rd, 2005, 12:01 am 
Offline

Joined: November 3rd, 2004, 4:52 pm
Posts: 99
Location: Worcester. UK
Thanks Robin.

This works - but!

When hitting the app's Exit button at page named Para_2, on restarting the app it always goes to page Para_1 when it should have gone to page Para_2.

Also, when I exit from test mode by hitting Escape, and then try F5 to test again, F5 does nothing at all, and the tool bar, but not the menu bar is greyed out. I exit Opus and reboot it - then I can F5 to test, but it will lock up again once I hit Escape.

Isn't it always the way - kill one serpent and another two pop up their ugly mugs!

Very many thanks for your help - so late at night.

Think I'll hit the sack - wife is nagging!!!!

and return to this in the morning. :lol:

John


For this message JMahoney has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject:
PostPosted: February 3rd, 2005, 1:00 am 
Offline

Joined: October 25th, 2004, 12:27 pm
Posts: 526
Location: Digital Workshop
Hi,

Please find attached another modified version of the publication which should hopefully resolve the problems you encountered. As you will see, I have replaced the actions on the Exit button with script actions.

I have removed some actions from the file which I did not fully understand. For example:

Code:
USERNAME = BOOKNAME + CLASSNAME + USERNAME


Are you sure that you want the USERNAME variable to include the BOOKNAME and CLASSNAME strings? You are using the same USERNAME variable to determine the name of the file to which the page number should be written, so surely this would result in two text files being created? For example, one named ROBIN.txt and the other named CTABCROBIN.TXT.

Hopefully, the publication should now operate in the way you require and it should not be too much trouble for you to restore any missing functionality.

Kind regards,


You do not have the required permissions to view the files attached to this post.

_________________
Robin Garrett
Digital Workshop Technical Support


For this message Robin Garrett has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject:
PostPosted: February 3rd, 2005, 10:01 am 
Offline

Joined: November 3rd, 2004, 4:52 pm
Posts: 99
Location: Worcester. UK
Thanks Robin,

That works fine - however! :lol:

When I trialled this app at a local school, they pointed out the following problem.

There are twelve different apps, that could be in use with two or three different year groups with maybe two classes in each year group. Within each class there might be two or more children with the same first name.

All <usernames> will be saved to the same area on the hard drive <system_publication_dir>. It would quickly become confusing as to which student was picking up which file unless this was regularised. Hence I've added a <bookname> two letter code for each book/app. There is also a <classname> to filter it further, and then the child's name <username>.

The final <username> being, <username> + <bookname> + <classname>, in which is held the <userpagename> at which the book/app was exited.

Of course, if the class teacher doesn't get his/her act together there could still be cases of files being overwritten for children with the same name. But there is a limit as to how far we can intervene.

I had thought that would be achieved by adding <username> = <username> + <bookname> + <classname> into the 'Begin_Text' script and the same username would be picked up in the exit code?

John


For this message JMahoney has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject:
PostPosted: February 3rd, 2005, 11:38 am 
Offline

Joined: October 25th, 2004, 12:27 pm
Posts: 526
Location: Digital Workshop
Hi,

Thank you for your reply.

If you want to restore the longer filename to help differentiate between pupils, classnames and applications, simply edit the code on the Begin button to read as follows:

Code:
if (USERNAME == "") {
//Warning_Text.Show ()
//wait (3)
//Warning_Text.Hide ()
} else {
USERNAME = BOOKNAME + CLASSNAME + USERNAME
text = OpenFile(USERNAME + ".txt")
USERPAGENAME = text.Read(false)
text.Close()
if (USERPAGENAME == "") {
GotoPage("Para_1")
} else {
GotoPage(USERPAGENAME)
}
}


The publication should now create, read from and write to a text file which includes the BOOKNAME, CLASSNAME and USERNAME in the filename.

Looking back at your original publication, it looks as though users who did not enter a username were permitted to enter the main part of the publication but without bookmarking. The modified publication included with my previous reply does not contain this functionality, so you may need to restore this.

Kind regards,

_________________
Robin Garrett
Digital Workshop Technical Support


For this message Robin Garrett has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject:
PostPosted: February 3rd, 2005, 3:42 pm 
Offline

Joined: November 3rd, 2004, 4:52 pm
Posts: 99
Location: Worcester. UK
Hi Robin,

Very many thanks for all your help.

App now works fine.

Best wishes,

John


For this message JMahoney has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject: Unwanted EXIT - problem
PostPosted: February 6th, 2005, 11:52 pm 
Offline

Joined: November 3rd, 2004, 4:52 pm
Posts: 99
Location: Worcester. UK
Hi,

When exiting and saving the username.txt it ends up on the desktop! It should be sent to system_publication_dir - which is in c:\program files\kern\ which is where the app is.

Further testing shows that if I boot up the app from within the program files directory, it saves the username.txt files there correctly - picks up the userpagename variable corrctly on next use, and deletes them when the final exit page from the program is found by the user.

When booting from the Icon on the desktop - it saves the username files to the desktop. Not quite what I wanted! Anyone have the solution?

The code used is per Robin's latest post on this topic.

John


For this message JMahoney has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject:
PostPosted: February 8th, 2005, 5:23 am 
Offline

Joined: October 26th, 2004, 1:26 pm
Posts: 262
<< When booting from the Icon on the desktop - it saves the username files to the desktop. Not quite what I wanted! Anyone have the solution? >>

Hi John,

I think you need to prefix the USERNAME path with... e.g.

text = OpenFile(SYSTEM_PUBLICATION_DIR + USERNAME + ".txt")

// you'll need to do it for the writing of the file too //


I'm sure Robin will clarify more on this. :)

_________________
Cheers,
Steve


For this message Steve H has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: February 8th, 2005, 9:57 pm 
Offline

Joined: November 3rd, 2004, 4:52 pm
Posts: 99
Location: Worcester. UK
Thanks Steve,

Tried that - didn't work. More particularly, after I had entered the classname and username and clicked on the Begin button, the app just hung. Had to ctrl alt del to do anything.

John


For this message JMahoney has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject:
PostPosted: February 9th, 2005, 2:32 pm 
Offline

Joined: October 25th, 2004, 12:27 pm
Posts: 526
Location: Digital Workshop
Try changing the code on the 'Begin' button to the following:

Code:
if (USERNAME == "") {
//Warning_Text.Show ()
//wait (3)
//Warning_Text.Hide ()
} else {
USERNAME = BOOKNAME + CLASSNAME + USERNAME
text = OpenFile(SYSTEM_PUBLICATION_DIR + "\\" + USERNAME + ".txt")
USERPAGENAME = text.Read(false)
text.Close()
if (USERPAGENAME == "") {
GotoPage("Para_1")
} else {
GotoPage(USERPAGENAME)
}
}


Then change the code on the Exit button (in the Master page) to read the following:

Code:
text = OpenFile(SYSTEM_PUBLICATION_DIR + "\\" + USERNAME + ".txt",true)
text.Write(USERPAGENAME)
text.Close()
ExitPublication()


You should now be able to publish and distribute the project and the installed application should create the text file in the appropriate Program Files directory.

I hope this helps. Please do not hesitate to contact me if you have any further queries.

Kind regards,

_________________
Robin Garrett
Digital Workshop Technical Support


For this message Robin Garrett has been thanked by : mackavi


Top
 Profile Visit website  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 16 posts ]  Go to page 1, 2  Next

All times are UTC [ DST ]


Who is online

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