Jump to content

Function RunAsSet unknown in autoit v3.3.4.0


rikho
 Share

Recommended Posts

Hi all,

this RunAsSet as disapear...?

This is my old code, i need to translate it to launch my program with another user.

with 3.3.4.0 i got an error on compilation to RunAsSet call... -> unknown function...(strange)

is someone can explain to me, why, i will be less idiot tomorrow

Regards

Rikho

#include <GUIConstants.au3>
#include <Array.au3>
#Region 
$Form1 = GUICreate("ActiveDirectory_usertool_v0.1", 282, 108, 193, 125)
$Combo1 = GUICtrlCreateCombo("Selection", 80, 40, 121, 125)
GUICtrlSetData(-1, "DOMAIN1|DOMAIN2|DOMAIN3")
$Label1 = GUICtrlCreateLabel("Plz select a domain", 8, 8, 268, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$Button1 = GUICtrlCreateButton("Run", 72, 64, 137, 33, 0)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            launch()
    EndSwitch
WEnd

func launch()

;~ if $cmdLine[0] > 0 then 
;~  $domain = $cmdLine[1]
;~ else 
;~  msgbox(
$domain = GUICtrlRead($Combo1)

If $domain = 'DOMAIN1' Then
    RunAsSet('%username%', '%domain%', '%password%', 2)
    Run(@ScriptDir & '\ActiveDirectory_usertool_v0.1.exe %selected_domain%', "", @SW_MAXIMIZE)
Else
    MsgBox(4096, '', "Wrong domain", 10000)
EndIf

EndFunc
Link to comment
Share on other sites

In the latest Autoit is called RunAs ------> Link

Change

If $domain = 'DOMAIN1' Then
    RunAsSet('%username%', '%domain%', '%password%', 2)
    Run(@ScriptDir & '\ActiveDirectory_usertool_v0.1.exe %selected_domain%', "", @SW_MAXIMIZE)
Else
    MsgBox(4096, '', "Wrong domain", 10000)
EndIf

To

If $domain = 'DOMAIN1' Then
    RunAs('%username%', '%domain%', '%password%', 2, @ScriptDir & '\ActiveDirectory_usertool_v0.1.exe %selected_domain%', "", @SW_MAXIMIZE)
Else
    MsgBox(4096, '', "Wrong domain", 10000)
EndIf
Edited by Danny35d
AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line
Link to comment
Share on other sites

  • 2 months later...

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...