Skip to content

Instantly share code, notes, and snippets.

@simply-coded
simply-coded / SendGmail.vbs
Last active March 21, 2024 01:36
Send an email with vbscript using gmail.
'***********************
'Name: Email Messages
'Author: Jeremy England
'Company: SimplyCoded
'Version: rev.001
'Date: 1/02/2015
'***********************
Option Explicit
Dim objFSO : Set objFSO = CreateObject("Scripting.FileSystemObject")
Dim objSHL : Set objSHL = CreateObject("WScript.Shell")
@simply-coded
simply-coded / MsgBox.hta
Last active December 10, 2023 01:51
VBScript MsgBox clone using HTA. Allows you to customize the buttons, look and style, unlike the default VBScript MsgBox.
<!DOCTYPE html>
<html>
<head>
<title>Message Box</title>
<meta http-equiv="x-ua-compatible" content="IE=9">
<meta name="author" content="Jeremy England">
<meta name="copyright" content="SimplyCoded">
<meta name="last-modified" content="2015-11-10">
<hta:application
border="thin"
@simply-coded
simply-coded / Window.vbs
Last active September 30, 2023 15:49
Create custom windows with VBScript by running HTML code through MSHTA.
Class Window
'@description: Create a custom window with MSHTA.
'@author: Jeremy England (SimplyCoded).
Private title, style, body, options, width, height, xpos, ypos
Private Sub Class_Initialize()
title = "&nbsp;" : width = 350 : height = 250
xpos = "(screen.width - " & width & ")/2"
ypos = "(screen.height -" & height & ")/2"
style = "html{display:table;}body{display:table-cell;font-family:Arial;background-color:#f6f6f6;}html,body{width:100%;height:100%;margin:0;}"
End Sub
@simply-coded
simply-coded / MultilineFormatter.vbs
Last active June 2, 2023 13:02
Converts your clipboard data into a multiline string made for vbscript. Makes it easy to create other coding files within your vbscript file. Video demo available on YouTube.
'***********************
'Name: String Formatter
'Author: Jeremy England
'Company: SimplyCoded
'Version: rev.001
'Date: 04/08/2016
'***********************
Option Explicit
Dim htm : Set htm = CreateObject("htmlfile")
@simply-coded
simply-coded / Disable_Wi-Fi.vbs
Last active May 17, 2023 04:32
Use VBScript to enable, disable, or toggle a connection like your Wi-Fi on and off.
'************************
'Name: Disable Connection
'Author: Jeremy England
'Company: SimplyCoded
'Date: 10/01/2016
'************************
Option Explicit
Dim interface, interfaceName, interfaceTarget, available, verb
'Pick the Interface Name you want to disable
@simply-coded
simply-coded / RunAsAdmin.md
Last active May 4, 2023 21:39
Run the current VBScript file as an administrator.
@simply-coded
simply-coded / ClipBoardText.vbs
Last active February 7, 2023 22:10
Set, get, append, and clear your clipboard text.
Class ClipBoardText
REM @author: Jeremy England ( SimplyCoded )
REM @info: Set, get, append, and clear your clipboard text.
REM @mini: Class ClipBoardText:Property Get Text:Text=CreateObject("HTMLFile").parentWindow.clipboardData.getData("Text"):If IsNull(Text)Then Text="":End If:End Property:Property Let Text(s):CreateObject("WScript.Shell").Run "mshta.exe javascript:eval(""document.parentWindow.clipboardData.setData('text','"&Replace(Replace(s,"'","\\u0027"),"""","\\u0022")&"');close()"")",0,True:End Property:Sub ClearText:Text="":End Sub:Sub AddText(s):Text=Text&s:End Sub:End Class
Property Get Text
Text = CreateObject( "HTMLFile" ).parentWindow.clipboardData.getData( "Text" )
If IsNull( Text )Then Text = ""
End Property
Property Let Text( str )
@simply-coded
simply-coded / ArrayList.vbs
Created May 31, 2017 20:55
Use lists in VBScript.
'create an arraylist
Set list = CreateObject("System.Collections.ArrayList")
'add values
list.add "mike"
list.add "jeremy"
list.add "kate"
list.add "alice"
'add a bunch of values easily via custom sub
@simply-coded
simply-coded / MsgStack.vbs
Last active October 3, 2022 19:42
Create multiple msgbox popups without waiting for a return value to continue.
Option Explicit
Dim fso : Set fso = CreateObject("Scripting.FileSystemObject")
Dim wsh : Set wsh = CreateObject("Wscript.Shell")
Dim args : Set args = WScript.Arguments
Dim this : this = WScript.ScriptFullName
Dim id, ans
'create message boxes
If args.count = 0 Then
@simply-coded
simply-coded / CreateExcelFile.vbs
Last active August 3, 2022 08:40
Use VBScript to create, open, and edit excel files. ( Excel needs to be installed on your computer ).
'Microsoft Excel Automation Basics
':: Create and edit an Excel File.
'---------------------------------
'create the excel object
Set objExcel = CreateObject("Excel.Application")
'view the excel program and file, set to false to hide the whole process
objExcel.Visible = True