Monday, August 20, 2007

QM Quickling: OnScreenDisplay

OnScreenDisplay("Opening FireFox" -1 0 0 "Arial Black" 30 0xff 4 "FF_Start" 0x343434 )


So, this one has been floating around in the forums for a while and I thought I'd give my slants on it.


When I'm starting a program or a process that might take more than 1 second, I like to give a visual confirmation that it actually did start. For instance:





So, here's how the parameters break out:

  1. your text. you can also use a string variable instead. OnScreenDisplay(strText)
  2. the time the display stay on screen. the default is 0 (5 seconds) or -1 for indefinite.
  3. the X Y coordinates of where to put the top left corner of the box. 0 0 is the middle of the screen.
  4. the font name (mine is "Arial Black"). I get mine from the font drop-down list in Word.
  5. font size (mine is 30).
  6. font colour in hex. I use Pixie but you can try http://www.free-webmaster-tools.com/colorpicker.htm to do it online but I don't know how safe the site is.
  7. flags. Note: you can add the numbers together to have it activate more than one state (i.e. 6 is number 2 and number 4).
    • 1 - nontransparent. The background in transparent or not (not supported on Win98/Me).
    • 2 - synchronous. The macro pauses till the text disappears (see #2 above).
    • 4 - the user can click to hide the window.
  8. you can create an easy handle for the display window. For example, clo win("FF_Start")
  9. background colour in hex
  10. wrapwidth. this will create a multi-line display box with this number as the width (I didn't use it here); very handy for string variable texts.

Here is another format I use for a differ process.
OnScreenDisplay("Removing Dups...please wait" 0 0 0 "" 18 292929 4 "Rmv_Dps")

Ok, so now you have 5 days to put this into your code or I will mail you macros back to you in a box....one function at a time.

Sunday, August 12, 2007

QM Quickling: FIND

_i= find(a "5")

This topic has hit the forums a lot lately and so I decided to do a little something on it.

'Find' is one of those funny little functions that returns a number instead of assigning it's value to a string like 'findreplace', 'left', etc. What it's doing is giving you the position of the first character of the sub-string that it finds. Here's an example right out of the Help document (press F1 and surf in there for a while it's really well done).

str s = "Notepad.exe"
int i = find(s ".exe")
out i;; now i is 7


Things to remember:

  • it is zero indexed so you need to remember that the first character is in position 0 not 1.
  • because it is zero indexed, the position returned for the last character will be 1 less than the length of the string.
  • if there is more than one line, the "newline" character in the Windows world is actually 2 characters. Here's an example of that:
    • int z
      str a=
      ;1
      ;2
      ;3
      ;4
      ;5

      z=len(a)
      _i= find(a "3")
      out z
      out _i

Find is useful even if you don't care where in the source-string the string lies. For example, if you just want to know that it is in there somewhere, just test to see if the number returned is greater than '-1' which is what is returned if it is not present.

Ok, so now you have 5 days to put this into your code and learn the Feng shui of 'find'.

Monday, August 6, 2007

QM Quickling: Intro

The summer break! What a deal, everyday sit there and say, "holy cow it's been a long time since my last lesson; what am I gonna do?!" Well, since I've been busy doing some job hunt stuff and I still haven't made that million dollars I was hoping to get when I started blogging, I've decided to declare "Bloggging Bankruptcy" and start afresh...or call it "The Summer Break". Well, that's not entirely true. What I have been doing is thinking about making more posts about functions all in themselves in addition to full-blown lessons.


So, be looking for the "QM Quickling" (QMQ) which will be short synopsis of various functions and how to put them to use. This week's QMQ will be on incorporating 'find' in your code.