Welcome, Guest
Please Login or Register.    Lost Password?

Run computer-dependent applications
(1 viewing) (1) Guest
Go to bottomPage: 1
TOPIC: Run computer-dependent applications
*
#191
Run computer-dependent applications 9 Years, 4 Months ago Karma: 2
Hi! I found the scripting option VERY useful! Thanks a lot for your great application and for this powerful feature particularly. I would like to share my example of pre-run VB script. I use it to run different applications/commands on different PCs: Lets say you want to autostart on home PC (lets name it "HOME-PC") App1 and App2, and on office PC ("OFFICE-PC") - AppA and AppB, and App3 on ALL computers.So your script shall look like
Code:

Sub Run(ByVal sFile,sParam) Dim shell Set shell = CreateObject("WScript.Shell") shell.Run Chr(34) & sFile & Chr(34) & sParam, 1, false Set shell = NothingEnd Sub ' Get computer name:Set wshShell = WScript.CreateObject( "WScript.Shell" ) strComputerName = wshShell.ExpandEnvironmentStrings( "%COMPUTERNAME%" )'Run apps on HOME-PC:If strComputerName = "HOME-PC" Then  Run "\Path\to\App1.exe", ""  Run "\Path\to\App2.exe", ""' Run apps on OFFICE-PCElse If strComputerName = "OFFICE- PC" Then  Run "\Path\to\AppA.exe", ""  Run "\Path\to\AppB.exe", "" End IfEnd If'Run Common applications:Run "\Path\to\App3.exe", ""
Do not forget to replace computer names with your real ones and type correct path to your real applications. Enjoy!
The administrator has disabled public write access.
 
#193
Re: Run computer-dependent applications 9 Years, 4 Months ago Karma: 14
Cool example! Thanks for sharing it with usI'd like to mention that %COMPUTERNAME% is environment variable, it is always upper case string. When you change it in your script, please write the name of your computer in UPPERCASE
The administrator has disabled public write access.
 
Go to topPage: 1
Moderators: Eugene, Igor
get the latest posts directly to your desktop