Jump to content
Sign in to follow this  
rikho

Function RunAsSet unknown in autoit v3.3.4.0

Recommended Posts

rikho

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

Share this post


Link to post
Share on other sites
Danny35d

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

Share this post


Link to post
Share on other sites
boern

its not an sollution, but an work around,

you can compile your script with an old AutoIt Version:

an easy way would be paste your code in the AutoIt Compiler

and use Version 3.2.10.0

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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.