unit testing vbscript functions

Submitted by reesd on 2012/05/24 11:12
As a developer I can't stand not having unit tests. With IQ this actually becomes more important since think often silently fail and I personally can't get the debugger working. So I have been using a simple test approach with asserts to test my functions.
 
The idea is pretty simple. Whenever I write a function (e.g. MyFunc) I also write a test for it (e.g. MyFunc_Test). You can then run test function using the "Execute A Function" button.
 
I have the test function call my asserts. Here is the assert code I am using. If you are using a debugger that will give you a stacktrace you can uncomment the Err.Raise to go right to the problem. I often copy all my VBScript to a Excel VB Module to test it there for that reason.
 

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''' Testing Code

null=0 checkbox is missing

Submitted by reesd on 2012/05/23 13:19
I can't seem to find the "null=0" checkbox in 0.9.25W10. Here is what I am seeing. I have put equations in all the fields just to see if I can get it to show up (I recall that it used to be hidden unless there were values for a while). From what I can tell its defaulting to null=0 being enabled which is keeping me from checking for blank fields vs perfectly valid fields with a zero in them.
 
 
 
And here is what I think I should be seeing:
 
 
 
d
 
d

logging from VBScript functions

Submitted by reesd on 2012/05/23 12:51
I just figured out that its possible to log from VBScript functions. This can be super helpful for debugging and figuring out why things are not working, especially until I finally figure out how to use a script debugger (see How to do VBScript function debugging).
 
The function at http://www.naterice.com/articles/43 (written by someone else) works fine for me. The one thing I changed was I set the log directory explicitly by changing these two lines:
sLogFileLocation = "C:"
'sLogFileLocation = "relative"
 
d

Using AutoHotKey with InfoQube

Submitted by reesd on 2012/05/23 11:06
Hi Armando,
 
You've mentioned a few times you use AutoHotKey with InfoQube. Could you give some basic info on how you are using it?
 
The few times I have tried to use it with IQ I have run into weird pasting problems. That said I would love to use it to create keyboard shortcuts for a few things like the following if folks have ideas on how to do it. Here are my thoughts so far.
 
change source filter (enter text in source filter)
I think is probably the easiest one since the textbox has a specific ClassNN (Edit2).
 
 
check a value in a particular column (like mark done)
enter value in a particular column (would use to set priority, category, etc)
These seem trickier since the grid control is opaque.

Natara Bonsai export template for InfoQube

Submitted by reesd on 2012/05/23 10:37
I've written a Natara Bonsai export template to InfoQube. It's at https://gist.github.com/2775504.
 
Not sure if anyone else is using Bonsai, but its really the best outline for filtering outside of InfoQube/EccoPro I have found on Windows. And it actually does true full outline filtering unlike InfoQube (see "Context Parents" only shows the first parent.). Its biggest weakness is it doesn't do custom fields/columns which is why I have been wanting to try IQ instead. It also doesn't do recurrence, but I have a XSL script/hack I wrote for that. You can get more info at http://www.natara.com/Bonsai/index.cfm. That said, I am hoping to make the switch to InfoQube, warts and all.
 
The export template generates an XML file that can be pasted into InfoQube.

How do I remove a file from item's HTML pane?

Submitted by Tom on 2012/05/23 07:23
 
I've added a PDF to the wrong item's HTML pane, so I want to remove it. I cant figure out how - - help?
 
I know I've had this problem before but never figured it out I dont think (or else I've forgotten).
It doesnt seem to be intuitive at any rate (or else I'm having one of those days...)
 
_______________________________________________________
Win.7 64bit  ~  IQ 0.9.25W10 portable
 
 

How to use today's date in a conditional format

Submitted by reesd on 2012/05/22 19:05
I would like to have a date field be red if its past today's date, but I'm not sure how to do it in a conditional formatting expression. I've looked at the IQ doc (node:219) and the control's doc (http://www.exontrol.com/content/products/exg2antt/help/ConditionalForma…) but can't find the solution.
 
I've tried variations like the following without success:
 
DueDate > Today()
int(DueDate) > int(Today())

Anyone have an idea? Keep in mind this is for conditional format expressions, not equations or the source bar (each of which have their own different rules :).
 
Thanks,
d