Skip to content

Instantly share code, notes, and snippets.

@pewerner
pewerner / Optimizer.cs
Created October 14, 2014 17:18
Class for optimizing input files based on volume
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Linq;
using System.Text;
using System.IO;
namespace InputFileOptimizer
@pewerner
pewerner / batchfile.py
Created June 13, 2014 11:50
Launch a Batch File with IronPYthon
from System.Diagnostics import Process
p = Process()
p.StartInfo.UseShellExecute = False
p.StartInfo.RedirectStandardOutput = False
p.StartInfo.FileName = r"C:\test.bat"
p.Start()
p.WaitForExit()
print(p.ExitCode)
var indent_level = 0
function indent()
{
var spaces = ""
for( var i=0; i<indent_level; ++i)
spaces = spaces + " "
return spaces
}
@pewerner
pewerner / FileUtilities.cs
Last active August 29, 2015 14:02
Parse Spectramax reader data in python
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace FileUtilities
{
public class FileUtilities
{
@pewerner
pewerner / readerdata.js
Created May 28, 2014 15:09
Parse Reader data from spectramax and rewrite it to a work list
// JScript source code
open("C:\\VWorks Workspace\\Scripts\\file_operations.js")
//--Change this directory to be the directory that VWorks generates the output file too
var output_directory = "C:\\VWorks Workspace\\Scripts\\readerdata\\output\\"
//--Date Time Stamp Generating functions-------------
@pewerner
pewerner / form.py
Created November 6, 2013 11:34
Simple IronPython WInForm
import clr
clr.AddReference('System.Windows.Forms')
clr.AddReference('System.Drawing')
from System.Windows.Forms import *
from System.Drawing import *
class MyForm(Form):
@pewerner
pewerner / globaltest.py
Created February 18, 2013 12:17
Accessing Static Variiables in an IronPython Class in seperate file
class GlobalTest():
def __init__(self):
pass
global globalTestVariable
globalTestVariable = "My Old Value"
@pewerner
pewerner / Form.py
Created December 20, 2012 22:01
Web request to a "rest" API
#This Code is launched from the Controller Software it requires the class in the file below
import clr
import sys
#append the sys path to the directory that contains your python scripts
sys.path.append("C:\\Program Files\\Agilent Technologies\\pyScripts")
import db
@pewerner
pewerner / MSAcess.js
Created December 14, 2012 12:08
Query MS-Access Data-base from JS.
function AddRecord() {
//var adoConn = new ActiveXObject("ADODB.Connection");
var adoConn = new ActiveX("ADODB.Connection");
//var adoRS = new ActiveXObject("ADODB.Recordset");
var adoRS = new ActiveX("ADODB.Recordset");
adoConn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source='/\dbName.mdb'");
adoRS.Open("Select * From tblName", adoConn, 1, 3);
adoRS.AddNew;
@pewerner
pewerner / http.js
Created December 9, 2012 15:01
Http Request JavaScript
var http_request = new ActiveX("Msxml2.XMLHTTP");
var url = "http://localhost:3000/users/2.json"
http_request.open( "GET", url, true );
http_request.send(null);