Jump to content

Recommended Posts

Posted (edited)

There is a great tool called ninite (www.ninite.com).

The only problem is that it is not really 'silent'.

So I wrote this little script to make it (almoast) silent (like /S or /Silent or /quiet)

Just rename the downloaded 'Ninite ....... exe' into 'Ninite.exe' and place it into the same folder as the Ninite-silent.exe (my AutoIt prg) Run it and that's it !

 

Download or here

Enjoy

Cramaboule!

EDIT: Change link !

EDIT2: Link to GitHub

Edited by cramaboule
Add new link!
  • 1 year later...
  • 2 months later...
  • 8 months later...
Posted

I am inside a domain and i need to use the function RunAs. If I replace the shellexecute function for RunAs it is not working properly. Does anyone know to get this fixed?

Posted

Perhaps instead of using RunAs in the script in the script (which may make the process ran as a different user to the script), try running the script as  "Run as Administrator" or "Run as different user" as shows under Win7 in the context menu. The latter may need the shift key held down while initiating the context menu. I have not used ninite though would expect it needs to have admin privileges to do the installs.
 
If you want RunAs in your script, then try restarting the script with RunAs.

Perhaps this may do it. You may need to change details for the RunAs function.

If Not $CMDLINE[0] Then
    RunAs('username', 'domain', 'password', logon_flag, '"' & @AutoItExe & '" /AutoIt3ExecuteScript "' & @ScriptFullPath & '" /restart')
    If @error Then MsgBox(0x30, @ScriptName, 'Failed RunAs')
ElseIf $CMDLINE[1] = '/restart' Then
    ShellExecute('"' & @ScriptDir & '\Ninite.exe"')
    If @error Then
        MsgBox(0x30, @ScriptName, 'Failed to execute "' & @ScriptDir & '\Ninite.exe"')
        Exit 1
    EndIf
    ;
    While 1
        If Not ProcessExists('Ninite.exe') Then Exit 1
        WinSetTrans ( "Preparing", "", 0 )
        WinSetTrans ( "Ninite", "", 0 )
        $text = WinGetText("Ninite", "")
        If StringInStr($text, "Finished.",1) Then
            ExitLoop
        EndIf
        Sleep(500)
    WEnd
    Sleep(1000)
    ControlClick("Ninite", "", "[ID:2]")
Else
    MsgBox(0x30, @ScriptName, 'Only /restart parameter is accepted')
EndIf

:)

Posted

Damn those students are annoying! The reason I dont want to show ninite running is that there is a link to the website in the program. And when they click on that link they use my credentials for the internet. So they can youtube facebook etc. 

Now they already figured out the position of the mouse and that they have to click the link within less then a second before the screen vanishes. If they fail to click it within that second they logoff and try again. 

Is there a way to block mouse input or a way to disable that linkbutton?

Posted (edited)

I did this, its not ideal but it works... If anyone knows a better solution, I'm all ears.

If Not $CMDLINE[0] Then
    RunAs('username', 'domain', 'password', logon_flag, '"' & @AutoItExe & '" /AutoIt3ExecuteScript "' & @ScriptFullPath & '" /restart')
    If @error Then MsgBox(0x30, @ScriptName, 'Failed RunAs')
ElseIf $CMDLINE[1] = '/restart' Then
    ShellExecute('"' & @ScriptDir & '\Ninite.exe"')
    If @error Then
        MsgBox(0x30, @ScriptName, 'Failed to execute "' & @ScriptDir & '\Ninite.exe"')
        Exit 1
    EndIf
    ;
    While 1
        BlockInput(1)
        If Not ProcessExists('Ninite.exe') Then Exit 1
        WinSetTrans ( "Preparing", "", 0 )
        WinSetTrans ( "Ninite", "", 0 )
        $text = WinGetText("Ninite", "")
        If StringInStr($text, "Finished.",1) Then
            ExitLoop
        EndIf
        Sleep(500)
        BlockInput(0)
    WEnd
    Sleep(1000)
    ControlClick("Ninite", "", "[ID:2]")
Else
    MsgBox(0x30, @ScriptName, 'Only /restart parameter is accepted')
EndIf
Edited by Jorin
Posted (edited)

Jorin,

That may work. I would put the BlockInput(0) after the WEnd. Keep the BlockInput(1) in the loop or just before the loop may be safer.

Another idea could be to move the window off screen. You cannot click something off screen with the mouse. You can even send the mouse in the opposite direction so that split second would prove to be a challenge for them. The WinWaitDelay set at 10 will make detection quite fast so the move will be almost in an instant.

Removed

See how that works with testing. Perhaps even a mixture of both ideas. :)

I am getting a 403 Forbidden from their site to download the installer so I cannot even check it for myself.

Edit: Use code in next post

Edited by MHz
Posted (edited)

I downloaded a Ninite package to test. Seems cookies in my browser was causing the issue with the 403.

The Prepare window is the 1st window to show so that is the one to wait for. The windows will be moved to just outside of the bottom right hand corner of the screen.

; found in @ScriptDir
$installer = 'Ninite.exe'

If Not $CMDLINE[0] Then
    RunAs('username', 'domain', 'password', logon_flag, '"' & @AutoItExe & '" /AutoIt3ExecuteScript "' & @ScriptFullPath & '" /restart')
    If @error Then MsgBox(0x30, @ScriptName, 'Failed RunAs', 5)
ElseIf $CMDLINE[1] = '/restart' Then
    Opt('WinWaitDelay', 10)
    ShellExecute('"' & @ScriptDir & '\' & $installer & '"')
    If @error Then Exit MsgBox(0x30, @ScriptName, 'Failed to execute "' & @ScriptDir & '\' & $installer & '"', 5)
    MouseMove(0, 0)
    WinMove(WinWait("Preparing"), "", @DesktopWidth, @DesktopHeight)
    While 1
        If Not ProcessExists($installer) Then Exit 1
        WinSetTrans ("Preparing", "", 0)
        WinSetTrans ("Ninite", "", 0)
        WinMove("Ninite", "", @DesktopWidth + 5, @DesktopHeight + 5)
        WinMove("Preparing", "", @DesktopWidth + 5, @DesktopHeight + 5)
        If WinExists("Ninite", "Finished.") Then ExitLoop
        Sleep(100)
    WEnd
    Sleep(1000)
    ControlClick("Ninite", "Finished.", "Button1")
Else
    MsgBox(0x30, @ScriptName, 'Only /restart parameter is accepted', 5)
EndIf

I did not test BlockInput though you can add them perhaps outside the loop. :)

Edit: changed a WinSetTrans to 0

Edited by MHz
Posted

Works like a charm... I dont even need to set a blockinput (wich is a annoying feature the way i used it. It completely blocked input and not just for the ninite window)

  • 2 years later...
  • 3 months later...
Posted
On 30/04/2016 at 10:47 PM, pp2k said:

Hi,

the .zip file seems corrupted :(

Fixed ! :-)

C.

  • 1 year later...
Posted

Hi thank you for your program / script

please could someone help me as im looking to see if i can remove the box that open to select the ninite.exe and give it a path to the exe so that it will autorun.

also is there away to get it to run and display the progress

Thank you in advance 

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
×
×
  • Create New...