<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/">
	<channel>
		<title><![CDATA[yab | yet another Basic for HAIKU - yab stuff]]></title>
		<link>https://yab.orgfree.com/forum/</link>
		<description><![CDATA[yab | yet another Basic for HAIKU - https://yab.orgfree.com/forum]]></description>
		<pubDate>Sat, 16 May 2026 23:11:48 +0000</pubDate>
		<generator>MyBB</generator>
		<item>
			<title><![CDATA[Undocumented yab functions]]></title>
			<link>https://yab.orgfree.com/forum/showthread.php?tid=171</link>
			<pubDate>Wed, 28 Aug 2024 19:23:00 +0300</pubDate>
			<dc:creator><![CDATA[<a href="https://yab.orgfree.com/forum/member.php?action=profile&uid=2">clasqm</a>]]></dc:creator>
			<guid isPermaLink="false">https://yab.orgfree.com/forum/showthread.php?tid=171</guid>
			<description><![CDATA[I recently came across some yab functions that seem to have escaped from the documentation.<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>a = pcworkspaces<br />
<br />
a- window get "MainWindow", "workspace"</code></div></div><br />
These appear in neither the yab commands textfile nor in the Besly app. I just had a feeling that they had to exist, so I, ummmm, ripped apart an existing app to extract its code and see how it was done. Sorry, lorglas, I think it was one of yours.<br />
<br />
In fact, looking at the list of reserved keywords there may be a few more undocumented commands. roundrect, anyone?]]></description>
			<content:encoded><![CDATA[I recently came across some yab functions that seem to have escaped from the documentation.<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>a = pcworkspaces<br />
<br />
a- window get "MainWindow", "workspace"</code></div></div><br />
These appear in neither the yab commands textfile nor in the Besly app. I just had a feeling that they had to exist, so I, ummmm, ripped apart an existing app to extract its code and see how it was done. Sorry, lorglas, I think it was one of yours.<br />
<br />
In fact, looking at the list of reserved keywords there may be a few more undocumented commands. roundrect, anyone?]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[yab on YouTube]]></title>
			<link>https://yab.orgfree.com/forum/showthread.php?tid=162</link>
			<pubDate>Wed, 08 May 2024 15:43:03 +0300</pubDate>
			<dc:creator><![CDATA[<a href="https://yab.orgfree.com/forum/member.php?action=profile&uid=2">clasqm</a>]]></dc:creator>
			<guid isPermaLink="false">https://yab.orgfree.com/forum/showthread.php?tid=162</guid>
			<description><![CDATA[I have started a YouTube series of videos on yab.<br />
<br />
<a href="https://www.youtube.com/channel/UC47EyOPqdte65QEPQPxF9rQ" target="_blank" rel="noopener" class="mycode_url">https://www.youtube.com/channel/UC47EyOP...QEPQPxF9rQ</a><br />
<br />
All very basic (pun intended) and nothing that the old hands here need to concern themselves with (except to correct me in the comments, of course!) This is just a heads-up that there may be newbies arriving in this forum within the next week or two.]]></description>
			<content:encoded><![CDATA[I have started a YouTube series of videos on yab.<br />
<br />
<a href="https://www.youtube.com/channel/UC47EyOPqdte65QEPQPxF9rQ" target="_blank" rel="noopener" class="mycode_url">https://www.youtube.com/channel/UC47EyOP...QEPQPxF9rQ</a><br />
<br />
All very basic (pun intended) and nothing that the old hands here need to concern themselves with (except to correct me in the comments, of course!) This is just a heads-up that there may be newbies arriving in this forum within the next week or two.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Visual editor for Yab widgets]]></title>
			<link>https://yab.orgfree.com/forum/showthread.php?tid=142</link>
			<pubDate>Mon, 04 Jul 2022 17:20:51 +0300</pubDate>
			<dc:creator><![CDATA[<a href="https://yab.orgfree.com/forum/member.php?action=profile&uid=781">rhun</a>]]></dc:creator>
			<guid isPermaLink="false">https://yab.orgfree.com/forum/showthread.php?tid=142</guid>
			<description><![CDATA[Hello,<br />
<br />
Is there a program for YAB in which you can visually create GUI?<br />
I create such an app for myself  but maybe it is already IDE/visual editor <img src="https://yab.orgfree.com/forum/images/smilies/biggrin.gif" alt="Big Grin" title="Big Grin" class="smilie smilie_4" /> .]]></description>
			<content:encoded><![CDATA[Hello,<br />
<br />
Is there a program for YAB in which you can visually create GUI?<br />
I create such an app for myself  but maybe it is already IDE/visual editor <img src="https://yab.orgfree.com/forum/images/smilies/biggrin.gif" alt="Big Grin" title="Big Grin" class="smilie smilie_4" /> .]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[yab 1.7.6 not backwars compatible]]></title>
			<link>https://yab.orgfree.com/forum/showthread.php?tid=120</link>
			<pubDate>Tue, 19 Feb 2019 22:40:23 +0200</pubDate>
			<dc:creator><![CDATA[<a href="https://yab.orgfree.com/forum/member.php?action=profile&uid=1">bbjimmy</a>]]></dc:creator>
			<guid isPermaLink="false">https://yab.orgfree.com/forum/showthread.php?tid=120</guid>
			<description><![CDATA[The next version of yab will not be completely backward compatible. If a program draws to a view it will need to set the transparency properly. Most programs will just run, but programs that draw to a view may be broken. Is there a need to accommodate old yab programs or can we expect the developers to repair their programs?]]></description>
			<content:encoded><![CDATA[The next version of yab will not be completely backward compatible. If a program draws to a view it will need to set the transparency properly. Most programs will just run, but programs that draw to a view may be broken. Is there a need to accommodate old yab programs or can we expect the developers to repair their programs?]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Yab to C converter]]></title>
			<link>https://yab.orgfree.com/forum/showthread.php?tid=118</link>
			<pubDate>Fri, 05 Oct 2018 21:53:58 +0300</pubDate>
			<dc:creator><![CDATA[<a href="https://yab.orgfree.com/forum/member.php?action=profile&uid=188">SamuraiCrow</a>]]></dc:creator>
			<guid isPermaLink="false">https://yab.orgfree.com/forum/showthread.php?tid=118</guid>
			<description><![CDATA[I know a technique to write a Basic compiler using C or C++ as a backend.  Currently the stand-alone executable codes from Yab appear to just link an interpreter to a zipped copy of the source and I think I can do better.<br />
<br />
Since BASIC isn't fully structured it'll have to be written using a Switch command in a While loop to act as a state machine.  Also, to implement declaration of variables on-the-fly, it will have to be a pass-and-a-half compiler.  That's a fancy way to say the compiler will have to write to a header file or so at the same time as the C source that includes it using its preprocessor.<br />
<br />
Is there interest?  My goal is to have some code written to serve as an example for another BASIC compiler I want to write.  I may need help with the Haiku runtimes.]]></description>
			<content:encoded><![CDATA[I know a technique to write a Basic compiler using C or C++ as a backend.  Currently the stand-alone executable codes from Yab appear to just link an interpreter to a zipped copy of the source and I think I can do better.<br />
<br />
Since BASIC isn't fully structured it'll have to be written using a Switch command in a While loop to act as a state machine.  Also, to implement declaration of variables on-the-fly, it will have to be a pass-and-a-half compiler.  That's a fancy way to say the compiler will have to write to a header file or so at the same time as the C source that includes it using its preprocessor.<br />
<br />
Is there interest?  My goal is to have some code written to serve as an example for another BASIC compiler I want to write.  I may need help with the Haiku runtimes.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[tabs on the side!]]></title>
			<link>https://yab.orgfree.com/forum/showthread.php?tid=92</link>
			<pubDate>Mon, 18 Sep 2017 08:12:24 +0300</pubDate>
			<dc:creator><![CDATA[<a href="https://yab.orgfree.com/forum/member.php?action=profile&uid=1">bbjimmy</a>]]></dc:creator>
			<guid isPermaLink="false">https://yab.orgfree.com/forum/showthread.php?tid=92</guid>
			<description><![CDATA[Thanks yo a PR by KapiX, We now can use the new side-tab feature. <br />
<br />
<img src="http://yab.orgfree.com/images/sidetabs.png" loading="lazy"  alt="[Image: sidetabs.png]" class="mycode_img" /> <br />
<br />
<br />
tabview 10,60 to 530,390, "Box", "left", "Win"<br />
<br />
One must use the get the latest yab script ... <a href="http://yab.orgfree.com/GetLatest-yab.zip" target="_blank" rel="noopener" class="mycode_url">http://yab.orgfree.com/GetLatest-yab.zip</a> and have a really recent version of haiku to use this.]]></description>
			<content:encoded><![CDATA[Thanks yo a PR by KapiX, We now can use the new side-tab feature. <br />
<br />
<img src="http://yab.orgfree.com/images/sidetabs.png" loading="lazy"  alt="[Image: sidetabs.png]" class="mycode_img" /> <br />
<br />
<br />
tabview 10,60 to 530,390, "Box", "left", "Win"<br />
<br />
One must use the get the latest yab script ... <a href="http://yab.orgfree.com/GetLatest-yab.zip" target="_blank" rel="noopener" class="mycode_url">http://yab.orgfree.com/GetLatest-yab.zip</a> and have a really recent version of haiku to use this.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[x86_64 progress]]></title>
			<link>https://yab.orgfree.com/forum/showthread.php?tid=91</link>
			<pubDate>Mon, 31 Jul 2017 21:28:47 +0300</pubDate>
			<dc:creator><![CDATA[<a href="https://yab.orgfree.com/forum/member.php?action=profile&uid=1">bbjimmy</a>]]></dc:creator>
			<guid isPermaLink="false">https://yab.orgfree.com/forum/showthread.php?tid=91</guid>
			<description><![CDATA[It seems that the way flex works on 64 bit is the problem... we modify flex.c to make the BuildFactory work. if I copy the modified flex.c from a standard install BuildFactory to the x86_64 BuildFactory folder, I can build binaries with the   BuildFactory on a 64bit install.<br />
<br />
Now to fix it so that it makes the proper flex.c automaticly.... stay tuned!]]></description>
			<content:encoded><![CDATA[It seems that the way flex works on 64 bit is the problem... we modify flex.c to make the BuildFactory work. if I copy the modified flex.c from a standard install BuildFactory to the x86_64 BuildFactory folder, I can build binaries with the   BuildFactory on a 64bit install.<br />
<br />
Now to fix it so that it makes the proper flex.c automaticly.... stay tuned!]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[yab for Haiku x86_64?]]></title>
			<link>https://yab.orgfree.com/forum/showthread.php?tid=77</link>
			<pubDate>Mon, 19 Dec 2016 11:54:26 +0200</pubDate>
			<dc:creator><![CDATA[<a href="https://yab.orgfree.com/forum/member.php?action=profile&uid=2">clasqm</a>]]></dc:creator>
			<guid isPermaLink="false">https://yab.orgfree.com/forum/showthread.php?tid=77</guid>
			<description><![CDATA[What the title says. Has anyone managed to compile this? I tried the lastest_yab script but ran into more makefile and compiler issues than my limited skills could handle.<br />
<br />
I am looking to diversify my repo to x86_64 and would love to have yab apps there. Even if I can just have yab without the IDE package that would be great.]]></description>
			<content:encoded><![CDATA[What the title says. Has anyone managed to compile this? I tried the lastest_yab script but ran into more makefile and compiler issues than my limited skills could handle.<br />
<br />
I am looking to diversify my repo to x86_64 and would love to have yab apps there. Even if I can just have yab without the IDE package that would be great.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[brace yourselves: font change is coming]]></title>
			<link>https://yab.orgfree.com/forum/showthread.php?tid=76</link>
			<pubDate>Mon, 28 Nov 2016 13:07:02 +0200</pubDate>
			<dc:creator><![CDATA[<a href="https://yab.orgfree.com/forum/member.php?action=profile&uid=2">clasqm</a>]]></dc:creator>
			<guid isPermaLink="false">https://yab.orgfree.com/forum/showthread.php?tid=76</guid>
			<description><![CDATA[According to this <a href="https://cgit.haiku-os.org/haiku/commit/?id=945566ff43583e4f8102b4440c88f53dae775cb4" target="_blank" rel="noopener" class="mycode_url">notice</a> Haiku's default font will change from DejaVu to Noto. DejaVu will be a downloadable package not included in the default install<br />
<br />
If you have been lazy like me and not specified your fonts in your applications, you may want to upgrade once this change has come though and see what your apps look like now. Maybe it will be all right, but maybe there will be that one button where the text gets cut off. But if you did specify your fonts and want to keep it that way, you'll need to specify DejaVu in your HPKG as a dependency.<br />
<hr class="mycode_hr" />
Hmm, in href 50714 all the fonts fall back to Bitstream Charter. I've put in a ticket.]]></description>
			<content:encoded><![CDATA[According to this <a href="https://cgit.haiku-os.org/haiku/commit/?id=945566ff43583e4f8102b4440c88f53dae775cb4" target="_blank" rel="noopener" class="mycode_url">notice</a> Haiku's default font will change from DejaVu to Noto. DejaVu will be a downloadable package not included in the default install<br />
<br />
If you have been lazy like me and not specified your fonts in your applications, you may want to upgrade once this change has come though and see what your apps look like now. Maybe it will be all right, but maybe there will be that one button where the text gets cut off. But if you did specify your fonts and want to keep it that way, you'll need to specify DejaVu in your HPKG as a dependency.<br />
<hr class="mycode_hr" />
Hmm, in href 50714 all the fonts fall back to Bitstream Charter. I've put in a ticket.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[Thumb]]></title>
			<link>https://yab.orgfree.com/forum/showthread.php?tid=75</link>
			<pubDate>Mon, 31 Oct 2016 19:08:21 +0200</pubDate>
			<dc:creator><![CDATA[<a href="https://yab.orgfree.com/forum/member.php?action=profile&uid=1">bbjimmy</a>]]></dc:creator>
			<guid isPermaLink="false">https://yab.orgfree.com/forum/showthread.php?tid=75</guid>
			<description><![CDATA[I added my thumbnailing program to github:<br />
<br />
<a href="https://github.com/bbjimmy/Thumb" target="_blank" rel="noopener" class="mycode_url">https://github.com/bbjimmy/Thumb</a><br />
<br />
Thumb is a command-line tool to create thumbnails of image files for use in webpages etc. programmed in yab. the sources are on the git repo.]]></description>
			<content:encoded><![CDATA[I added my thumbnailing program to github:<br />
<br />
<a href="https://github.com/bbjimmy/Thumb" target="_blank" rel="noopener" class="mycode_url">https://github.com/bbjimmy/Thumb</a><br />
<br />
Thumb is a command-line tool to create thumbnails of image files for use in webpages etc. programmed in yab. the sources are on the git repo.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[pgextract - new app]]></title>
			<link>https://yab.orgfree.com/forum/showthread.php?tid=73</link>
			<pubDate>Fri, 23 Sep 2016 21:40:34 +0300</pubDate>
			<dc:creator><![CDATA[<a href="https://yab.orgfree.com/forum/member.php?action=profile&uid=2">clasqm</a>]]></dc:creator>
			<guid isPermaLink="false">https://yab.orgfree.com/forum/showthread.php?tid=73</guid>
			<description><![CDATA[Just a little CLI app to grab the book title and author from a Project Gutenberg UTF-8 text file and write them to attributes of the file. By itself this won't be of much interest, but it is part of an ebook reader project of mine.<br />
<br />
Usage:<br />
pgextract_en path/to/file.txt<br />
asks for confirmation in the Terminal before writing the attributes<br />
<br />
pgextract_en --noconfirm path/to/file.txt<br />
Skips confirmation. For use in batch conversions. This app will only accept a single filename, but you can use it inside a for loop in a shell script.<br />
<br />
pgextract_en --confirmGUI path/to/file.txt<br />
Puts the confirmation process in a graphical Alert. Haven't quite figured what that would be good for yet, but who knows?<br />
<br />
pgextract_en --help OR pgextract_en -h<br />
shows help<br />
<br />
path/to/file.txt cannot contain spaces. Maybe in the next version, but Project Gutenberg files have names like pg12345.txt anyway.<br />
<br />
I discovered that PG files have some nasty embedded codes in the beginning of the file, otherwise more straightforward approaches would have been possible. This code does require some clean-up - too many exit points, for one thing.<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>#!/bin/env yab<br />
<br />
doc pgextract_en v0.1<br />
doc Extract author and title data from a Project Gutenberg text file,<br />
doc and write these to attributes.<br />
doc (c) Michel Clasquin-Johnson, 2016, Public Domain<br />
doc<br />
doc Usage:<br />
doc&nbsp;&nbsp; pgextract_en &lt;--noconfirm&gt; &lt;--confirmGUI&gt; &lt;path/to/file&gt;<br />
doc<br />
doc The default behaviour is to ask for confirmation in text mode before<br />
doc writing the attributes. The --noconfirm switch skips this step. The<br />
doc --confirmGUI switch puts the confirmation in a Haiku two-button alert.<br />
doc These switches are INCOMPATIBLE! All switches are case-insensitive.<br />
doc<br />
doc Pathnames should NOT contain spaces. One file at a time, please!<br />
doc<br />
doc This will only work with English-language files, since it searches for<br />
doc the strings&nbsp;&nbsp;"The Project Gutenberg EBook of " and ", by". I may write<br />
doc versions for other languages if necessary.<br />
doc <br />
<br />
fulltitle&#36;=""<br />
title&#36;=""<br />
author&#36;=""<br />
noconfirm =0<br />
thefile&#36; = peek&#36;("argument")<br />
if lower&#36;(thefile&#36;) = "--help" or lower&#36;(thefile&#36;) = "-h" showhelp()<br />
if lower&#36;(thefile&#36;) = "--noconfirm" then <br />
&nbsp;&nbsp;&nbsp;&nbsp;noconfirm =1<br />
&nbsp;&nbsp;&nbsp;&nbsp;thefile&#36; = peek&#36;("argument")<br />
elseif lower&#36;(thefile&#36;) = "--confirmgui" then <br />
&nbsp;&nbsp;&nbsp;&nbsp;noconfirm =-1<br />
&nbsp;&nbsp;&nbsp;&nbsp;thefile&#36; = peek&#36;("argument")<br />
endif<br />
if thefile&#36; = "" exit<br />
firstline&#36; = system&#36;("head -n 1 " + thefile&#36;)<br />
print "Processing " + thefile&#36;<br />
print "First line: " <br />
print firstline&#36;<br />
print "Parsing ..."<br />
parse()<br />
switch noconfirm<br />
&nbsp;&nbsp;&nbsp;&nbsp;case -1&nbsp;&nbsp;&nbsp;&nbsp;//GUI confirmation<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;a&#36; = "Full Title: " + fulltitle&#36; + ".&#92;n"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;a&#36; = a&#36; + "Title: " + title&#36; + ".&#92;n"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;a&#36; = a&#36; + "Author: " + author&#36; + ".&#92;n&#92;n"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;a = ALERT a&#36; + "Write these attributes to " + thefile&#36; + "?", "Yes", "", "No", "warning" <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if a = 1 writeattribs()<br />
&nbsp;&nbsp;&nbsp;&nbsp;break<br />
&nbsp;&nbsp;&nbsp;&nbsp;case 0&nbsp;&nbsp;&nbsp;&nbsp;//CLI confirmation<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print "Full entry: " + fulltitle&#36;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print "Title: " + title&#36;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print "Author: " + author&#36;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;input "Write these attributes to the file? (y/n) " a&#36;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if lower&#36;(left&#36;(a&#36;,1)) = "y" writeattribs()<br />
&nbsp;&nbsp;&nbsp;&nbsp;break<br />
&nbsp;&nbsp;&nbsp;&nbsp;case 1&nbsp;&nbsp;&nbsp;&nbsp;// no confirmation - for automated bulk operations<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//requires the --noconfirm switch<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;writeattribs()<br />
&nbsp;&nbsp;&nbsp;&nbsp;break<br />
&nbsp;&nbsp;&nbsp;&nbsp;default<br />
&nbsp;&nbsp;&nbsp;&nbsp;break<br />
end switch<br />
<br />
exit<br />
<br />
sub writeattribs()<br />
&nbsp;&nbsp;&nbsp;&nbsp;print<br />
&nbsp;&nbsp;&nbsp;&nbsp;print "Setting attribute ebook:full_title to " + fulltitle&#36; + "."<br />
&nbsp;&nbsp;&nbsp;&nbsp;attribute set "String", "ebook:full_title", fulltitle&#36;, thefile&#36;<br />
&nbsp;&nbsp;&nbsp;&nbsp;print "Setting attribute ebook:title to " + title&#36; + "."<br />
&nbsp;&nbsp;&nbsp;&nbsp;attribute set "String", "ebook:title", title&#36;, thefile&#36;<br />
&nbsp;&nbsp;&nbsp;&nbsp;print "Setting attribute ebook:author to " + author&#36; + "."<br />
&nbsp;&nbsp;&nbsp;&nbsp;attribute set "String", "ebook:author", author&#36;, thefile&#36;<br />
end sub<br />
<br />
sub showhelp()<br />
&nbsp;&nbsp;&nbsp;&nbsp;for a=1 to arraysize(docu&#36;(),1) <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print docu&#36;(a) <br />
&nbsp;&nbsp;&nbsp;&nbsp;next a <br />
&nbsp;&nbsp;&nbsp;&nbsp;exit<br />
end sub<br />
<br />
sub parse()<br />
&nbsp;&nbsp;&nbsp;&nbsp;local without_asterixes&#36;, character&#36;, postitle, posauthor, search1&#36;, search2&#36;<br />
&nbsp;&nbsp;&nbsp;&nbsp;//change the following 2 lines for books in other languages<br />
&nbsp;&nbsp;&nbsp;&nbsp;search1&#36; = "The Project Gutenberg EBook of "<br />
&nbsp;&nbsp;&nbsp;&nbsp;search2&#36; = ", by "<br />
&nbsp;&nbsp;&nbsp;&nbsp;//some PG files have asterisks in them. Replace these with spaces<br />
&nbsp;&nbsp;&nbsp;&nbsp;//then remove them later with trim&#36;<br />
&nbsp;&nbsp;&nbsp;&nbsp;for f = 1 to len(firstline&#36;)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;character&#36; = mid&#36;(firstline&#36;, f,1)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if character&#36; = "*" or character&#36; = chr&#36;(20) character&#36; = " "<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;without_asterixes&#36; = without_asterixes&#36; + character&#36;<br />
&nbsp;&nbsp;&nbsp;&nbsp;next f<br />
&nbsp;&nbsp;&nbsp;&nbsp;firstline&#36; = without_asterixes&#36;<br />
&nbsp;&nbsp;&nbsp;&nbsp;firstline&#36; = trim&#36;(firstline&#36;)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print "Cleaned up the first line:"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Print firstline&#36;<br />
&nbsp;&nbsp;&nbsp;&nbsp;postitle = instr(lower&#36;(firstline&#36;), lower&#36;(search1&#36;)) + len(search1&#36;)<br />
&nbsp;&nbsp;&nbsp;&nbsp;fulltitle&#36; = trim&#36;(mid&#36;(firstline&#36;, postitle))<br />
&nbsp;&nbsp;&nbsp;&nbsp;posauthor = instr(lower&#36;(fulltitle&#36;), lower&#36;(search2&#36;)) + len(search2&#36;)<br />
&nbsp;&nbsp;&nbsp;&nbsp;title&#36; = trim&#36;(left&#36;(fulltitle&#36;, posauthor - (len(search2&#36;)+1)))<br />
&nbsp;&nbsp;&nbsp;&nbsp;author&#36; = trim&#36;(mid&#36;(fulltitle&#36;, posauthor))<br />
end sub</code></div></div>]]></description>
			<content:encoded><![CDATA[Just a little CLI app to grab the book title and author from a Project Gutenberg UTF-8 text file and write them to attributes of the file. By itself this won't be of much interest, but it is part of an ebook reader project of mine.<br />
<br />
Usage:<br />
pgextract_en path/to/file.txt<br />
asks for confirmation in the Terminal before writing the attributes<br />
<br />
pgextract_en --noconfirm path/to/file.txt<br />
Skips confirmation. For use in batch conversions. This app will only accept a single filename, but you can use it inside a for loop in a shell script.<br />
<br />
pgextract_en --confirmGUI path/to/file.txt<br />
Puts the confirmation process in a graphical Alert. Haven't quite figured what that would be good for yet, but who knows?<br />
<br />
pgextract_en --help OR pgextract_en -h<br />
shows help<br />
<br />
path/to/file.txt cannot contain spaces. Maybe in the next version, but Project Gutenberg files have names like pg12345.txt anyway.<br />
<br />
I discovered that PG files have some nasty embedded codes in the beginning of the file, otherwise more straightforward approaches would have been possible. This code does require some clean-up - too many exit points, for one thing.<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>#!/bin/env yab<br />
<br />
doc pgextract_en v0.1<br />
doc Extract author and title data from a Project Gutenberg text file,<br />
doc and write these to attributes.<br />
doc (c) Michel Clasquin-Johnson, 2016, Public Domain<br />
doc<br />
doc Usage:<br />
doc&nbsp;&nbsp; pgextract_en &lt;--noconfirm&gt; &lt;--confirmGUI&gt; &lt;path/to/file&gt;<br />
doc<br />
doc The default behaviour is to ask for confirmation in text mode before<br />
doc writing the attributes. The --noconfirm switch skips this step. The<br />
doc --confirmGUI switch puts the confirmation in a Haiku two-button alert.<br />
doc These switches are INCOMPATIBLE! All switches are case-insensitive.<br />
doc<br />
doc Pathnames should NOT contain spaces. One file at a time, please!<br />
doc<br />
doc This will only work with English-language files, since it searches for<br />
doc the strings&nbsp;&nbsp;"The Project Gutenberg EBook of " and ", by". I may write<br />
doc versions for other languages if necessary.<br />
doc <br />
<br />
fulltitle&#36;=""<br />
title&#36;=""<br />
author&#36;=""<br />
noconfirm =0<br />
thefile&#36; = peek&#36;("argument")<br />
if lower&#36;(thefile&#36;) = "--help" or lower&#36;(thefile&#36;) = "-h" showhelp()<br />
if lower&#36;(thefile&#36;) = "--noconfirm" then <br />
&nbsp;&nbsp;&nbsp;&nbsp;noconfirm =1<br />
&nbsp;&nbsp;&nbsp;&nbsp;thefile&#36; = peek&#36;("argument")<br />
elseif lower&#36;(thefile&#36;) = "--confirmgui" then <br />
&nbsp;&nbsp;&nbsp;&nbsp;noconfirm =-1<br />
&nbsp;&nbsp;&nbsp;&nbsp;thefile&#36; = peek&#36;("argument")<br />
endif<br />
if thefile&#36; = "" exit<br />
firstline&#36; = system&#36;("head -n 1 " + thefile&#36;)<br />
print "Processing " + thefile&#36;<br />
print "First line: " <br />
print firstline&#36;<br />
print "Parsing ..."<br />
parse()<br />
switch noconfirm<br />
&nbsp;&nbsp;&nbsp;&nbsp;case -1&nbsp;&nbsp;&nbsp;&nbsp;//GUI confirmation<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;a&#36; = "Full Title: " + fulltitle&#36; + ".&#92;n"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;a&#36; = a&#36; + "Title: " + title&#36; + ".&#92;n"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;a&#36; = a&#36; + "Author: " + author&#36; + ".&#92;n&#92;n"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;a = ALERT a&#36; + "Write these attributes to " + thefile&#36; + "?", "Yes", "", "No", "warning" <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if a = 1 writeattribs()<br />
&nbsp;&nbsp;&nbsp;&nbsp;break<br />
&nbsp;&nbsp;&nbsp;&nbsp;case 0&nbsp;&nbsp;&nbsp;&nbsp;//CLI confirmation<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print "Full entry: " + fulltitle&#36;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print "Title: " + title&#36;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print "Author: " + author&#36;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;input "Write these attributes to the file? (y/n) " a&#36;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if lower&#36;(left&#36;(a&#36;,1)) = "y" writeattribs()<br />
&nbsp;&nbsp;&nbsp;&nbsp;break<br />
&nbsp;&nbsp;&nbsp;&nbsp;case 1&nbsp;&nbsp;&nbsp;&nbsp;// no confirmation - for automated bulk operations<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//requires the --noconfirm switch<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;writeattribs()<br />
&nbsp;&nbsp;&nbsp;&nbsp;break<br />
&nbsp;&nbsp;&nbsp;&nbsp;default<br />
&nbsp;&nbsp;&nbsp;&nbsp;break<br />
end switch<br />
<br />
exit<br />
<br />
sub writeattribs()<br />
&nbsp;&nbsp;&nbsp;&nbsp;print<br />
&nbsp;&nbsp;&nbsp;&nbsp;print "Setting attribute ebook:full_title to " + fulltitle&#36; + "."<br />
&nbsp;&nbsp;&nbsp;&nbsp;attribute set "String", "ebook:full_title", fulltitle&#36;, thefile&#36;<br />
&nbsp;&nbsp;&nbsp;&nbsp;print "Setting attribute ebook:title to " + title&#36; + "."<br />
&nbsp;&nbsp;&nbsp;&nbsp;attribute set "String", "ebook:title", title&#36;, thefile&#36;<br />
&nbsp;&nbsp;&nbsp;&nbsp;print "Setting attribute ebook:author to " + author&#36; + "."<br />
&nbsp;&nbsp;&nbsp;&nbsp;attribute set "String", "ebook:author", author&#36;, thefile&#36;<br />
end sub<br />
<br />
sub showhelp()<br />
&nbsp;&nbsp;&nbsp;&nbsp;for a=1 to arraysize(docu&#36;(),1) <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print docu&#36;(a) <br />
&nbsp;&nbsp;&nbsp;&nbsp;next a <br />
&nbsp;&nbsp;&nbsp;&nbsp;exit<br />
end sub<br />
<br />
sub parse()<br />
&nbsp;&nbsp;&nbsp;&nbsp;local without_asterixes&#36;, character&#36;, postitle, posauthor, search1&#36;, search2&#36;<br />
&nbsp;&nbsp;&nbsp;&nbsp;//change the following 2 lines for books in other languages<br />
&nbsp;&nbsp;&nbsp;&nbsp;search1&#36; = "The Project Gutenberg EBook of "<br />
&nbsp;&nbsp;&nbsp;&nbsp;search2&#36; = ", by "<br />
&nbsp;&nbsp;&nbsp;&nbsp;//some PG files have asterisks in them. Replace these with spaces<br />
&nbsp;&nbsp;&nbsp;&nbsp;//then remove them later with trim&#36;<br />
&nbsp;&nbsp;&nbsp;&nbsp;for f = 1 to len(firstline&#36;)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;character&#36; = mid&#36;(firstline&#36;, f,1)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if character&#36; = "*" or character&#36; = chr&#36;(20) character&#36; = " "<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;without_asterixes&#36; = without_asterixes&#36; + character&#36;<br />
&nbsp;&nbsp;&nbsp;&nbsp;next f<br />
&nbsp;&nbsp;&nbsp;&nbsp;firstline&#36; = without_asterixes&#36;<br />
&nbsp;&nbsp;&nbsp;&nbsp;firstline&#36; = trim&#36;(firstline&#36;)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print "Cleaned up the first line:"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Print firstline&#36;<br />
&nbsp;&nbsp;&nbsp;&nbsp;postitle = instr(lower&#36;(firstline&#36;), lower&#36;(search1&#36;)) + len(search1&#36;)<br />
&nbsp;&nbsp;&nbsp;&nbsp;fulltitle&#36; = trim&#36;(mid&#36;(firstline&#36;, postitle))<br />
&nbsp;&nbsp;&nbsp;&nbsp;posauthor = instr(lower&#36;(fulltitle&#36;), lower&#36;(search2&#36;)) + len(search2&#36;)<br />
&nbsp;&nbsp;&nbsp;&nbsp;title&#36; = trim&#36;(left&#36;(fulltitle&#36;, posauthor - (len(search2&#36;)+1)))<br />
&nbsp;&nbsp;&nbsp;&nbsp;author&#36; = trim&#36;(mid&#36;(fulltitle&#36;, posauthor))<br />
end sub</code></div></div>]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[NetFS Control Center :New Project]]></title>
			<link>https://yab.orgfree.com/forum/showthread.php?tid=72</link>
			<pubDate>Tue, 06 Sep 2016 05:05:35 +0300</pubDate>
			<dc:creator><![CDATA[<a href="https://yab.orgfree.com/forum/member.php?action=profile&uid=1">bbjimmy</a>]]></dc:creator>
			<guid isPermaLink="false">https://yab.orgfree.com/forum/showthread.php?tid=72</guid>
			<description><![CDATA[NetFS Control Center <br />
<br />
<img src="http://yab.orgfree.com/images/NetFS_Control_Center.png" loading="lazy"  alt="[Image: NetFS_Control_Center.png]" class="mycode_img" /><br />
<br />
NetFS is the networked BFS sharing file system that is available for Haiku. It is an easy way to share files between Haiku computers. This is a GUI Wrapper to the netfs_server_prefs command-line tool.]]></description>
			<content:encoded><![CDATA[NetFS Control Center <br />
<br />
<img src="http://yab.orgfree.com/images/NetFS_Control_Center.png" loading="lazy"  alt="[Image: NetFS_Control_Center.png]" class="mycode_img" /><br />
<br />
NetFS is the networked BFS sharing file system that is available for Haiku. It is an easy way to share files between Haiku computers. This is a GUI Wrapper to the netfs_server_prefs command-line tool.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[New on the FatElk repo]]></title>
			<link>https://yab.orgfree.com/forum/showthread.php?tid=64</link>
			<pubDate>Wed, 20 Apr 2016 06:51:20 +0300</pubDate>
			<dc:creator><![CDATA[<a href="https://yab.orgfree.com/forum/member.php?action=profile&uid=1">bbjimmy</a>]]></dc:creator>
			<guid isPermaLink="false">https://yab.orgfree.com/forum/showthread.php?tid=64</guid>
			<description><![CDATA[<span style="font-weight: bold;" class="mycode_b">Yoshi</span> <br />
<br />
<span style="font-weight: bold;" class="mycode_b">Yab over the Shell Interface<br />
</span><br />
Yoshi is used to allow a script to query the user for information. Yoshi displays information to the user and receives the input, then passes the information back to the script. Yoshi doesn't change your script into an interactive gui application. Each query window is closed when the information is returned and the script must open a new window to continue to interact with the user.<br />
<br />
<br />
This is an example of the power iof yab.<br />
<br />
<a href="https://github.com/bbjimmy/Yoshi/wiki/Introduction" target="_blank" rel="noopener" class="mycode_url">https://github.com/bbjimmy/Yoshi/wiki/Introduction</a><br />
<br />
<a href="http://fatelk.com/repo/packages/yoshi-0.1.0-2-x86_gcc2.hpkg" target="_blank" rel="noopener" class="mycode_url">http://fatelk.com/repo/packages/yoshi-0...._gcc2.hpkg</a>]]></description>
			<content:encoded><![CDATA[<span style="font-weight: bold;" class="mycode_b">Yoshi</span> <br />
<br />
<span style="font-weight: bold;" class="mycode_b">Yab over the Shell Interface<br />
</span><br />
Yoshi is used to allow a script to query the user for information. Yoshi displays information to the user and receives the input, then passes the information back to the script. Yoshi doesn't change your script into an interactive gui application. Each query window is closed when the information is returned and the script must open a new window to continue to interact with the user.<br />
<br />
<br />
This is an example of the power iof yab.<br />
<br />
<a href="https://github.com/bbjimmy/Yoshi/wiki/Introduction" target="_blank" rel="noopener" class="mycode_url">https://github.com/bbjimmy/Yoshi/wiki/Introduction</a><br />
<br />
<a href="http://fatelk.com/repo/packages/yoshi-0.1.0-2-x86_gcc2.hpkg" target="_blank" rel="noopener" class="mycode_url">http://fatelk.com/repo/packages/yoshi-0...._gcc2.hpkg</a>]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[new lib]]></title>
			<link>https://yab.orgfree.com/forum/showthread.php?tid=60</link>
			<pubDate>Sun, 10 Apr 2016 17:57:48 +0300</pubDate>
			<dc:creator><![CDATA[<a href="https://yab.orgfree.com/forum/member.php?action=profile&uid=2">clasqm</a>]]></dc:creator>
			<guid isPermaLink="false">https://yab.orgfree.com/forum/showthread.php?tid=60</guid>
			<description><![CDATA[Now up on my repo: the rather grandiosely named libclasqm...hpkg.<br />
<br />
For now, this is a small collection of yab routines and utilities, many of them based on discussions we've had on this forum. I've tried to give credit in the code where that is the case. It also includes some ancient yabasic libraries that might still serve as inspiration. Don't ask where I got those: I've had them tucked away on my hd for years.<br />
<br />
These are routines I, personally tend to use a lot, and a few I've never done but thought were pretty neat to work out anyway. Over time it may become a requirement to compile my apps. It is not really an orderly, focused collection of routines, more a personal grab-bag. But I thought I'd share it anyway.]]></description>
			<content:encoded><![CDATA[Now up on my repo: the rather grandiosely named libclasqm...hpkg.<br />
<br />
For now, this is a small collection of yab routines and utilities, many of them based on discussions we've had on this forum. I've tried to give credit in the code where that is the case. It also includes some ancient yabasic libraries that might still serve as inspiration. Don't ask where I got those: I've had them tucked away on my hd for years.<br />
<br />
These are routines I, personally tend to use a lot, and a few I've never done but thought were pretty neat to work out anyway. Over time it may become a requirement to compile my apps. It is not really an orderly, focused collection of routines, more a personal grab-bag. But I thought I'd share it anyway.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[#yab on freenode]]></title>
			<link>https://yab.orgfree.com/forum/showthread.php?tid=53</link>
			<pubDate>Tue, 01 Mar 2016 23:26:51 +0200</pubDate>
			<dc:creator><![CDATA[<a href="https://yab.orgfree.com/forum/member.php?action=profile&uid=1">bbjimmy</a>]]></dc:creator>
			<guid isPermaLink="false">https://yab.orgfree.com/forum/showthread.php?tid=53</guid>
			<description><![CDATA[I have registered control for #yab on freenode.<br />
<br />
Launch vision<br />
log-in to freenode<br />
type:<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>/join #yab</code></div></div><br />
This is a good place for real-time chats regarding yab and yab programming.]]></description>
			<content:encoded><![CDATA[I have registered control for #yab on freenode.<br />
<br />
Launch vision<br />
log-in to freenode<br />
type:<br />
<br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>/join #yab</code></div></div><br />
This is a good place for real-time chats regarding yab and yab programming.]]></content:encoded>
		</item>
	</channel>
</rss>