Scripting

J

JonWayn

I have a VBScript script that is pretty simple: it opens a microsoft access
database. The problem is, it should open it hidden, with the second argument
to the wscript run command being 0, but it doesnt do so. Any suggestions?
Here's the script:

Const FOLDERPATH = "C:\Working\Access\All County\"
Const SCHEDULERFILE = "Scheduler.mdb"
Const LDBFILE = "Scheduler.ldb"
Const WINDOWVIEWSTATE_HIDE = 0
Const ERRPERMISSIONDENIED = 70

Set FSO = Wscript.CreateObject("Scripting.FileSystemObject")
On Error Resume Next

If FSO.FileExists(FOLDERPATH & LDBFILE) Then
FSO.DeleteFile FOLDERPATH & LDBFILE

If Err.Number = ERRPERMISSIONDENIED Then
Wscript.Echo "Scheduler already running"
Wscript.Quit
End If
End If

set objShell = Wscript.CreateObject("Wscript.Shell")
objShell.Run """" & FOLDERPATH & SCHEDULERFILE & """", WINDOWVIEWSTATE_HIDE,
-1
 
T

Twayne

JonWayn said:
I have a VBScript script that is pretty simple: it opens a microsoft
access database. The problem is, it should open it hidden, with the
second argument to the wscript run command being 0, but it doesnt do
so. Any suggestions? Here's the script:

Const FOLDERPATH = "C:\Working\Access\All County\"
Const SCHEDULERFILE = "Scheduler.mdb"
Const LDBFILE = "Scheduler.ldb"
Const WINDOWVIEWSTATE_HIDE = 0
Const ERRPERMISSIONDENIED = 70

Set FSO = Wscript.CreateObject("Scripting.FileSystemObject")
On Error Resume Next

If FSO.FileExists(FOLDERPATH & LDBFILE) Then
FSO.DeleteFile FOLDERPATH & LDBFILE

If Err.Number = ERRPERMISSIONDENIED Then
Wscript.Echo "Scheduler already running"
Wscript.Quit
End If
End If

set objShell = Wscript.CreateObject("Wscript.Shell")
objShell.Run """" & FOLDERPATH & SCHEDULERFILE & """",
WINDOWVIEWSTATE_HIDE, -1

Haven't got time to try it, but ... shouldn't ...HIDE be set to 1, not
0?
 
J

JonWayn

Not in Microsoft's own words. In fact, the first few times I tested that
script, I had it set to 1, just so I could clearly see if the app was even
opening, and, even then, the window opened visible. It was after ironing out
what bugs were apparent that I set it to the intended value, 0, and realized
that the result was same. I ran it in cscript too and there was no error
return code
 
D

David H. Lipman

From: "JonWayn" <[email protected]>

| I have a VBScript script that is pretty simple: it opens a microsoft access
| database. The problem is, it should open it hidden, with the second argument
| to the wscript run command being 0, but it doesnt do so. Any suggestions?
| Here's the script:


This is a scripting group.

This is one; microsoft.public.windows.server.scripting
 
T

Twayne

David said:
From: "JonWayn" <[email protected]> ....

This is a scripting group.

This is one; microsoft.public.windows.server.scripting

lol, Do you ever actually THINK while you're typing? Or is that too
much multi-tasking for you?

BTW, this is NOT a scripting group.

Twayne
 
D

David H. Lipman

From: "Twayne" <[email protected]>

| lol, Do you ever actually THINK while you're typing? Or is that too
| much multi-tasking for you?

| BTW, this is NOT a scripting group.

| Twayne

My problem is I am always thinking and my ADHD often gets in my way of spelling and such
typos BEFORE I choose the "send" button.
 
T

Twayne

David said:
My problem is I am always thinking and my ADHD often gets in my way
of spelling and such typos BEFORE I choose the "send" button.

Been there, done that! I'd get a brain transplant but so far I can't
find anyone that can clone the old data to the new one!

lol, Twayne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top