The npDesk plugin for NeoBook allows you to display a nice window on your screen at any location you choose. The window is fully customizable as to color, font, size, display duration and more.
NeoBook RAD5
I want to be able to read a file, locate specific text within that file (##TEXT##) and put text (<OPTION value="August 19, 2006.html">August 19, 2006</option>) above the text I found.
Example:
<SELECT name="guidelinks">
<OPTION value="August 17, 2006.html">August 17, 2006</option>
<OPTION value="August 18, 2006.html">August 18, 2006</option>
##TEXT## <– search for this
</SELECT>
I want to insert text above the ##TEXT## so it will look like this:
<SELECT name="guidelinks">
<OPTION value="August 17, 2006.html">August 17, 2006</option>
<OPTION value="August 18, 2006.html">August 18, 2006</option>
<OPTION value="August 19, 2006.html">August 19, 2006</option>
##TEXT##
</SELECT>
Code:
SetVar "[Tag]" "##TEXT##"
SetVar "[Root]" "August 19, 2006"
SetVar "[NewText]" "<OPTION value=[#34][Root].html[#34]>[Root]</option>"
SetVar "[NL]" "[#13][#10]"
FileRead "myFile.htm" "All" "[BeforeText]"
StrReplace "[BeforeText]" "[Tag]" "[NewText][NL][Tag]" "[AfterText]"
FileWrite "myFile.htm" "All" "[AfterText]"
———————————————
What is Neobook?
Without ANY programming knowledge, you too can create and compile great full featured Windows Software, presentations, e-books, e-zines, catalogs and much more!
Simply put, it is a programming environment that allows you to create, compile and distribute royalty free applications of any kind. From beginners to advanced programmers, NeoBook RAD5 Pro has something for everybody. Try it free!
Create a button with this code:
SetVar "[Interval]" "2500"
TimerStart "Timer1" "[Interval]"
and create a one-shot timer with this code:
Alertbox "Timer" "Interval = [Interval]"
Math "[Interval]/2" "0" "[Interval]"
If "[Interval]" "<" "100"
SetVar "[Interval]" "5000"
Endif
TimerStart "[self]" "[Interval]"
Note: A "one-shot" timer has the "Start timer after one execution" box checked on the timer’s General page.
Run the pub and click the button. Observe that the alert box appears at shorter and shorter intervals.
———————————————
What is Neobook?
Without ANY programming knowledge, you too can create and compile great full featured Windows Software, presentations, e-books, e-zines, catalogs and much more!
Simply put, it is a programming environment that allows you to create, compile and distribute royalty free applications of any kind. From beginners to advanced programmers, NeoBook RAD5 Pro has something for everybody. Try it free!
Contributed by Sam Cox.
It is important to know that files themselves are never “dropped” onto Neobook or any other application. Filenames, yes, but not the actual files. All applications that accept dropped files receive the path/name of the file and then do loads of processing including a) verifying that the path/name exist, b) that the path/name make sense to the program (e.g., correct file extension), c) checking file permissions, d) passing the path/name to a subroutine or plug-in or external program to manipulate the data in the file.
There are two ways to drop file names onto NB5 pubs:
1) Drop one or more path/names onto the pub’s EXE file in Explorer or a Desktop icon in which case Windows runs the pub and presents the filenames to the pub on the command line. You can access the filenames via NB’s [CommandLine] variable with [#13] delimiters.
2) Drop one or more path/names onto a running pub’s TextEntry object in which case the filenames are available via the object’s variable. The pub can be “notified” of the arrival of the filenames by way of code in the Text Changed section.
In either case, the pub gets the fully qualified filenames which it must process. The processing might involve looking at the filename’s extension and calling an appropriate external program, an internal NB command, or a plug-in’s command to process the file.
This sample consists of a single TextEntry object with variable [TextEntry1] and this code in Text Changed:
Code:
.disable to prevent drops while processing
.change color to indicate disabled
DisableObject “[self]”
SetObjectFill “[self]” “Red” “Solid” “False”
.copy then clear input variable for cosmetic reasons
SetVar “[Incoming]” “[TextEntry1]”
SetVar “[TextEntry1]” “”
Gosub “ParseIncoming”
Gosub “Dispatch”
.done processing so allow more drops
.change color back to indicate enabled
SetObjectFill “[self]” “Silver” “Solid” “False”
EnableObject “[self]”
In BOOK PROPERTIES ACTIONS SUBROUTINES:
Code:
arseIncoming
StrParse “[Incoming]” “[#13][#10]” “[Filename]” “[Count]”
Return
ispatch
Loop “1″ “[Count]” “[n]”
ExtractFileExt “[Filename[n]]” “[Extension]”
.MODIFY THE FOLLOWING LINE AS REQ’D
SearchStr “|[Extension]|” “|.txt|.zip|.exe|.bob|” “[pos]”
If “[pos]” “>” “0″
SetVar “[Filename]” “[Filename[n]]”
Gosub “Do[Extension]”
Else
Alertbox “EEK” “Can’t handle file|[Filename[n]]”
Endif
EndLoop
Return
o.TXT
Alertbox “PROCESSING” “Processing TXT file|[Filename]”
Return
o.ZIP
Alertbox “PROCESSING” “Processing ZIP file|[Filename]”
Return
o.EXE
Alertbox “PROCESSING” “Processing EXE file|[Filename]”
Return
o.BOB
Alertbox “PROCESSING” “Processing BOB file|[Filename]”
Return
Modify the “Do” subroutines to suit your needs, and edit the indicated line in the “Dispatch” subroutine.
Run the pub and drop one or several files at once on the TextEntry box. Watch the Alertboxes (one for each file dropped) appear in sequence.
The key to this working smoothly is that the drop object’s Text Changed code is called just once when file names are delivered. If, on the other hand, you were to type into the object, the Text Change code is called once for each character typed! When dropping or pasting text into a TextEntry object, the Text Changed code is triggered just once.
———————————————
What is Neobook?
Without ANY programming knowledge, you too can create and compile great full featured Windows Software, presentations, e-books, e-zines, catalogs and much more!
Simply put, it is a programming environment that allows you to create, compile and distribute royalty free applications of any kind. From beginners to advanced programmers, NeoBook RAD5 Pro has something for everybody. Try it free!
Contributed by Sam Cox.
Create a ListBox object named ListBox1. Make sure it’s variable is also called [ListBox1]. The list box must be sorted for the following to work, so execute ListBoxSort "ListBox1" before using the following.
Create a TextEntry object named TextEntry1. Make sure it’s variable is also called [TextEntry1].
Add the following code to the Text Change action of the TextEntry1 object:
Code:
Suspend "True"
ListBoxSize "ListBox1" "[ListBox1Size]"
StrLower "[TextEntry1]" "[TextEntry1LowerCase]"
Loop "1" "[ListBox1Size]" "[N]"
ListBoxGetItem "ListBox1" "[N]" "[Item]"
StrLower "[Item]" "[ItemLowerCase]"
SearchStr "[TextEntry1LowerCase]" "[ItemLowerCase]" "[Index]"
If "[Index]" "=" "1"
SetVar "[ListBox1]" "[Item]"
Gotoline "Found"
Endif
EndLoop
:Found
Suspend "False"
Run the code. Everytime you type a letter or, for that matter, any character including a backspace, the current value of [TextEntry1] is searched for in the ListBox1 object. If [TextEntry1] is found as the leading characters of any entry in ListBox1, that entry is displayed (highlighted) and you’re ready to type the next character.
Notes:
1) The Suspend "True" and Suspend "False" actions allow the code to finish searching before another letter is typed.
2) I coded this directly in the Text Change action of TextEntry1 to run as fast as possible. It could have been written as a subroutine but would suffer a little from the overhead of calling that subroutine.
3) If while your program is running you add an entry to ListBox1, you must resort the list box.
———————————————
What is Neobook?
Without ANY programming knowledge, you too can create and compile great full featured Windows Software, presentations, e-books, e-zines, catalogs and much more!
Simply put, it is a programming environment that allows you to create, compile and distribute royalty free applications of any kind. From beginners to advanced programmers, NeoBook RAD5 Pro has something for everybody. Try it free!
Contributed by Sam Cox.
This tip shows how to determine the browser application associated with "http" addresses and store it in the [value] variable:
Code:
SetVar "[Hive]" "HKEY_CLASSES_ROOT"
SetVar "[Key]" "http\shell\open\ddeexec\Application\"
RegistryRead "[Hive]" "[Key]" "[Value]"
Tested on Windows XP, Windows7 32/64bit.
———————————————
What is Neobook?
Without ANY programming knowledge, you too can create and compile great full featured Windows Software, presentations, e-books, e-zines, catalogs and much more!
Simply put, it is a programming environment that allows you to create, compile and distribute royalty free applications of any kind. From beginners to advanced programmers, NeoBook RAD5 Pro has something for everybody. Try it free!
Contributed by Sam Cox:
Here is a NeoBook ATAN2 subroutine based on a definition found via Google.
Contributed by Sam Cox:
If you have lots of variables to clear, you can use this subroutine:
SUBROUTINE CODE
:ClearVars
StrParse "[Args]" "," "[Arg]" "[Argc]"
Loop "1" "[Argc]" "[Arg0]"
SetVar "[[Arg[Arg0]]]" ""
EndLoop
Return
which is used like this:
CODE
SetVar "[Args]" "Firstname,Lastname,Street,City,Country,Zip,Product,Qty"
Gosub "ClearVars"
where Firstname, Lastname, Street, etc. are the name of the variables you want to clear.
The effect of calling this subroutine is equivalent to writing:
SetVar "[Firstname]" ""
SetVar "[Lastname]" ""
SetVar "[Street]" ""
etc.
This subroutine does not add any spectacular features to your program, but it may result in briefer and more readable code.
———————————————
What is Neobook?
Without ANY programming knowledge, you too can create and compile great full featured Windows Software, presentations, e-books, e-zines, catalogs and much more!
Simply put, it is a programming environment that allows you to create, compile and distribute royalty free applications of any kind. From beginners to advanced programmers, NeoBook RAD5 Pro has something for everybody. Try it free!
Contributed by Sam Cox:
Sometimes when using special characters in NeoBook, looking at all those hash marks (#) or little ASCII characters (such as a period) can drive you nuts. As suggested by Gaev in the NeoBook Forum, you can assign names (and therefore meaning) to all of those characters and, by doing so, make your code easier to read.
Contributed by Sam Cox:
You don’t actually need an external ASCII editor to edit an object’s source code.