Hi All,

So I'm brand new to Visual Basic and am VERY confused.
Lets set a few constants...
OS: Win XP.
Variations of Visual Basic on my PC:
1. Visual Basic run through the Sax Basic Engine Version 5.1. This runs files with a .bas extention and is run from within a specific software application.
2. Macros for MS Office 2003 seem to run though Microsoft Visual
Basic 6.3.
3. I can also create a "script" on my desktop with a .vbs extention and it seems to run. Though the syntax & commands/functions are a bit different than the stuff used through MS Office Macros. When I edit this .vbs file it just opens in Notepad so I don't know what version of software it's being run (compiled?) by. How do I find this out?
A sample of the first two lines of code from the .vbs file are below if that helps:
[
set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "NOTEPAD.EXE"
WScript.Sleep 100
wScript.AppMove Left:=500, Top:=-9
WshShell.AppActivate "Untitled - Notepad"
WScript.Sleep 100
For i = 1 to 10
WshShell.SendKeys "{G}"
WScript.Sleep 500
Next
]

The AppMove Left line does not work. You can see the whole program is pretty much jsut a starter to get my familiar with syntax.
Then there is the Microsoft VB Scripting Host.

So someone just give me a general clue as to what I've got here.
I guess I'm most interested in whatever is running the .vbs scripts on my desktop. I am running "kind of" a BATCH file. Though I am interested in Visual Basic because I can't get the applications that I launch with the .bat file to do some specific things. Command line stuff is not able to accomodate what I want to do.
Such as providing passwords, moving application windows on the monitor, restoring them, min/max them.

If you can answer some of that and give me a good pointer to where I can learn about whatever version of Visual Basic is running on my desk top that would be great!
TIA for any info!!

A script file is never compiled, We have VB scripts, Java scripts.. why the very HTML is a script. Bu they only run in their own environment.
The .bat files run in MSDOS environment. Correct? if you create .bat file in windows it changes its icon to notify you that it is a MSDOS executable. You can edit it in Notepad is it not?. Same way your .vbs opened in notepad because Windows cannot run it alone nor MSDOS. There is nothing strange in it.

Yes, So I've figured out that I do have all those different applications on my system. For straight up Windows I have WSH 5.6. The Sax VB application I have says it is compatible with VBA... which as I understand it runs within MS applications.
In my code above I was not able to get the movement commands to work in any form or fashion so I had to fall back to using Sendkeys commands to get it to do what I wanted.
If anyone knows a command/function or whatever to move an active window without using sendkeys on WSH 5.6 that would be very helpful!
Thanks!
Chris

For positioning the form window, I think you have to give
WshShell instead of

wScript.AppMove Left:=500, Top:=-9

Otherwise comment it out and let it run on the defaulted position.

So now as a sample script my code is as follows per your recommendation:
[
set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "C:\Progra~1\DownSt~1\CAM350~1\CAMNT95.EXE"
WshShell.AppMove Left:=500, Top:=-9
]

The WSH error I get is line 3, char 23. Expected statement. Code 800A0400.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.