MSFN Forum: VBS Scripts - MSFN Forum

Jump to content



  • 4 Pages +
  • 1
  • 2
  • 3
  • 4
  • You cannot start a new topic
  • You cannot reply to this topic

VBS Scripts For all the programs you need :D Rate Topic: -----

#21 User is offline   visaversa 

  • Face it...
  • PipPipPip
  • Group: Members
  • Posts: 428
  • Joined: 14-October 03

Posted 20 October 2003 - 12:10 PM

ahmedramzi

Unlike Acrobat Reader prior to version 6, this new release does not use InstallShield's PackageForTheWeb. Instead, it uses something called the "Netopsystems FEAD optimizer", whose command-line switches are documented nowhere.

However, Adobe provides silent installation instructions in their knowledgebase articles 53446 and 53495. Viewing these requires registering for an account with the "Adobe Solutions Network"; how annoying. Briefly, the magic invocation is:

AdbeRdr60_enu_full.exe -p"-s /v\"/qn\""

Alternatively, you can get hold of the MSI file with a quick hack. If you start the installer and wait for it to finish extracting files, you will find it creates a folder named %SystemRoot%\cache\Adobe Reader 6.0\BIGENU. (SystemRoot is normally C:\WINNT or C:\WINDOWS.)

This folder contains the complete uncompressed tree, including an MSI file named Adobe Reader 6.0.msi. So just copy the BIGENU folder to, say, Z:\packages\AdobeReader60, and you can perform unattended installations like any other MSI package:

msiexec /qb /i "z:\packages\AdobeReader60\Adobe Reader 6.0.msi"

I know this is for Reader 6, but lets try it for the writer sorry
Let me know

:) W


#22 User is offline   DarkBringer 

  • Member
  • PipPip
  • Group: Members
  • Posts: 216
  • Joined: 06-August 03

Posted 21 October 2003 - 05:27 AM

PM sent for Spysweeper, Westi.

Still can't download Webshots.

#23 User is offline   Westi 

  • Junior
  • Pip
  • Group: Members
  • Posts: 61
  • Joined: 23-September 03

Posted 21 October 2003 - 07:42 AM

Quote

PM sent for Spysweeper, Westi.
Still can't download Webshots.


I've the same problem with your file !?
Check your PM !

#24 User is offline   XtremeMaC 

  • MSFN SuperB
  • PipPipPipPipPipPipPipPipPipPip
  • Group: Members
  • Posts: 5,070
  • Joined: 13-October 03

Posted 24 October 2003 - 03:11 PM

hey does anyone know how to use two send keys in one
what I mean :

{SHIFT} & {TAB} at the same time ? how do we do this?
i've failed my previous attempts! :)

#25 User is offline   ahmedramzi 

  • Member
  • PipPip
  • Group: Members
  • Posts: 258
  • Joined: 08-June 03

Posted 24 October 2003 - 06:33 PM

visaversa
unfortunately I'm trying to install Acrobat writer, not reader..
thanks anyway for your post

#26 User is offline   DarkBringer 

  • Member
  • PipPip
  • Group: Members
  • Posts: 216
  • Joined: 06-August 03

Posted 26 October 2003 - 03:35 AM

Sorry I took so long to get back to you, Westi. But when I tried installing Webshots for the first time, I got errors like crazy. Then when you sent the correction I was like, "YES!!"

The whole thing took about 10 seconds to install. I haven't tried Spysweeper yet, though. I'll send you a PM when I do. I am so indebted to you.

#27 User is offline   Westi 

  • Junior
  • Pip
  • Group: Members
  • Posts: 61
  • Joined: 23-September 03

Posted 26 October 2003 - 12:09 PM

Quote

hey does anyone know how to use two send keys in one
what I mean :
{SHIFT} & {TAB} at the same time ? how do we do this?
i've failed my previous attempts!


Sendkeys "+{TAB}"
-SHIFT TAB

Sendkeys "+"
-SHIFT

Sendkeys "^"
-CTRL

Sendkeys "%"
-ALT

Sendkeys "+(ec)"
-SHIFT EC

Sendkeys "+ec"
-SHIFT E and normal c

If you need the normal value, insert it in {}:
"{+}" is +

All special keys:
{BACKSPACE} or {BS} or {BKSP}, {BREAK},{CAPSLOCK},{DELETE} or {DEL}
{DOWN},{UP},{END},{ENTER} or ~,{ESC},{HELP},{HOME},{INSERT} or {INS}
{LEFT},{RIGHT},{NUMLOCK},{PGDN},{PGUP},{PRTSC},{SCROLLLOCK},{TAB}
{F1}..... {F16}

CTRL/ALT/DEL and special window keys not implemented !

#28 User is offline   XtremeMaC 

  • MSFN SuperB
  • PipPipPipPipPipPipPipPipPipPip
  • Group: Members
  • Posts: 5,070
  • Joined: 13-October 03

Posted 26 October 2003 - 12:33 PM

thanks westi! exactly what I was looking for

#29 User is offline   Westi 

  • Junior
  • Pip
  • Group: Members
  • Posts: 61
  • Joined: 23-September 03

Posted 28 October 2003 - 05:06 PM

Check for the right drive and name, Version 2 :
Dim fso, objDrive, s, InstCD
Set WshShell = WScript.CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
For Each objDrive In fso.Drives
If objDrive.IsReady Then 
If objDrive.DriveType = 4 And objDrive.VolumeName = "xxx-Your CD name-xxx" Then s = objDrive.DriveLetter & ":\"
End If
Next
'Write it to all keys in the registry
WshShell.RegWrite "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\CDROM",s ,"REG_SZ"
WshShell.RegWrite "HKCU\Environment\CDROM", s, "REG_SZ"
WshShell.RegWrite "HKU\.Default\Environment\CDROM", s, "REG_SZ"
'Get the value in another script
InstCD = WshShell.ExpandEnvironmentStrings("%CDROM%")

Wscript.Quit

My first version fails if a drive isn't ready :)


#30 User is offline   aitf311 

  • Newbie
  • Group: Members
  • Posts: 37
  • Joined: 21-October 03

Posted 29 October 2003 - 12:40 PM

I know this is a complete noob question, but how do I run a vbs file from a cmd? For example the winamp.vbs file...

#31 User is offline   Westi 

  • Junior
  • Pip
  • Group: Members
  • Posts: 61
  • Joined: 23-September 03

Posted 29 October 2003 - 02:06 PM

Quote

but how do I run a vbs file from a cmd?

Just call it, or use "CScript myscript.vbs //B //NoLogo"
You get more options at the console window with "cscript /?".

#32 User is offline   prathapml 

  • Follow the rules please :-)
  • Group: Patrons
  • Posts: 6,791
  • Joined: 14-November 03
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 18 November 2003 - 10:06 AM

I have a vbscript to enable ICF automatically, but wscript asks for confirmation. i tried cscript <any.vbs> //B to do it silently, but still it asks "Yes/No".

This is it:


OPTION EXPLICIT

DIM ICSSC_DEFAULT, CONNECTION_PUBLIC, CONNECTION_PRIVATE, CONNECTION_ALL
DIM NetSharingManager
DIM PublicConnection, PrivateConnection
DIM EveryConnectionCollection

DIM objArgs
DIM con 

ICSSC_DEFAULT         = 0
CONNECTION_PUBLIC     = 0
CONNECTION_PRIVATE    = 1
CONNECTION_ALL        = 2

Main( )

sub Main( )
   if Initialize() = TRUE then    
       GetConnectionObjects()
       FirewallTestByName(con)
   end if
end sub


sub FirewallTestByName(conName)
on error resume next
   DIM Item
   DIM EveryConnection
   DIM objNCProps
   DIM szMsg
   DIM bFound
   bFound = false        
   for each Item in EveryConnectionCollection
       set EveryConnection = NetSharingManager.INetSharingConfigurationForINetConnection(Item)
       set objNCProps = NetSharingManager.NetConnectionProps(Item)
       bFound = true
       EveryConnection.EnableInternetFirewall
   next
end sub

function Initialize()
   DIM bReturn
   bReturn = FALSE
   set NetSharingManager = Wscript.CreateObject("HNetCfg.HNetShare.1")
   if (IsObject(NetSharingManager)) = FALSE then
       Wscript.Echo("Unable to get the HNetCfg.HnetShare.1 object")
   else
       if (IsNull(NetSharingManager.SharingInstalled) = TRUE) then
           Wscript.Echo("Sharing isn't available on this platform.")
       else
           bReturn = TRUE
       end if
   end if
   Initialize = bReturn
end function

function GetConnectionObjects()
   DIM bReturn
   DIM Item
   
   bReturn = TRUE
   
   if GetConnection(CONNECTION_PUBLIC) = FALSE then
       bReturn = FALSE
   end if
   
   if GetConnection(CONNECTION_PRIVATE) = FALSE then
       bReturn = FALSE
   end if
   
   if GetConnection(CONNECTION_ALL) = FALSE then
       bReturn = FALSE
   end if
   
   GetConnectionObjects = bReturn     
    
end function


function GetConnection(CONNECTION_TYPE)
   DIM bReturn     
   DIM Connection
   DIM Item
   bReturn = TRUE
   
   if (CONNECTION_PUBLIC = CONNECTION_TYPE) then
       set Connection = NetSharingManager.EnumPublicConnections(ICSSC_DEFAULT)
       if (Connection.Count > 0) and (Connection.Count < 2) then
           for each Item in Connection
               set PublicConnection = NetSharingManager.INetSharingConfigurationForINetConnection(Item)
           next          
       else
           bReturn = FALSE
       end if
   elseif (CONNECTION_PRIVATE = CONNECTION_TYPE) then
       set Connection = NetSharingManager.EnumPrivateConnections(ICSSC_DEFAULT)
       if (Connection.Count > 0) and (Connection.Count < 2) then
           for each Item in Connection
               set PrivateConnection = NetSharingManager.INetSharingConfigurationForINetConnection(Item)
           next
       else
           bReturn = FALSE
       end if
   elseif (CONNECTION_ALL = CONNECTION_TYPE) then
       set Connection = NetSharingManager.EnumEveryConnection
       if (Connection.Count > 0) then
           set EveryConnectionCollection = Connection
       else
           bReturn = FALSE
       end if
   else
       bReturn = FALSE
   end if
   
   if (TRUE = bReturn)  then
   
       if (Connection.Count = 0) then
           Wscript.Echo("No " + CStr(ConvertConnectionTypeToString(CONNECTION_TYPE)) + " connections exist (Connection.Count gave us 0)")
           bReturn = FALSE
       elseif (Connection.Count > 1) and (CONNECTION_ALL <> CONNECTION_TYPE) then          
           Wscript.Echo("ERROR: There was more than one " + ConvertConnectionTypeToString(CONNECTION_TYPE) + " connection (" + CStr(Connection.Count) + ")")
           bReturn = FALSE               
       end if
   end if
   GetConnection = bReturn
end function

function ConvertConnectionTypeToString(ConnectionID)
   DIM ConnectionString
   
   if (ConnectionID = CONNECTION_PUBLIC) then
       ConnectionString = "public"
   elseif (ConnectionID = CONNECTION_PRIVATE) then
       ConnectionString = "private"
   elseif (ConnectionID = CONNECTION_ALL) then
       ConnectionString = "all"
   else
       ConnectionString = "Unknown: " + CStr(ConnectionID)
   end if
   
   ConvertConnectionTypeToString = ConnectionString
end function


I think windows doesn't allow auto-changing of network settings. If so, what can i do to have the above VBS run silently.

Thanks.
prathapml

#33 User is offline   IcemanND 

  • MSFN Junkie
  • Group: Super Moderator
  • Posts: 3,239
  • Joined: 24-September 03
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 18 November 2003 - 10:38 AM

Hmm...looks familiar.

Windows doesn't like it being changed by script. So it asks to make sure you want to do it. The only way I know to do it is to create another script to run this one that waits for the prompt to come up and clicks the button for you.

#34 User is offline   prathapml 

  • Follow the rules please :-)
  • Group: Patrons
  • Posts: 6,791
  • Joined: 14-November 03
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 22 November 2003 - 11:25 PM

Iceman, i had in fact got the above ICF-enable script from you.

would you mind telling me (or posting the auto-click) script too ?

#35 User is offline   IcemanND 

  • MSFN Junkie
  • Group: Super Moderator
  • Posts: 3,239
  • Joined: 24-September 03
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 24 November 2003 - 08:12 AM

I would if i had managed to figure it out. still working on it.

#36 User is offline   hyp3r 

  • Group: Members
  • Posts: 2
  • Joined: 11-December 03

  Posted 11 December 2003 - 10:27 AM

Well boys and girls, I know this isn't related to unattended set-ups but you may be able to help me.

I've got the below script which is not working 100% accurately. On the line it defines the target path (MyShortcut.TargetPath = .......) there's a section which goes .... & Chr(47) & "wrkgrp" ..... now Chr(47) is a /, why oh why is it appearing as a \ when the shortcut is built? Is windows in all it's "wisdom" auto-converting the character because thinks I've made a mistake?

(for all you out there who don't know much about access - I need that to be a "/" :)

What is going on folks? How can I force windows to accept that as a /?

Dim WSHNetwork, fso, WSHShell, MyShortcut, StartMenuPath, intDrive, strDrive, DriveFlag, AppDrive, Quote, Workgroup

Set fso = CreateObject("Scripting.FileSystemObject")
intDrive = 9 'This refers to the alphabet (9=I, 10=J etc)
DriveFlag = False

Do
strDrive = Chr(intDrive + 64) & ":"
    If fso.folderexists(strDrive & "\IBOS") Then
	msgbox strDrive
  Call IdentifyAppsDrive
	DriveFlag = True
    Elseif intDrive = 27 then
	msgbox "The VBScript can not locate your Chase Shared Drive" & vbnewline & _ 
  vbnewline & "Please contact the BIT Team"
	DriveFlag = True
    Else
	intDrive = intDrive + 1
    End If
Loop Until DriveFlag = True

'*******************************************************************

Sub IdentifyAppsDrive()

intDrive = 1 'This refers to the alphabet (1=A, 2=B etc)
DriveFlag = False

Do
AppDrive = Chr(intDrive + 64) & ":"
    If fso.fileexists(AppDrive & "\W32APPS\MSOffice.97\Office\msaccess.exe") Then
	AppDrive = Appdrive & "\W32APPS\MSOffice.97\Office\msaccess.exe"
	Msgbox Appdrive
  Call MakeShortcut
	DriveFlag = True
    Elseif fso.fileexists(AppDrive & "\Program Files\Microsoft Office\Office\msaccess.exe") Then
	AppDrive = Appdrive & "\Program Files\Microsoft Office\Office\msaccess.exe"
	msgbox appdrive
	Call MakeShortcut
	DriveFlag = True
    Elseif intDrive = 27 then
	msgbox "The VBScript can not locate your app's drive" & vbnewline & _ 
  vbnewline & "Please contact the BIT Team"
	DriveFlag = True
    Else
	intDrive = intDrive + 1
    End If
Loop Until DriveFlag = True

End Sub

'*******************************************************************
Sub MakeShortcut()
Set WSHShell = WScript.CreateObject("WScript.Shell")
Quote = Chr(34)
WorkGroup = Chr(47) & "wrkgrp"

' Read desktop path using WshSpecialFolders object
StartMenuPath = WSHShell.SpecialFolders("StartMenu") 

if fso.fileexists(StartMenuPath & "\Overtime.lnk") then
	fso.deletefile(StartMenuPath & "\Overtime.lnk")
end if	

' Create a shortcut object on the desktop
Set MyShortcut = WSHShell.CreateShortcut(StartMenuPath & "\Overtime.lnk")

' Set shortcut object properties and save it
MyShortcut.TargetPath = WSHShell.ExpandEnvironmentStrings(AppDrive & Quote & " " & Quote & strDrive & "\IBOS\Overtime\Secure Overtime.mdb" & Quote & " " & Chr(47) & "wrkgrp" & " " & Quote & strDrive & "\IBOS\Overtime\eobot.mdw")
MyShortcut.WorkingDirectory = WSHShell.ExpandEnvironmentStrings(strDrive & "\IBOS\Overtime")
MyShortcut.WindowStyle = 4
MyShortcut.IconLocation = WSHShell.ExpandEnvironmentStrings(strDrive & "\IBOS\Overtime\bit.ico, 0")
MyShortcut.Save

WScript.Echo "A shortcut to the Overtime database now exists on your Start Menu."

End Sub


#37 User is offline   Lost Soul 

  • Snap ... Crackle ... Pop
  • PipPipPipPipPipPipPip
  • Group: Members
  • Posts: 1,746
  • Joined: 12-December 03

Posted 29 December 2003 - 03:36 PM

how do you set up a vbscript so that your actually able to use it meaning having it work to instal the program ?
how do you call it ?
and where does the program fit into it all ?

#38 User is offline   robmb008 

  • Group: Members
  • Posts: 8
  • Joined: 10-January 04

Posted 10 January 2004 - 01:16 AM

Here are a few of my vbs scripts that I have developed for my 1st unattended install:

Foobar2000 0.75 special edition
-full installation
-start menu shortcuts placed in Programs\media\foobar2000
-all available media file extensions associated with foobar2000
Set WshShell = WScript.CreateObject("WScript.Shell")
On Error Resume Next

WshShell.Run ("%systemdrive%\install\Applications\Foobar\foobar075_special.exe")
WScript.Sleep 1000

WshShell.SendKeys "%N"
WScript.Sleep 400

WshShell.SendKeys "%A"
WScript.Sleep 400

WshShell.SendKeys "{TAB 2}"
WScript.Sleep 400

WshShell.SendKeys "F"
WScript.Sleep 400

WshShell.SendKeys "%N"
WScript.Sleep 400

WshShell.SendKeys "%N"
WScript.Sleep 400

WshShell.SendKeys "{TAB 2}"
WScript.Sleep 400

WshShell.SendKeys "media\foobar2000"
WScript.Sleep 400

WshShell.SendKeys "%I"
WScript.Sleep 10 * 1000

WshShell.SendKeys "{TAB 2}"
WScript.Sleep 400

WshShell.SendKeys "A"
WScript.Sleep 400

WshShell.SendKeys "{TAB 2}"
WScript.Sleep 400

WshShell.SendKeys "{ENTER}"
WScript.Sleep 6000

WshShell.SendKeys " "
WScript.Sleep 400

WshShell.SendKeys "%F"
WScript.Sleep 400

Wscript.Quit



Mozilla Firebird 0.7
-only the QuickLaunch icon added
Set WshShell = WScript.CreateObject("WScript.Shell")
On Error Resume Next

WshShell.Run ("%systemdrive%\install\Applications\Firebird\MozillaFirebird-0.7-setup.exe")
WScript.Sleep 1000

WshShell.SendKeys "%N"
WScript.Sleep 400

WshShell.SendKeys "{TAB 2}"
WScript.Sleep 400

WshShell.SendKeys "{DOWN 3}"
WScript.Sleep 400

WshShell.SendKeys " "
WScript.Sleep 400

WshShell.SendKeys "{DOWN}"
WScript.Sleep 400

WshShell.SendKeys " "
WScript.Sleep 400

WshShell.SendKeys "%N"
WScript.Sleep 400

WshShell.SendKeys "%I"
WScript.Sleep 10 * 1000

WshShell.SendKeys "%R"
WScript.Sleep 400

WshShell.SendKeys "%F"
WScript.Sleep 400

Wscript.Quit



enjoy...

#39 User is offline   WannaXP 

  • Group: Members
  • Posts: 6
  • Joined: 31-October 03

Posted 30 January 2004 - 11:26 AM

hyp3r, on Dec 11 2003, 10:27 AM, said:

Well boys and girls, I know this isn't related to unattended set-ups but you may be able to help me.

I've got the below script which is not working 100% accurately. On the line it defines the target path (MyShortcut.TargetPath = .......) there's a section which goes ....  & Chr(47) & "wrkgrp" .....  now Chr(47) is a /, why oh why is it appearing as a \ when the shortcut is built? Is windows in all it's "wisdom" auto-converting the character because thinks I've made a mistake?

@hyp3r

I don't know if you still need this info, but I'll post this anyway just in case someone might find it useful.

When creating a shortcut using VBS you use the Object.TargetPath property for the executable and Object.Arguments for anything you wish to have entered after your executable. Here's a link to MS's WSH doc: WSH Documentation (as of 1/30/04).

Also, if I'm reading your script correctly WSHShell.ExpandEnvironmentStrings isn't really doing anything. According to MS's WSH documentation this is used to retrieve (or expand as MS puts it) environment variables. Also, it'll only return variables within the PROCESS environment space only.

Given the two points above, your line:
MyShortcut.TargetPath = WSHShell.ExpandEnvironmentStrings(AppDrive & Quote & " " & Quote & strDrive & "\IBOS\Overtime\Secure Overtime.mdb" & Quote & " " & Chr(47) & "wrkgrp" & " " & Quote & strDrive & "\IBOS\Overtime\eobot.mdw")


Should be split into two lines:
MyShortcut.TargetPath = AppDrive & """ """ & strDrive & "\IBOS\Overtime\Secure Overtime.mdb"
MyShortcut.Arguments = "/wrkgrp" & " """ & strDrive & "\IBOS\Overtime\eobot.mdw"""


I also removed your Quote variable and replaced it with double quotation marks. Easier read if you ask me. I tried to find the doc that discusses using multiple quotation marks, but couldn't find it.

I'm not exactly sure what your AppDrive & Quote & " " & Quote & strDrive & ... etc... is doing. I'm not an Access person, but the resulting "Target" isn't anything I've ever seen:
"X:\Y:" "Y:\IBOS\Overtime\Secure Overtime.mdb" /wrkgrp "Y:\IBOS\Overtime\eobot.mdw"


Shouldn't this read somthing like:
"Y:\IBOS\Overtime\Secure Overtime.mdb" /wrkgrp "Y:\IBOS\Overtime\eobot.mdw"




Hope this helps!
Nate

#40 User is offline   Shotgun 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 462
  • Joined: 07-November 03

Posted 16 February 2004 - 09:18 PM

I'm in need of a VBS script to automate the install of UltraZip. (www.ultrazip.com). It's an InnoSetup file, but when I try to install it unattended, the readme file pops in screen, and the UltraZip program is started. It is a nuisance to have windows pop up even when using silent install switches. Can anyone help me out?

Share this topic:


  • 4 Pages +
  • 1
  • 2
  • 3
  • 4
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2011 msfn.org
Privacy Policy