Page 1 of 1

ClearVariables problem ?

PostPosted: Wed Jul 23, 2014 5:29 am
by UltraVox
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.

Re: ClearVariables problem ?

PostPosted: Wed Jul 23, 2014 7:43 am
by dpayer
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.

Re: ClearVariables problem ?

PostPosted: Wed Jul 23, 2014 7:56 am
by UltraVox
I have the same problem. The application never closes. (MyApp does not answer)

Weird and freakish...

Re: ClearVariables problem ?

PostPosted: Wed Jul 23, 2014 9:46 am
by dec
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.

Re: ClearVariables problem ?

PostPosted: Wed Jul 23, 2014 9:56 am
by Neosoft Support
Nice bit of detective work David!

Re: ClearVariables problem ?

PostPosted: Wed Jul 23, 2014 10:03 am
by dec
Hello,

Neosoft Support wrote:Nice bit of detective work David!


Thank you! ;)

Re: ClearVariables problem ?

PostPosted: Wed Jul 23, 2014 10:46 am
by dpayer
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

Re: ClearVariables problem ?

PostPosted: Wed Jul 23, 2014 12:26 pm
by UltraVox
Thank you very much David ! Good thinking :roll:

And thank you all for your help. :)

Re: ClearVariables problem ?

PostPosted: Thu Jul 24, 2014 1:18 am
by Cipolla
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... :?

Re: ClearVariables problem ?

PostPosted: Thu Jul 24, 2014 2:54 am
by dec
Hello,

UltraVox wrote:Thank you very much David !


You're welcome! Happy birthday UltraVox! ;)

Re: ClearVariables problem ?

PostPosted: Thu Jul 24, 2014 6:27 am
by UltraVox
Thank you David ;)

Re: ClearVariables problem ?

PostPosted: Thu Jul 24, 2014 6:33 am
by UltraVox
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 ;)

Re: ClearVariables problem ?

PostPosted: Thu Jul 24, 2014 11:42 am
by Neosoft Support
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.

Re: ClearVariables problem ?

PostPosted: Fri Jul 25, 2014 4:48 am
by UltraVox
Hi Dave,

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

Thank you.

Re: ClearVariables problem ?

PostPosted: Mon Jul 28, 2014 10:50 am
by Neosoft Support
No that's not currently possible. The only property you can change programmatically is the magnification level with the PictureMagnify action.