Here I will explain a simple VBScript that I wrote today to make opening of some programs and folders automatic. This problem occured in my work because I needed to open frequently my postgraduate dissertation and some other TeX files and needed to open some folders and other programs fastly when I need. So let’s look at the script:
Dim objShellApp, WshShell
'проверка на уверенность
Set WshShell = CreateObject ("WScript.Shell")
Set objShellApp = CreateObject ("Shell.Application")
a = WshShell.Popup ("Ты уверен(а), что хочешь запустить все нужные программы? =))",,"Подумай!", 4+32)
If a = 7 Then WScript.Quit
WshShell.CurrentDirectory = "C:\Program Files\LEd"
WshShell.CurrentDirectory = "C:\totalcmd"
WshShell.CurrentDirectory = "C:\Documents and Settings\wzbozon\Рабочий стол"
objShellApp.Open("C:\Documents and Settings\wzbozon\Рабочий стол\TeX Books")
WshShell.CurrentDirectory = "C:\Documents and Settings\wzbozon\Рабочий стол\Alwawee\Приложения Alwawee\TexRef"
WshShell.CurrentDirectory = "C:\Program Files\Google\Chrome\Application"
WshShell.CurrentDirectory = "c:\Аспирантура\DIPLOM\"
First of all I should say, that this is a usual text file, called StartAll.vbs, that is edited in NotePad++. It can be edited on usual Notepad also, but I strongly recommend you to use Notepad++.
Here, at first I create 2 objects, that are used to manipulate the file system in Windows Script Host. Then I ask with a popup window if the user is sure to run this script. I do this, because I don’t need to run script, if user or me just press two times on it, because this script makes a lot of things. Then Led.exe program is opened 3 times from a directory, where it is located and then Desktop is toggled. Then I open Total Commander, ImageSaver.exe and TeX Books folder. The rest is analogous. It is noteworthy that Excel and Word files can be opened directly with Run method.