Source language: Translate to:

nputil question

Questions about NeoBook PlugIns

Moderator: Neosoft Support

nputil question

Postby cp4w » Tue Aug 16, 2011 10:25 am

npClearVariables

is it posible to have this action work on a mask, If I wanted to clear all variables with a prefix of tmp_ , i would say npClearVariables tmp_*
cp4w
 
Posts: 533
Joined: Sun Apr 03, 2005 4:37 pm
Location: Great Neck, NY

Postby dec » Tue Aug 16, 2011 11:51 am

Hi shx,

I also think on an option like this too when put the action on the plugin, however, I stop when I said myself: "Ok, but how to obtain the variables from NeoBook?".

In fact, I dont know how (and maybe its possible, but I dont know at this time) to retrieve the defined publication variables. A plugin can set and get variables, and play with it in actions like "npClearVariables" or "npSetVar", because a plugin also can execute NeoBook actions.

However, I dont know how to get all the publication variables, so we can iterate over the list and clear it if the variables has certain prefix, suffix, word... etc. Sorry about that, but this is what I can say at this time shx.

P.S. Do you love "npClearVariables" hum? Try "npSetVar" and you loving it too! :)
.
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

Postby cp4w » Tue Aug 16, 2011 12:33 pm

hello david

SaveVariables and LoadVariables will do what you ask, but within neobook, it uses files.

I do love npsetvar, really very useful.

I don't see what npclearvariables gives you more tham what is currently in neobooks clearvariables command
cp4w
 
Posts: 533
Joined: Sun Apr 03, 2005 4:37 pm
Location: Great Neck, NY

Postby dec » Tue Aug 16, 2011 2:17 pm

Hi there!

hello david

SaveVariables and LoadVariables will do what you ask, but within neobook, it uses files.


Hum... can be a possibility, thanks for the idea. The only thing is that an access to disk is involved, and maybe this not compensate. I dont know. If you considerer that can be useful I will try it.


I do love npsetvar, really very useful.

I don't see what npclearvariables gives you more tham what is currently in neobooks clearvariables command


Well, the help said in my poor english, of course. I will try to explain. Oh yes. In the first place, this variable allow you to pass some "dirty arguments."

For example, if you use "ClearVariables" something like this:

Code: Select all
ClearVariables "a, b, c,d "


You dont get the desired results, because some space characters in the action argument. Try it and see it yourself. For the other hand. "npClearVariables" allow this kind or arguments. And you can also separate by "|" the variables identifiers, plus than ",".

For the other hand too "npClearVariables" can clear "defined variables". If you see the NeoBook help file around the "DefineVar" action you can read this:

In order to delete a variable created with DefineVar, you must first re-declare the variable as “Undefined”, then clear it with SetVar. For example:

Code: Select all
DefineVar "[Birthdate]" "Undefined" "" "Global" ""
SetVar "[Birthdate]" ""



Well, "npClearVariables" do it for you, so you can clear the defined variable "[Birthdate]" using "npClearVariables", just:

npClearVariables "[Birthdate]"


Just like other "normal" variables, even when "[Birthdate]" is a defined variable. I hope you understand now why "npClearVariables" can help you. Well, if can help you. :)

P.S. Dont forget to tell me if you think that compensate to add "prefix" and "suffix" options to "npClearVariables", using "SaveVariables" and "LoadVariables" to do it. Thanks!
.
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

Postby cp4w » Tue Aug 16, 2011 2:28 pm

david,

thanks for the explanation of npClearVariables.

As far as defining a prefix and suffix - some sort of a mask, that function would really be great. I just don't know if you could do it in a way to either avoid disk access or that it should not be slow.

Thanks
Steven
cp4w
 
Posts: 533
Joined: Sun Apr 03, 2005 4:37 pm
Location: Great Neck, NY

Postby dec » Tue Aug 16, 2011 3:15 pm

Hi,

I dont try (because I working on other thing) but think that the "save/open/close/delete" file operation cannot take much time. In other words: can be compensate. However another thing appear here: If I need to write a file with a publication variables, then read the file and then delete the file... if something wrong happend and I cannot delete the file for every reason (put your imagination here) a file with the publication variables can still on disk and this can be considerer a "risk".

So I dont know what to do... Of course, in normal situations we can write, read and delete the file without problems, but... is imposible to guarantee that no problem occur sometime in some situation. Who can guarantee something like this? So the "performance" problem really is not a probem, becase I taking about "milliseconds" I thing. But the risk of a file containing the variables of a publication stop me for a momment. Maybe I can found another way... just give me sometime. But, in any case, what do you thing shx?
.
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

Postby cp4w » Tue Aug 16, 2011 3:26 pm

I don't know your schedule and I understand that this functionality has complications and you are not sure that it would be worth your while.
I personally would find it useful.

Steven
cp4w
 
Posts: 533
Joined: Sun Apr 03, 2005 4:37 pm
Location: Great Neck, NY

Postby dec » Tue Aug 16, 2011 4:18 pm

Hi,

Ok. I now working integrate the plugins help files into Neobook (thanks to say how to do NeoSoftware!) and then, probably, I think on this question. :)
.
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

Postby dec » Tue Aug 16, 2011 7:29 pm

Hi!

Finally you can now clear variables using some "prefix", followed by an "*" (asterisk). So you can write now something like this:

Code: Select all
npClearVariables "temporal_*"


... in order to clear all variables that beginning with "temporal_". It is possible to clear various prefixed variables too, and mix real identifiers, for example:

Code: Select all
npClearVariables "temporal_*, another, data_*"


... in order to clear "temporal_" prefixed variables, "another" variable, and "data_" prefixed variables.

Only one thing more: the "*" is allowed to be used in NeoBook variables identifiers. Ok, it a bit rare that someone use asteriks in their variables names, but it is possible. So, if you use asteriks in your variables names take caution when use "npClearVariables".

For the other hand, even when my solution pass to use the "SaveVariables" NeoBook action (LoadVariables is not neccesary) here is how I procced:

1º If the identifiers used by npClearVariables dont contain "*", just not save the variables because is not neccesary.

2º In other case, I save the variables to a temporal file (with an unique GUID -Global Unique Identifier- based temporal name, without extension), then load it, and just after delete it.

3º I continue the work with the saved variables in memory and the temporal file has been deleted. But for precaution (really not appear to be needed, because if you see like me the temporal directory you cannot see the saved temporal file: because the "save/load/delete" operation take milliseconds), I said that for precaution, I try to delete again the file if remain exists then finish the work.

And its all. I think is a good think having this option, and the "risk" that I see before... well, I think that is very difficult that the "save/load/operation" fail... in the millisecond(s) that take to finish. Is my opinion, of course. You decide now!

P.S. Hey! I finally integrate into NeoBook my NeoPlugins help files! ;)
.
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


Return to PlugIn Discussions

Who is online

Users browsing this forum: No registered users and 4 guests

cron