Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 462
  • Last Modified:

automation with VBS

Hello,

I know how to write a script that open an internet explorer window with VBS and set its size, etc... I was wondering how I could do it with other applications in windows.  Mostly, what I need is a way to open up Windows Explorer windows to certain folders and arrange them in a certain way so I organize files (an upload I do every day).

It seems there is a class automation list somewhere that apps have to be added to.  Can someone get me started with a script that will open a windows explorer window to C:\WINDOWS\ and size it to 200x200 and place it at location (0,0) on my screen?  Once I have it, I think I'll be able to change the destination folders, sizes, and locations, etc, to what I really need.  Also, where can I find what options I have available for each application I could startup using VBS?  

Thanks experts!

0
meuedyn
Asked:
meuedyn
  • 3
3 Solutions
 
PaulHewsCommented:
Explorer does not expose any automation objects.  You can make do with some basic command line switches, but you will not be able to move windows around within a VB Script.  This is probably closest to what you are trying to achieve.

Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "%windir%\explorer /e,c:\winnt\", 9

>Also, where can I find what options I have available for each application I could startup using VBS?  
Generally that information is available in the online help for that application.  All MS Office applications are capable of being automated for example, and you have the option when installing of installing their VBA help as well so that you can look up the object model.  It is worth noting that most programs do not expose any automation at all.  
0
 
PaulHewsCommented:
Sorry, you asked for C:\Windows:

Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "%windir%\explorer /e,c:\Windows\", 9
0
 
aelatikCommented:
You can use the internet object to achieve that:

Dim X
Set X = CreateObject("internetexplorer.application")
    X.navigate "c:\Windows\"
    X.Visible = True
    X.Width = 200
    X.Height = 200
    X.Left = 0
    X.Top = 0
Set X = Nothing
0
 
meuedynAuthor Commented:
Is there anyway that I can write a script, batch file, whatever, you name it.. that can open up, lets say, notepad, to a specific size and location?  It would be great to double-click a single icon and have 3 apps open into preset window sizes/locations..

-meue
0
 
PaulHewsCommented:
Not in VBS.  You could use a third party scripting solution like WinBatch or write your own Visual Basic program to do this.
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now