Skip to content

Instantly share code, notes, and snippets.

Alter Table S104 (Add CAB Logical, KST Logical, PLT Logical)
select * from S104 where Adoption_Date <> "" into qNoBlank
select * from qNoBlank where Adoption_Date < CurDate() into qCAB
select * from qNoBlank where Adoption_Date >= CurDate() into qKST1
select * from S104 where Adoption_Date = "" into qBlank
select * from qBlank where Date_Confirmation < CurDate() or dwellings(DWF_Total_m3_per_sec) < 50 into qKST2
select * from qBlank where Date_Confirmation > CurDate() and dwellings(DWF_Total_m3_per_sec) >= 50 into qPLT
def proxy__enwrap(obj)
isClass = obj.is_a?(Class)
oldClass = isClass ? obj : obj.class
sNewClass = "Proxy#{oldClass.to_s}"
code = <<-EOF
class #{sNewClass}
include InstanceProxy
def self.__cinit__(obj)
@@__cobj__ = obj
end
@sancarn
sancarn / .Infoworks-ICM-BetterTreeview.md
Last active May 8, 2018 08:45
A better Powershell treeview for ICM

Test

@sancarn
sancarn / ReturnedErrors.txt
Last active May 5, 2018 19:02
Runs in ISE, Doesn't run in powershell
At C:\Users\sancarn\AppData\Local\Temp\script.ps1:20 char:20
+ $parent = [System.Windows.Forms.TreeNode]$global:database.Ite ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Unable to find type [System.Windows.Forms.TreeNode].
At C:\Users\sancarn\AppData\Local\Temp\script.ps1:27 char:36
+ ... [void]$node.nodes.add([System.Windows.Forms.TreeNode]::new(" ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Unable to find type [System.Windows.Forms.TreeNode].
At C:\Users\sancarn\AppData\Local\Temp\script.ps1:33 char:45
+ ... PSCustomObject]IWDBGetChildren([System.Windows.Forms.TreeNode]$node) ...
@sancarn
sancarn / ActivityWatcher.AHK
Last active August 19, 2024 19:40
Activity Watcher - This application monitors the windows you visit on your computer, and how long you visit them for. It was built due to my frustration with inability to remember what to put on my timesheets.
SetTimer, ActivityWatcher, 150
return
ActivityWatcher:
if !CurrentTitle
{
WinGetTitle, CurrentTitle, A
QPC(1)
}
Time taken: 23.347s (response = 535 model objects, ran immediately after opening Database)
t1 = Time.now
$dbListPaths=""
def walk(moc)
moc.each do |mo|
$dbListPaths += mo.path + "\n"
walk(mo.children)
end
end

Infoworks ICM - Ruby Script Injection

Ever since I found the ruby scripting language been using it to extend existing functionality in ICM. However one thing which has struck me time and time again is the, almost, half-baked method of executing ruby scripts.

There are 4 options to execute a ruby scripts:

  1. Execute them from a ruby addon.
  2. Execute them from the user custom action menu.
  3. Execute them from the shared custom action menu.
  4. Execute them through the "run ruby script" menu item.

Infoworks ICM - AFX and MFC

Ever since I started working with ICM, I have been tasked with automating aspects of it. I started my journey with knowing nothing about ICM, Ruby scripting, or even SQLs for that matter. Initially I automated ICM like I automate most applications, using low-level Windows APIs.

https://www.youtube.com/watch?v=zHVeZP6DQ2Q

I still remember having a conversation with an Innovyze support employee, while I was reporting a 'bug' where a dialog button wasn't being 'clicked' when I used PostMessage, but was only if I used SendMessage... In the end though, it wasn't really a bug, but myself misunderstanding which windows messages are used for which purposes.

Gradually over the years I have built up my knowledge of how ICM works and how to automate each aspect of it. Whether that be autonymously creating, setting up and running sims, finding and performing actions on database model objects, exporting a number of model networks, or using Ruby scripting to perform detailed analysis o

Infoworks ICM - Illusive Macros in SQL

In InfoWorks ICM intermediate users may use SQL queries to automate their workflows. One part of the SQL system in InfoWorks which is fairly misunderstood is the macro system.

To be fair, macros aren't really explained very well in the help file either... The explanation given is as follows:

Macros are variables for representing values within a query. The Macro dialog is displayed when you click on either the button or the button on the User Macros tab on the SQL dialog. Enter a title and value for the macro, then click on OK.

Though this is correct, it is also a bit misleading. In this article I want to go into a little more detail as to what the Macro system actually does, and bounce around some ideas as to how it can be used.

Hello everyone! In this video we will briefly cover the current features of the health and safety database, as well as those currently waiting to be implemented.

When you first launch the viewer you are greeted with a password box. If you enter a password incorrectly you well be prompted and will have to try again. If you don’t know the password then you won’t be able to access any new information from the server.

After entering the password you'll be greeted with the 'search engine'. Here you can type any text and the database will score every record against the text you entered. For example, if I wanted to search for an employee, I can simply type the employees name. To search for a specific department, I can type all or part of the department's name, "Quantity" in this example. To search for all employees who are managed by a particular person, I can type that person's name, in this example "Hamilton". The more the query I enter is mentioned for a specific employee, the higher that employee will rank in