Skip to content

Instantly share code, notes, and snippets.

@jbratu
jbratu / CS_RESOLVE_TABLE_HANDLE_TO_NAME.oibp
Created July 7, 2016 21:16
Function accepts and OpenInsight table handle and resolve the handle back to a table name.
Function CS_RESOLVE_TABLE_HANDLE_TO_NAME(OpenTableHandle)
/*
Given the example:
Open 'SYSLISTS' To OpenTableHandle Else Debug
TableName = CS_RESOLVE_TABLE_HANDLE_TO_NAME(OpenTableHandle)
The Function will return the name of the table From the handle.
*/
If Unassigned(OpenTableHandle) Then Return ''
@jbratu
jbratu / CS_LIST_RDKVIEW_CHANGED.oibp
Created July 11, 2016 00:45
Given the name of an existing RDK View Name it produces a report of the stored procedures and the modified dates. It could be adapted to list out any other entity type too.
Function CS_LIST_RDKVIEW_CHANGED(RDKView)
*Name of the RDK to list in the current repository.
If Unassigned(RDKView) Or RDKView EQ '' Then RDKView = 'TEST_RDK'
$Insert Logical
Declare Subroutine Rlist, Set_Status, Run_Report, Msg
Declare Function Get_Status, Run_Report
Err = ''
@jbratu
jbratu / mailgun_check_bounce.oibp
Created July 23, 2016 01:15
OpenInsight code to check mailgun for bounced email messages.
Function mailgun_check_bounce(params)
/************************************************************************************************
* Name : MAILGUN_CHECK_BOUNCE
*
* Description: Simple example problem to query the MailGun email server to check for if the
* specified email address bounced and get the reason why.
* Program demonstrates the use of WinHTTP COM Object and JSON values.
*
* Example use only. Requires configuration of static variables for example.
* Set CheckAddressBounced, APIKey, APIDomain before use.
@jbratu
jbratu / CS_DETACH_ATTACH_AND_DEFINE_DBT.oibp
Created July 29, 2016 18:53
Given a list of volumes, tables, and applications the routine will detach the existing tables, re-attach them with a different UNC, and then save the DBT file so the tables are available at next OpenInsight launch.
Function CS_DETACH_ATTACH_AND_DEFINE_DBT(void)
/*
Use this routine To change the UNC prefix In the list of Tables
And re-save the DBT file.
*/
*Prefixes to change from and to. Format:
*\\OldServer\,\\NewServer\
ChangePrefixes = ""
ChangePrefixes<-1> = '\\192.168.222.2\,\\OBERLIN\'
@jbratu
jbratu / UpdateRevparamFilesFromUD.vbs
Last active August 3, 2016 17:43
Simple utility for OpenInsight to use the Universal Driver revparam file as a template to update all revparam files found in the path specified. Usage example: cscript UpdateRevparamFilesFromUD.vbs "C:\Revsoft\Universal Driver" "C:\Revsoft\OInsight94"
Set objShell = CreateObject("Wscript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
If WScript.Arguments.Count = 0 OR WScript.Arguments.Count > 2 Then
'Wrong number of arguments. Show help and exit
WScript.Echo "Update revparam files. Use the revparam file in the source folder and update all found in destination path"
WScript.echo "Example: cscript.exe UpdateRevparamFilesFromUD.vbs ""C:\Revsoft\Universal Driver"" ""C:\Revsoft\OInsight94Eval"""
WScript.quit
End If
@jbratu
jbratu / PARSE_CSV_ROW.oibp
Created August 30, 2016 12:04
Given a CSV row with double quotes, commas in fields, and double quoted escaped fields, parse it into a FM delimited field.
Function PARSE_CSV_ROW(Row)
/*
Usage examples were row is:
80685,"56945","UNIQUE","PARCEL RETURN SERVICE","DC","PRIMARY",38.89,-77.03,0.17,-0.75,0.62,"NA","US","Parcel Return Service, DC","NA-US-DC-PARCEL RETURN SERVICE","false",,,,"no NWS data, "
80712,"02239","UNIQUE","COM/ENERGY SERVICES","MA","ACCEPTABLE",42.36,-71.10,0.23,-0.69,0.67,"NA","US","Com/energy Services, MA","NA-US-MA-COM/ENERGY SERVICES","true",,,,"Converted Decommisioned Zipcodes"
456,"Some ""Special"" field",another with no quotes
*/
$Insert Logical
*Ensure the loop variable i isn't already in use from a parent loop
If Unassigned(i) Then Else If i NE '' Then debug
For i = 1 To ControlsCOunt
*Loop processing here
Next ; i = '' ;* Reset i for another loop
Val = "Hello World"
ValEnc = ICONV(Val, "[URL_FORMAT]")
@jbratu
jbratu / CS_LAUNCH_FILE_SNIPPET.oibp
Last active September 13, 2016 15:47
OpenInsight sample snippet to show how any recognized file on the system can be opened by the file extension's registered application.
Function CS_LAUNCH_FILE_SNIPPET(void)
*Common to hold our control between runs so it isn't re-initialized on each call
common /wscript_launch_control/ wsLauncher, wsLauncherAssigned
If Assigned(wsLauncherAssigned) Else wsLauncherAssigned = ''
If wsLauncherAssigned Else
*Control not initialized, do it now
@jbratu
jbratu / powershelldayofweek.oibp
Created October 10, 2016 03:01
Using PowerShell from OpenInsight to Determine Day of Week. Basic+ snippet that returns the day of the week for a particular date using the .NET library. Given a date like '10/07/2016' the code will return 'Friday'
Param1 = '10/07/2016' ;* Date to find the day of week name.
*The powershell command to run.
S = 'Write-Host (get-date "%%PARAM%%").DayOfWeek'
*Swap the parameter place holder with the date
Swap '%%PARAM%%' With Param1 In S
*Build the command to run
Cmd = "PowerShell.exe -c ": S