WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

OLE COM ADO CDO ADSI LDAP
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

OLE Shell functions

 Keywords:  shell helper object application wscript

Starting Internet Explorer 4, there has been a desktop shell helper object called Shell.Application.

This object lets you manipulate the desktop and access other system operations.

Things you can do:

ShellApplication = ObjectOpen("Shell.Application")
Windows 98, ME, 2000 and XP users should have no trouble with this object. If you have Windows 95 or NT 4 and installed IE 5 without upgrading from IE 4 then you may get an error when trying to use this object. If you have already installed IE 5 then try this command:

For NT

IE5Setup.exe /C:"ie5wzd /e:IE4Shell_NTx86 /I:Y" 
For 95
IE5Setup.exe /C:"ie5wzd /e:IE4Shell_WIN /I:Y"

Examples:

Copy file

oSHApp = ObjectOpen("Shell.Application")
source = "C:\temp\test.txt"
target = "C:\temp2\"
oNameSpace = oSHApp.Namespace(target)
oNameSpace.CopyHere(source)
ObjectClose(oNameSpace)
ObjectClose(oSHApp)
This script minimizes all open windows then opens a number of folders.
winddir = DirWindows(0)
oWSHShell = ObjectOpen("WScript.Shell")
oSHApp = ObjectOpen("Shell.Application")
oSHApp.MinimizeAll
oSHApp.Open("C:\")
oSHApp.Open(winddir)
;oSHApp.Open("\\PDC\netlogon")
oSHApp.TileVertically
oWSHShell.popup("Restore Desktop")
oSHApp.UndoMinimizeAll
ObjectClose(oWSHShell)
ObjectClose(oSHApp)
Exit
For a list of shell objects and methods see:
http://msdn.microsoft.com/library/en-us/shellcc/platform/shell/reference/objects/objects.asp?frame=true

http://msdn.microsoft.com/library/en-us/shellcc/platform/shell/reference/objects/shell/shell.asp?frame=true

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/Shell/reference/objects/shell/application.asp


Some shell commands from msdn to perform different actions:
oShell = ObjectOpen("Shell.Application")

;Minimizes all windows on the desktop
;oShell.MinimizeAll

;Displays the Run dialog box
;oShell.FileRun

;Displays the Shut Down Windows dialog box
;oShell.ShutdownWindows

;Displays the Find dialog box
;oShell.FindFiles

;Displays the Date/Time dialog box
;oShell.SetTime

;Runs a Control Panel application 
;(Internet Properties dialog box)
;oShell.ControlPanelItem("INETCPL.cpl")

;Explores a folder
;oShell.Explore ("C:\YourFolder")

;Enables user to select folder
;returns a handle to wich you can apply methods 
;handle=oShell.BrowseForFolder (0, "Text", 0, "C:\YourFolder")

;Opens a folder
;oShell.Open ("C:\YourFolder")

;Displays the Taskbar Properties dialog box
;oShell.TrayProperties

ObjectClose(oShell)


Article ID:   W15232
File Created: 2003:01:31:11:04:46
Last Updated: 2003:01:31:11:04:46