Skip to content

Instantly share code, notes, and snippets.

@mlhaufe
mlhaufe / ShellBrowse.vbs
Last active August 19, 2023 19:28
VBScript File Browser
Option Explicit
' Flags for the options parameter
Const BIF_returnonlyfsdirs = &H0001
Const BIF_dontgobelowdomain = &H0002
Const BIF_statustext = &H0004
Const BIF_returnfsancestors = &H0008
Const BIF_editbox = &H0010
Const BIF_validate = &H0020
Const BIF_browseforcomputer = &H1000
@mlhaufe
mlhaufe / parameters.vbs
Created June 19, 2011 12:52
VBScript class constructor parameters
Class Person
Private m_Age
Private m_Name
Public Default Function Init(Name, Age)
m_Name = Name
m_Age = Age
Set Init = Me
End Function
@mlhaufe
mlhaufe / dom.wsf
Last active September 29, 2015 02:08
WSH Quick DOM
<job>
<script language="JScript">
var oDOM = WScript.GetObject("http://www.google.com");
do {
WScript.sleep(200);
} while(oDOM.readyState != "complete")
WScript.echo(oDOM.documentElement.outerHTML)
</script>
@mlhaufe
mlhaufe / rot13.js
Created December 29, 2011 03:57
JavaScript 1.5 cutesy rot13
function rot13(c){
return c.replace(/([a-m])|([n-z])/ig, function($0,$1,$2){
return $1 ? String.fromCharCode($1.charCodeAt(0) + 13) :
$2 ? String.fromCharCode($2.charCodeAt(0) - 13) : $0; });
}
@mlhaufe
mlhaufe / permutation.js
Created December 29, 2011 04:00
JavaScript 1.5 Permutations
var perm = (function(){
function perm(xs, ys, o){
if(ys.length){
for(var i=0,v;(v=xs+ys.charAt(i)),i<ys.length;i++){
o[v] = 1;
perm(v, ys.slice(0,i) + ys.slice(i + 1),o)
}
}
}
return function(ys){
@mlhaufe
mlhaufe / ANTParsing.ps1
Last active November 11, 2016 15:25
PowerShell ANT dependency parsing attempt [Abandoned]
set-psdebug -strict
cd C:\Users\-TNO-\Desktop\batik
$xml = get-content build.xml
$targets = $xml.selectNodes('/project/target')
$buildTargets = [Xml.XmlElement[]]$xml.selectNodes("//target[preceding-sibling::comment()[contains(.,'Build ..')]" +
" and " +
"following-sibling::comment()[contains(.,'Generates maven')]]")
$props = @{'${basedir}' = Get-Item .}
function antcall([Xml.XmlElement]$this,[HashTable]$tg){
@mlhaufe
mlhaufe / htmlTitleList.vbs
Created January 6, 2012 00:48
Getting html details (VBScript)
'Reference: <http://www.visualbasicscript.com/tm.aspx?high=&m=95638&mpage=1>
Option Explicit
Dim fso : Set fso = CreateObject("Scripting.FileSystemObject")
Dim files : Set files = fso.GetFolder("C:\test\").Files
Dim file
For Each file In files
If file.Type = "Firefox Document" Then '<-- update for your system
Dim doc : Set doc = CreateObject("htmlfile")
doc.write fso.OpenTextFile(file.Path).ReadAll()
@mlhaufe
mlhaufe / fileType.js
Created January 6, 2012 05:59
Lookup known filetype (JScript)
//Reference: <https://groups.google.com/group/comp.lang.javascript/browse_thread/thread/684ad16518c837a2/67d00aa5dbe854c2?show_docid=67d00aa5dbe854c2>
var listFileTypes = (function(){
var fso = new ActiveXObject("Scripting.FileSystemObject");
var shell = new ActiveXObject("WScript.Shell");
function isKnown(file){
var fName = file.Name;
//the rules of capitalization are strange in windows...
//there are rare cases where this can fail
//for example: .HKEY_CLASSES_ROOT\.HeartsSave-ms
@mlhaufe
mlhaufe / SendKeys.hta
Created January 9, 2012 01:07
SendKeys + Sleep + VBScript
<!doctype html>
<html>
<!--Reference <http://www.visualbasicscript.com/tm.aspx?high=&m=95682&mpage=1#95682> -->
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Send Keys</title>
<script type="text/vbscript">
Sub Sleep(intTimeWait)
Dim Shell : Set Shell = CreateObject("WScript.Shell")
Shell.Run "%comspec% /c ping.exe 127.0.0.1 -w 1000 -n " & _
@mlhaufe
mlhaufe / SEEK.hta
Created January 11, 2012 01:03
SEEK.hta
<!doctype html>
<html>
<!-- ref: <https://groups.google.com/group/comp.lang.javascript/browse_thread/thread/684ad16518c837a2/fbfd4c2610bc8832?show_docid=fbfd4c2610bc8832> -->
<head>
<meta charset="utf-8" />
<hta:application
applicationname="SEEK"
version="1.0">
<title>SEEK</title>
<style type="text/css">