Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Server > Scripting > wscript run command

Reply
Thread Tools Display Modes

wscript run command

 
 
JonWayn
Guest
Posts: n/a

 
      04-10-2009
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

 
Reply With Quote
 
 
 
 
Alex K. Angelopoulos
Guest
Posts: n/a

 
      04-19-2009
You've got a couple of responses over in the WSH newsgroup to this message;
it appears that Access itself chooses to show its main window, as explained
by Sergei Zhirikov. There is at least one workaround, starting via Access
automation, as shown over there (and repeated here):

Set access = CreateObject("Access.Application")
access.OpenCurrentDatabase(FOLDERPATH & SCHEDULERFILE, true)


"JonWayn" <> wrote in message
news:15BA8145-7AA0-452E-AF87-...
> 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
>

 
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
CScript or WScript Jimmy D Scripting 8 12-14-2005 12:39 AM
Re: WScript to modify GPO Corné Bogaarts Scripting 0 11-29-2005 04:56 AM
Wscript.Arguments Marius Wilberg Scripting 4 05-20-2005 11:15 AM
New to Wscript LarryG Scripting 2 11-08-2003 05:50 PM
wscript SABOY Scripting 1 10-22-2003 01:32 PM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59