www.purebasic.org is another good site for purebasic program snippits. I just went though a download process that gave me an additional 582 separate code peices, most of them arranged in some sort of order so that you could just pick out the ones that really interest you.
Please note that some, if not all, of this code is also available through the various forums for PureBASIC, so don't be surpried if some of it seems familiar. But this is a good site to snag code that relates to a given topic, and to get a majority of what is available, or just to see what subject areas are being developed.
Now for anyone that wants to download this stuff using IE, I have some words of advice: When you try it, IE wants to treat the file as an .htm (short for HTML) file, and in doing so. it will change the ".pb" extension to "_pb.htm" and leave all the HTML tags intact. You probably don't want to save it that way.
During the download step, you can elect to save the file as a TXT file. This is much better, but IE will then proceed to change the extention from ".pb" to "-pb.txt". The tags are eliminated, but you get a file with an undesireable extension on it. Now the way you are normally advised to prevent this is to take the file name, like "FileDate&Time.pb" and put double-quotes around it, just as it is showm here, and this will prevent IE from changing the name or adding anything to it when the file is saved. But since the file name is highlighed already, and you have to put a double-quote at the front and the back, and you run the risk of accidently erasing it during this step, I am going to suggest that you not worry about how IE will rename it right now -- just go anead and download them all as text files, and you can fix this problem later.
Well, it's later, and you have now downloaded all the files from www.purebasic.org that you want.
Now how do you fix up those file names? Not too hard, but it does take several steps. So let's run through them.
First, I am going to assume that you have Excel on your machine or a similar spreadsheet program. That will make this easy. If not, you will probably have to write a program for the job. I could show you such a program, but I found this way more interesting and possibly more informative.
(1) Using Start/Run, enter "cmd" and enter the world of DOS. Enter "cd" to change directory, and put after it the path to the place where you downloaded all those snippit code samples. Something like this example:
cd "\Program Files\PureBASIC\Snippits"
Note the use of upper/lower case is optional, and under some windows (if not all versions), the addition of the double quotes is not required. But I've show it with double quotes in case they are needed for your machine. This preserves long file names and allows certain characters to be used in the file name (such as "&").
(2) Now that you are in the right folder, you enter the following DOS command to get a complete list of all the files there that have the "_pb.txt" tail end:
dir *.txt | find "_pb.txt" > pbtxt.bat
This does a directory list of all .txt files, then pipes it to the FIND filter which screens the names for those that match "_pb.txt" and sends these to a new file called pbtxt.bat. This will be a file we will be using as a batch file for our renaming purposes.
(3) Now exit (or better yet, minimize) this window and go under Start/Programs, or above Programs, or click on your Office toolbar and fire up a new Excel workbook or worksheet. Then inside Excel, under File, Open the same pbtxt.bat file that you just made. You should find it in the same folder where you did that dir | find command sequence (not the use of the verticle bar, which is over the Enter or Return key on most standard keyboards. This is the "pipe" symbol that causes the output of one command to become the input of another command using StdOut and StdIn channels).
As you inport the pbtxt.bat file, you want to use fixed column width and flag the inpurt process to ignore the columns that provide the date of the file and the size of the file -- you only want to import the filenames (If you make a mistake and inport these, don't worry: Just select the resulting columns and delete them).
(4) With pbtxt.bat inported, you should have one column (A) filled with the filenames. Select the contents of this column and copy it into the adjacent column (B). Now you have two columns with all the file names, side by side. Select both columns, and use Format/Columns/Autofit Selection,
and they should expand to fit all the filenames, which will make them more readable.
(5) Select just column B and under Edit/Replace, indicate that you want to change from _pb.txt to .pb, then do a Replace All. That column becomes the new filenames. Select just column A and using Insert/Columns, cause a new empty Column A to appear, and the two columns of filenames should now appear as Column B and Column C.
(6) One file name stands out because it uses a reserved symbol in its name, the "&". Find the row that has "FileDate&Time" in both columns and put double quotes around the entirety of both file names. That will take care of this problem.
(7) Enter "copy" all the way down the empty Column A. now, by typing it in one cell, then copying that cell all the way down to the bottom row where the last filenames appear. Now you have a batch file that can be used to rename the old filenames to the new filenames. Use File/Save and save this back to the same pbtxt.bat file as a txt file, tab delimited. Either close the Excel file or minimize it. You will need it again, so minimizing it might be good.
(8) Returning to the DOS window and the same directory (or opening the folder in Windows and find finding the pbtxt.bat file), you now want to execute the pbtxt.bat file, and it will immediately create copies of old files with the new names in that same directory. You could have used a "ren" instead of "copy", but that would have failed if you had any files of that new name already there. The "copy" will just overwrite them automatically.
(9) Now you want to get rid of the copies that have the old _pb.txt extensions. so you go back into the spreadsheet, delete the Column C with the new filenames, and change all the "copy" terms in Column A to "del" so that you can now delete the files. You save the changes to pbtxt.bat again, and return to where pbtxt.bat can be found and execut it again. This time it will automatically delete each of the files that has the old name, leaving just the new files with the correct name and extension.
Hopefully, you have done this and got a good result, and learned something about how to manipulate groups of files along the way. You have just seen some of the power that is abailable to the DOS programmer via simple commands and filters - tricks that are hard for the diehard Windows clicker to do from the GUI. Of course we used the Windows interface and applications as well, but it is the blend of both modes that can provide real power. So read up on DOS a bit -- it isn't as dead as you thought.
And, oh yes, you can close Excel and the DOS window now. We are done.
Downloading from www.purebasic.org
Downloading from www.purebasic.org
has-been wanna-be (You may not agree with what I say, but it will make you think).
I guess you refer to the link on purebasic.org to the code archieve on www.purearea.net? For those who don't want to download 500+ snipets manually, you can download a zip-file with all those examples included from www.purearea.net. Additionally if you're using mozilla or netscape the links to the individual examples don't work as they include a '\' -char (i.e. MS style) instead of the WWW commonly used '/'-character.
Yes, I was starting to ask where you found 500+ sniplets of code on my pb.org site!
BTW - purebasic.org is open to any and all PB developers that need a place to host their code or project.. Free of charge, of course.. Email me if you're interested!
BTW - purebasic.org is open to any and all PB developers that need a place to host their code or project.. Free of charge, of course.. Email me if you're interested!
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
-
- User
- Posts: 30
- Joined: Wed Aug 06, 2003 5:52 pm
- Location: Florida, USA
You are both Right, of course!
Yep, my mistake, I started at www.purebasic.org, then ended up at www.purearena.net, which is where I found the large selection of code. But I was tired, so it didn't sink in at the time. I had previously downlaoded the whole archive, but when I extracted it, I got the 8.3 filenames, not the long filenames associated with each file. So I downloaded each separate file by hand, but ran into the problem of IE wanting to change the extensions, which is where the above issue and efforts to cope came from.
Anyway, no real harm done, and you both got to pitch your sites, so you should thank me. All those great people out there in purbasicville learned something too, so now we all should be happy, right? Yeaschhh!
Anyway, no real harm done, and you both got to pitch your sites, so you should thank me. All those great people out there in purbasicville learned something too, so now we all should be happy, right? Yeaschhh!

Has-been Wanna-be (You may not like what I say, but it will make you think)
I just didn't want any confusion - I haven't put in near the work into purebasic.org that Andre has into purearena.net's code archive! 
Regardless, I'm (almost) always happy!
Thanks for the plug

Regardless, I'm (almost) always happy!
Thanks for the plug

-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net