Jump to content

problem with runasset (i guess)


 Share

Recommended Posts

I am trying to use this script with runasset cmd but unfortunately it does not finish and the last cmd (msgbox) is not being executed. I am not sure what can be the problem.

Can anybody help me?

$answer = MsgBox(4, "application will be installed...do u want to continue?")

If $answer = 7 Then

MsgBox(0, "End", "OK. Bye!")

Exit

EndIf

$USERNAME = "administrator"

$RUN = 0

$PASSWORD = "secret"

If $CMDLINE[0] = 1 Then $RUN = $CMDLINE[1]

If $RUN = 0 Then

RunAsSet($USERNAME, $PASSWORD)

install()

;########## tryied to insert msg box here, but..

Exit

EndIf

Func install()

Run("Setup.exe")

WinWaitActive("Welcome", "&Next >")

Sleep(2000)

Send("!N")

Sleep(2000)

WinWaitActive("xy", "aa")

Sleep(2000)

Send("!Y")

Sleep(2000)

WinWaitActive("xy", "ab")

Sleep(2000)

Send("!a")

WinWaitActive("bc")

Sleep(2000)

Send("c:\temp\lic")

Sleep(2000)

Send("!N")

WinWaitActive("ab", "aa")

Send("!N")

WinWaitActive("xy")

WinClose("xy")

MsgBox(0,"this is complete")

;########## msg box does not popes up :-( thw script is waiting...and does not stops.

EndFunc

If i paste msgbox before the run("setup.exe"), the msg is working. but after it.. no

Link to comment
Share on other sites

I am trying to use this script with runasset cmd but unfortunately it does not finish and the last cmd (msgbox) is not being executed. I am not sure what can be the problem.

Can anybody help me?

$answer = MsgBox(4, "application will be installed...do u want to continue?")

If $answer = 7 Then

MsgBox(0, "End", "OK. Bye!")

Exit

EndIf

$USERNAME = "administrator"

$RUN = 0

$PASSWORD = "secret"

If $CMDLINE[0] = 1 Then $RUN = $CMDLINE[1]

If $RUN = 0 Then

RunAsSet($USERNAME, $PASSWORD)

install()

;########## tryied to insert msg box here, but..

Exit

EndIf

Func install()

Run("Setup.exe")

WinWaitActive("Welcome", "&Next >")

Sleep(2000)

Send("!N")

Sleep(2000)

WinWaitActive("xy", "aa")

Sleep(2000)

Send("!Y")

Sleep(2000)

WinWaitActive("xy", "ab")

Sleep(2000)

Send("!a")

WinWaitActive("bc")

Sleep(2000)

Send("c:\temp\lic")

Sleep(2000)

Send("!N")

WinWaitActive("ab", "aa")

Send("!N")

WinWaitActive("xy")

WinClose("xy")

MsgBox(0,"this is complete")

;########## msg box does not popes up :-( thw script is waiting...and does not stops.

EndFunc

If i paste msgbox before the run("setup.exe"), the msg is working. but after it.. no

I don't think it's your runasset because I believe it would give you an error if the credentials didn't work. It most likely looks like one of your WinWaitActive parameters is holding the script so you might want to check that the windows that are opening if opening have the correct titles that you are using for the WinWaitActive or the script will continue to wait. Edited by EndFunc
EndFuncAutoIt is the shiznit. I love it.
Link to comment
Share on other sites

Welcome hurka,

It may stop at one of the WinWaitActive() functions as the script does not attempt to ensure that the windows are activated. I have added a UDF at the bottom of the script for waiting and activating the window in one function call. Use the Opt() of "TrayIconDebug" to check which line the script is at if it stops again by hovering the mouse over the systray icon.

Opt('TrayIconDebug', 1)
$answer = MsgBox(4, Default, "application will be installed...do u want to continue?")

If $answer = 7 Then
    MsgBox(0, "End", "OK. Bye!")
    Exit
EndIf

$USERNAME = "administrator"
$RUN = 0
$PASSWORD = "secret"
If $CMDLINE[0] = 1 Then $RUN = $CMDLINE[1]
If $RUN = 0 Then
    RunAsSet($USERNAME, $PASSWORD)
    install()
    Exit
EndIf


Func install()
    Run("Setup.exe")

    _WinWaitActive("Welcome", "&Next >")
    Sleep(2000)
    Send("!N")
    Sleep(2000)
    
    _WinWaitActive("xy", "aa")
    Sleep(2000)
    Send("!Y")
    Sleep(2000)

    _WinWaitActive("xy", "ab")
    Sleep(2000)
    Send("!a")

    _WinWaitActive("bc")
    Sleep(2000)
    Send("c:\temp\lic")
    Sleep(2000)
    Send("!N")
    
    _WinWaitActive("ab", "aa")
    Send("!N")

    WinWait("xy")
    WinClose("xy")

    MsgBox(0, Default, "this is complete")
EndFunc

Func _WinWaitActive($title , $text = '')
    WinWait($title , $text)
    While Not WinActive($title , $text)
        WinActivate($title , $text)
        Sleep(250)
    WEnd
    WinWaitActive($title , $text)
EndFuncoÝ÷ Ù.r¥u©l¢Z(«n²)à
í®B'$¶%É-æî¶Ú'±È^rFèÅë0'!q©Ûzj+z·¥¦åxLZ^jëh×6WinWait("Welcome", "&Next >")
ControlClick("Welcome", "&Next >", "&Next >")

You may also want to check whether the installer has support for silent switches.

:D

Link to comment
Share on other sites

Hello,

Thanks for the good ideas! The strange string is that if i run this script under a user who has admin rights (without runasset), than working fine. If the user has no admin right i have to use runasset function than the script fails.So i beleive the WinWaitActive() function can not be the problem. This is the reason why i thought that runasset is the problem.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...