F4st1DiO

Run a *.vbs in "silent" mode

14 posts in this topic

Hi everyone! This is my first message, so first of all thank you for all the inspirations I took from here!
I'm facing a second project with AutoIT. Basically I'm developing a program for my company to delete all the old Microsoft Office versions and then install Office 365.
The problem is that I need to have less thinks on user's diplay as possible. It will be perfect to have only a status bar showing "Uninstalling old Office versions" and the loading bar from 0 to 100%.... but that's not the point.
I've collected and I'm testing all the Office Scrub script (*.vbs) available from Technet.
 

Case $btnScrub2007
            RunWait('cscript.exe "bin\OffScrub07.vbs" ProPlus' & $PreviewValue & '"')
            MsgBox (0, "Attention!", "Office 2007 was just removed!",10)

This is an example of what I'm talking about. Obvioulsy when I press that button, a Command appear on screen and I really like to hide it.
Tried with @WS_HIDE but it doesn't change. Tried with wscript but I didn't probably understood the correct usage, because it simply jump to the MsgBox below...

Is there someone so kind to give me some hints? ;)

Simone

Share this post


Link to post
Share on other sites



Did you add the @sw_hide in the correct parameter?
Try:

RunWait(@ComSpec & ' /c cscript.exe "bin\OffScrub07.vbs" ProPlus' & $PreviewValue & '"', "", @SW_HIDE)

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Or simply convert the vbs to AutoIt and save yourself the trouble of cross-language scripting...


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
14 hours ago, Jos said:

Did you add the @sw_hide in the correct parameter?
Try:

RunWait(@ComSpec & ' /c cscript.exe "bin\OffScrub07.vbs" ProPlus' & $PreviewValue & '"', "", @SW_HIDE)

Jos

Hi Jos, yes, I tried that also, I've spent my last day just trying to hide that command. Not being a programmer it took a while to understand the right way to open and close quotes, but now I'm a master of that.. lol. the $PreviewValue simply add the string " /Preview" if a checkbox is checked.. this run the scripts in "Preview Mode" without uninstalling the Office.

Share this post


Link to post
Share on other sites
13 hours ago, JLogan3o13 said:

Or simply convert the vbs to AutoIt and save yourself the trouble of cross-language scripting...

Logan, unfortunately I do not have that level of skills. And the scripts are 5 and quite long. :(
It not the end of the world if I can't hide that prompts, but it will be absolutely great.

Share this post


Link to post
Share on other sites
47 minutes ago, F4st1DiO said:

this run the scripts in "Preview Mode" without uninstalling the Office.

So you are saying it doesn't hide when ran like that?
Does it prompt and then run with elevated rights?

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

The #RequireAdmin is at the beginning of the execution. This will be launched by Domain Admins or Local Administrators only.

Wait.... wait wait wait. I'm sorry. Your code works perfectly. Can't understand the difference... anyway that was a great help, thanks!
 

RunWait(@ComSpec & ' /c ' & 'cscript.exe "bin\OffScrub07.vbs ProPlus' & $PreviewValue & '"', '', @SW_MINIMIZE) ;my version
RunWait(@ComSpec & ' /c cscript.exe "bin\OffScrub07.vbs" ProPlus' & $PreviewValue & '"', "", @SW_HIDE) ;Jos version

; My version uses @SW_MINIMIZE just to be sure that was working. It was checked with @SW_HIDE too, but always jump to the next row.

Share this post


Link to post
Share on other sites

Well, one has the Minimize and the other the Hide attribute, so you would expect it to be different.. right?

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
1 hour ago, Jos said:

Well, one has the Minimize and the other the Hide attribute, so you would expect it to be different.. right?

Jos

As I wrote into the code comment,  that was only to be sure the script was running (without log it...).
Again, thanks.

Share this post


Link to post
Share on other sites

Sorry to revive this discussion... need some expert eye on this thing...
My code to run *.vbs evolved in this way:

Case $btnScrub2003
            DllCall("kernel32.dll", "int", "Wow64DisableWow64FsRedirection", "int", 1)
            If FileExists ( "bin\OffScrub03.vbs" ) Then
                RunWait(@ComSpec & ' /c cscript.exe "bin\OffScrub03.vbs" ProPlus /Q /NoCancel /BYPASS 1' & $PreviewValue & '"', "", @SW_MINIMIZE)
                MsgBox (0, "Attention!", "Office 2003 was just removed!",10)
            Else
                MsgBox (0, "Attention!", "Script ""bin\OffScrub03.vbs"" not found!",10)
            EndIf

Now, until I work locally... everything's fine. If I put all my files on a share and I run them... the script do not run! (but it get correctly detected by FileExists).
I'm performing this test from the same computer! Locally it works, from the shared folder not! Damn....
Is there something I have to do to got it working from a network folder?

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

For starters: I seems you have an ending double quote character which doesn't make sense to me as there is no opening double quote. ... and there is also no space between " /BYPASS 1" and the concatenated content of $PreviewValue .
As to your issue: Are you using an UNC or mapped drive? in case of UNC: Have you tried with the full path by adding @ScriptDir to the start of the filename?

Jos

Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
17 minutes ago, Jos said:

For starters: I seems you have an ending double quote character which doesn't make sense to me as there is no opening double quote. ... and there is also no space between " /BYPASS 1" and the concatenated content of $PreviewValue .
As to your issue: Are you using an UNC or mapped drive? in case of UNC: Have you tried with the full path by adding @ScriptDir to the start of the filename?

Jos

I will check the double quote.
$PreviewValue = " /PreviewValue" so the space is just inside the variable
I'm actually using UNC but because there will be different file server with this program on it, I think I will Map Drive (I have to script a way to map the correct Fileserver country by country).

Thanks for the help!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now