Computers


  Strange animals...

Whatever a computer does, is perfectly sensible and locical. From the computer's point of view...

A computer is always perfect. The user may jump around, breastbeating and pulling his hair, but the program happily believes everything it does is right.

Even Windows95 feels that everything it does, makes sense, while filling your precious memory with DLL-files of not known origin and use.... (Well, I guess nobody is surprised that Microsoft software is REALLY pretentious...)

After this little anti-Windows outburst, how much would I like to reveal that I had my own Mac in the cradle, or that I'm bravely sticking to old, black DOS. But, the truth is, sadly, that I'm a Windows-man. I can not defend this personal defect in any other way than saying it's a matter of habit and economy. My first computer was a 386 running Windows 3.11... Her name was "Katrine", and I still use her. Sometimes.

And, if Mac continues being more expensive than the cheapest IBM-clones, I guess my future unfortunately waites in a Window...

The good thing about Windows, is that it is so bad, you just HAVE to be creative and work out things yourself. :-) The bad thing - of course - is Microsoft.... §-(

(But after all - DOS is the better system for fast handling of files...)


  The computer language Basic

In case you have never tried programming: it is basically like speaking any other language. You have to learn the words and the grammar.

How like a human language it is, I learned once after having written quite a lot of Basic, when I suddenly found myself thinking English with the syntax of Basic! That was a somewhat scary experience.

The importance of grammar is the main difference between human and computer language. The computer is more concerned about spelling, syntax and placement of commas than any teacher of English, or even an Icelander. (In Iceland, they are very conscious about their language.) Just one comma lacking, and the computer calls out "Syntax Error" and fills the page with red lines...

The good thing about Basic, is that the commands mostly are usual, English words, like "Left", "Right" og "Kill"(!). Another positive aspect, is that you do not have to care about lots of semicolons and apostrophes, like in several other programming languages.

In fact, Basic is slightly like Norwegian, since there are a number of dialects. The programs using Basic-dialects, behave almost like dancing Norwegians at "Kappleiks". (This is a Norwegian term for get-togethers for the Norwegian folk music practitioners. Most of us are very conscious about conserving the diversity of traditions within Norwegian folk music and dance.) At a "Kappleik", you frequently hear "this is a valdres-/ telemarks-/ numedals-/ halling-/ vestlands-dance, and I don't know how to do it, because what I dance, is telemarks-/ numedals-/ halling-/ valdres-/ vestlands-dance...

If you have any of the older versions of MSOffice (Word 6.0 or 7.0, and similar Excel-versions), they behave like Norwegians, saying: "this command is Excel/Word/Whatever-Basic, and I only speak Word-/Excel-/Whatever-Basic. ."

Swedish girls sometimes get a little fed up with the serious, Norwegian attitude that one should ONLY dance what you know really well. Maybe Swedes have less concern about dialects? Well, in their newest programs (Word97 &co.), Microsoft has obviously been looking towards Sweden, because the programs are supposed to care less about dialects, making it possible to use the same programming commands in Word, Excel and some other members of the family. (Well, and the language is a bit more difficult to use as well. Just when you thought they were thinking about making things easier for us...)


  WordBasic

WordBasic is, as you might understand by now, Microsoft Word's dialect of Basic. (Well, at least it was till the introduction of VBA with Word97) This means you may use the usual Basic-commands, and lots of words only Word understands.

A program written for Microsoft Word, is called a "macro". Since the programs written in WordBasic usually are tiny, "micro" would have been more suitable, but a nerd's life is not supposed to be logical.

A macro is an array of commands you want Word to perform. At this point, I could have written a completely stupid and unuseful little example to show you that macros are not dangerous. However, I choose to show you a nice and easy little trick, showing how a friendly macro can actually help you writing it:

ei = MsgBox("Står disketten i diskettstasjonen?", 
"Disk inne?", 36) MsgBox Str$(ei),""

Now, that's easy. And clever!

I will forgive you if you not immediately see what is so clever about this, especially since I have not translated the Norwegian question, because I wanted to re-use the graphics from my Norwegian page.... I'm lazy today.

The command above pops up a little box to ask any Norwegian around whether his diskett is in the drive. It looks like this:

So far, so good. The problem is that you don't know what the computer is thinking when somebody innocently answers "Ja" ("Yes") or "Nei" ("No"). It does not think yes or no, neither ja or nei...

Just to make it difficult, the computer has hidden a number behind each button. Unless you have years of experience with WordBasic or can read the thoughts of the microchip, you do not know that number. And you need to know that number to know if the user has responded with yes or no...

This is the clever thing: this command: MsgBox Str$(ei) tells you which number is behind the button you press. You just run the macro, answers yes or no, and, hocus pocus, this nice little box pops up to inform you which number was hidden in that button:

So whenever you are uncertain about what value Word has placed in a variable, use a little MsgBox to instantly reveal it. (Of course, you can also try to make sense of Word's "Show me variables"-command, and run through step by step, but I think the message box is more efficient.)

Now, wasn't that useful?

I'm sorry for not explaining everything about the command Str$(), and the difference between MsgBox and MsgBox(). I prefer showing you some useful macros you may cut and paste straight into your own Word 6.-or 7.0 macro library.


   SaveWithCopyOnDiskette-macro

This macro, which places a backup copy on the diskette when you save, is so useful that I think it should have been made a Word command years ago. But that's Microsoft, you know, wasting thousands of hours on writing auto formatting things which are so "intelligent" they can mess up the layout of the whole document, instead of making small, simple programs we, the users, actually need. :-(

So, the users are abandoned to make the useful stuff themselves, that's the way Microsoft usually does it. But here, I'll give YOU a macro which performs! (Well, only if you have ENGLISH version of Word 6.0 eller Word 7.0. If you want the Norwegian version of the macro, go to the Norwegian page)

This is the macro, saved as text. Just rightclick the link, and choose "Save Link As...". Then, you open the file in Word, as text only, and does this trick:

  • Select all...
  • ...copy...
  • ...choose Macro from the Tools menu...
  • ...enter a cute, little name, like "SaveNCopy"...
  • ...click "Create"...
  • ...paste below the "Sub MAIN"-line of text. FINISHED! Close the document and say yes to saving changes.


      DeleteDocument-macro

    Of course, writing two different programs for word processing and file managing, like Microsoft has done (Word/File Manager) is quite silly. What if you open a document in Word and realize that it is no longer needed, what do you do? Start the File Manager to find and delete the file?

    Not if you have this macro..... This macro persuades Word to get rid of that unwanted being...

    This macro is so small and simple, I will explain how it works, in case you want to start using WordBasic:

    Sub MAIN
    On Error Goto notkilled
    ife = MsgBox("Do you REALLY want to delete this beautiful document called " + FileName$() + "????", "Licence to kill", 36)
    If ife = - 1 Then
       victim$ = FileName$()
       DocClose 2
       Kill victim$
       Print "The file " + victim$ + " is extinct..."
    Else
    End If
    notkilled:
    End Sub

    The first line simply marks the beginning of the macro. The "On Error"-command tells Word that in case errors appear, Word is supposed to jump ("Goto") to the bookmark "notkilled", on the second last line.

    Then, the action starts: MsgBox() asks the user if s/he really wants to delete the file, and the command FileName$() displays the name of the document, to be certain the user knows what file the question matters. When the command spells ife=MsgBox("..."), it shows that Word hides the user's reply to the question in the variable called ife, so the next line has to check this variable for what the user actually answered

    If ife=-1, the user replied yes, and the deleting process can start..

    We need to store the name of the file in a variable, here I've named that variable "victim". (A little dramatic?...) Because the variable is supposed to contain text, Word wants it to end with a dollar symbol. (Which just confirms how Microsoft loves dollars...) So, the full command spells: victim$ = FileName$().

    Now, Word does not allow us to delete an open file, so we need to close it. That is done with this command: DocClose 2. The "two" tells Word that we don't want to save changes.

    Dramatic climax: Kill victim$! This is where the cruel task is committed, everything else is only preparation and small talk. (Calling the delete-command "Kill", proves that the creators of Basic, had a sense of humour.)

    The print-command writes to the grey line at the bottom of the Word-screen that the crime is committed.

    The rest of the macro just tidies up, gets out of the if-structure, and exits the macro nicely. The file is dead, and no revival from the dustbin is possible.

    (And that was a warning: use the macro carefully. Word is a serious serial killer, so a document must be retyped it if you need it later.)