Source language: Translate to:

ClearVariables problem ?

Questions about using NeoBook's scripting language

Moderator: Neosoft Support

ClearVariables problem ?

Postby UltraVox » Wed Jul 23, 2014 5:29 am

Hello everyone,

Someone could use the command (ClearVariables "") in the "Project -> Project Property -> Actions -> Stop", please ?

Is it working ? For me, it does not work.
The application is still open and bugged.

I tried with a new NeoBook application, completely empty, and it does not work.
I just want to clear all NB variables before leaving the application.

Thank you for your help.
UltraVox
 
Posts: 419
Joined: Sat Jul 28, 2007 11:14 am
Location: France

Re: ClearVariables problem ?

Postby dpayer » Wed Jul 23, 2014 7:43 am

UltraVox wrote:Hello everyone,

Someone could use the command (ClearVariables "") in the "Project -> Project Property -> Actions -> Stop", please ?

Is it working ? For me, it does not work.
The application is still open and bugged.

I tried with a new NeoBook application, completely empty, and it does not work.
I just want to clear all NB variables before leaving the application.

Thank you for your help.


I have a demo app that shows the ClearVariables works but it creates a different problem - app doesn't shut down. It could be I misused the command.

I put actions in the shutdown section of the app "Book - > Book Properties -> Actions -> Shutdown"

Then I set my vars and test then clear the vars and test. This works.
But the app doesn't shut down. If you attempt to click the X in the upper right, it goes through the shutdown process again and remains open. You can only get rid of it by ending the task in the Task Manager.

Here is my sample app: Copy this code into a new/empty 800x600 book (project) and test.
Code: Select all
{NeoBook 5 Objects}
NeoBookVer=5.80
ObjectType=5
Name=Rectangle2
X=356
Y=61
W=262
H=211
Anchor=0
LineColor=0
LineWidth=1
LineStyle=0
FillColor=16316488
FillPattern=0
TabOrder=6
ObjectType=5
Name=Rectangle1
X=23
Y=61
W=262
H=211
Anchor=0
LineColor=0
LineWidth=1
LineStyle=0
FillColor=8442104
FillPattern=0
TabOrder=5
ObjectType=3
Name=PushButton1
X=51
Y=92
W=191
H=49
Anchor=0
Text=Set Vars & Test Clear
Align=2
ImageStyle=0
ObjAction=SetVar "[test1]" "1"¶SetVar "[test2]" "2"¶SetVar "[test3]" "3"¶SetVar "[test4]" "4"¶SetVar "[test5]" "5"¶SetVar "[test6]" "6"¶SetVar "[test7]" "7"¶SetVar "[test8]" "8"¶SetVar "[test9]" "9"¶Loop "1" "9" "[Will]"¶Alertbox "test variables" "Test[will] = [test[will]]"¶EndLoop¶ClearVariables ""¶Alertbox "ClearVariables" "ClearVariables command done|variables should be empty"¶Loop "1" "9" "[Will]"¶Alertbox "test variables" "Test[will] = [test[will]]"¶EndLoop
LineColor=0
LineWidth=1
LineStyle=0
FillColor=12632256
FillPattern=0
Font=Arial
FontSize=10
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=2
ObjectType=3
Name=PushButton2
X=388
Y=87
W=209
H=54
Anchor=0
Text=SetVars Only
Align=2
ImageStyle=0
ObjAction=SetVar "[test1]" "1"¶SetVar "[test2]" "2"¶SetVar "[test3]" "3"¶SetVar "[test4]" "4"¶SetVar "[test5]" "5"¶SetVar "[test6]" "6"¶SetVar "[test7]" "7"¶SetVar "[test8]" "8"¶SetVar "[test9]" "9"¶AlertBox "Test" "Variables set"
LineColor=0
LineWidth=1
LineStyle=0
FillColor=12632256
FillPattern=0
Font=Arial
FontSize=10
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=3
ObjectType=3
Name=PushButton4
X=389
Y=162
W=209
H=54
Anchor=0
Text=Shutdown
Align=2
ImageStyle=0
ObjAction=Exit "Exit app" "App Shutting down"
LineColor=0
LineWidth=1
LineStyle=0
FillColor=12632256
FillPattern=0
Font=Arial
FontSize=10
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=4


David P.
David Payer
Des Moines, Iowa
USA
User avatar
dpayer
 
Posts: 1380
Joined: Mon Apr 11, 2005 5:55 am
Location: Iowa - USA

Re: ClearVariables problem ?

Postby UltraVox » Wed Jul 23, 2014 7:56 am

I have the same problem. The application never closes. (MyApp does not answer)

Weird and freakish...
UltraVox
 
Posts: 419
Joined: Sat Jul 28, 2007 11:14 am
Location: France

Re: ClearVariables problem ?

Postby dec » Wed Jul 23, 2014 9:46 am

Hello,

The help about the "Shutdown" actions tell us that the global variable "[ShutdownStatus]" can be set to "False" to abort the publication shutdown. Well. When we use the "ClearVariables" action into the "Shutdown" section we are clear also such variable, in other words, the variable is not "True" anymore.

Then, if we plain to use the "ClearVariables" action without arguments (in order to delete all variables) into the "Shutdown" section, we need to set the "[ShutdownStatus]" variable again, just like this:

Code: Select all
ClearVariables ""
SetVar "[ShutdownStatus]" "True"


Now all the variables are clear and since the "[ShutdownStatus]" variable is "True" our publication shutdown like expected.
.
Enhance your NeoBook applications!
.
57 plugins, 1113 actions and 230 samples
.
NeoPlugins website: www.neoplugins.com
.
User avatar
dec
 
Posts: 1663
Joined: Wed Nov 16, 2005 12:48 am
Location: Spain

Re: ClearVariables problem ?

Postby Neosoft Support » Wed Jul 23, 2014 9:56 am

Nice bit of detective work David!
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5593
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Re: ClearVariables problem ?

Postby dec » Wed Jul 23, 2014 10:03 am

Hello,

Neosoft Support wrote:Nice bit of detective work David!


Thank you! ;)
.
Enhance your NeoBook applications!
.
57 plugins, 1113 actions and 230 samples
.
NeoPlugins website: www.neoplugins.com
.
User avatar
dec
 
Posts: 1663
Joined: Wed Nov 16, 2005 12:48 am
Location: Spain

Re: ClearVariables problem ?

Postby dpayer » Wed Jul 23, 2014 10:46 am

Neosoft Support wrote:Nice bit of detective work David!



I venture that 95% + of us assumed the ClearVariables only applied to AuthorDefined variables. In fact, many global variables are set as 'Read Only', you can't change them, so a presumption is that you can't clear them.

For knowledge's sake, is there a way to get a list of Author Defined variables using NB action commands? This way if it were desired to reset all Author Defined variables, it could be done with the ClearVariables "[var1],[var2],[var3].......etc" command.

D
David Payer
Des Moines, Iowa
USA
User avatar
dpayer
 
Posts: 1380
Joined: Mon Apr 11, 2005 5:55 am
Location: Iowa - USA

Re: ClearVariables problem ?

Postby UltraVox » Wed Jul 23, 2014 12:26 pm

Thank you very much David ! Good thinking :roll:

And thank you all for your help. :)
UltraVox
 
Posts: 419
Joined: Sat Jul 28, 2007 11:14 am
Location: France

Re: ClearVariables problem ?

Postby Cipolla » Thu Jul 24, 2014 1:18 am

What could be a reason to clear variables when shutting an app down? For my understanding... closing the app = loosing all variables an their contents... :?
Greetings from Germany
Klaus
User avatar
Cipolla
 
Posts: 166
Joined: Fri Apr 01, 2005 1:45 am
Location: Germany

Re: ClearVariables problem ?

Postby dec » Thu Jul 24, 2014 2:54 am

Hello,

UltraVox wrote:Thank you very much David !


You're welcome! Happy birthday UltraVox! ;)
.
Enhance your NeoBook applications!
.
57 plugins, 1113 actions and 230 samples
.
NeoPlugins website: www.neoplugins.com
.
User avatar
dec
 
Posts: 1663
Joined: Wed Nov 16, 2005 12:48 am
Location: Spain

Re: ClearVariables problem ?

Postby UltraVox » Thu Jul 24, 2014 6:27 am

Thank you David ;)
UltraVox
 
Posts: 419
Joined: Sat Jul 28, 2007 11:14 am
Location: France

Re: ClearVariables problem ?

Postby UltraVox » Thu Jul 24, 2014 6:33 am

Hello,
Cipolla wrote:What could be a reason to clear variables when shutting an app down? For my understanding... closing the app = loosing all variables an their contents... :?


Nothing like this is mentioned in the NeoBook documentation. You lose the application, but there is no indication that there is not a trace in Ram memory. Virtually all Windows applications always leave traces. Also NeoBook. But hey it was not very important. I was especially intrigued by the fact that it does not work, but David responded well ;)
UltraVox
 
Posts: 419
Joined: Sat Jul 28, 2007 11:14 am
Location: France

Re: ClearVariables problem ?

Postby Neosoft Support » Thu Jul 24, 2014 11:42 am

Closing the app will free all of the memory used by the program including all variables. There is no need to call DeleteVariables before closing an app. Windows may leave fragments of data in deallocated memory, but it will eventually be overwritten by the OS or another program. Of course, turning the computer off will completely clear anything left in RAM.
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5593
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Re: ClearVariables problem ?

Postby UltraVox » Fri Jul 25, 2014 4:48 am

Hi Dave,

Please, is it possible to use SetVar (or other method) to change/modify the values ​​of "Image Properties" -> "Appearance" ?

Thank you.
UltraVox
 
Posts: 419
Joined: Sat Jul 28, 2007 11:14 am
Location: France

Re: ClearVariables problem ?

Postby Neosoft Support » Mon Jul 28, 2014 10:50 am

No that's not currently possible. The only property you can change programmatically is the magnification level with the PictureMagnify action.
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5593
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA


Return to NeoBook Action Commands

Who is online

Users browsing this forum: No registered users and 2 guests