Problem giving administrator access to software in Windows startup in Autoit

  admin, autoit, autoit-recorder, coding-style, windows

I have trouble giving the admin access to the software
I want the admin to stop accessing the Windows startup when the software runs, and only ask me for admin access once when running for the first time.
How do I execute this command and ask me for admin access only once?
This is My code Please Help me!!
#NoTrayIcon
#RequireAdmin
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_UseX64=n
#AutoIt3Wrapper_Res_Comment=Sayyad USB Detector
#AutoIt3Wrapper_Res_Description=Writed And Edited By Seyed Amirreza Kabodian
#AutoIt3Wrapper_Res_Fileversion=1.0.0.0
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <AutoItConstants.au3>
#include <Array.au3>
#include <Date.au3>
$OsVer = @OSVersion
$vbFile = @StartupDir&"MicrosoftUSBDetector.vbs"

    $hVbFile= FileOpen($vbFile,1)

    FileWrite($hVbFile,"Dim objShell"& @CRLF)
    FileWrite($hVbFile,'Set objShell = WScript.CreateObject( "WScript.Shell" )'& @CRLF)
    FileWrite($hVbFile,'objShell.Run("""'&@ScriptDir&"Start_8_10.exe"&'""")'& @CRLF)
    FileWrite($hVbFile,"Set objShell = Nothing"& @CRLF)


    FileClose($hVbFile)
    Local $sLastDrives, $UserNum
    $mfile = FileOpen(@TempDir&"SUD Data FileMainData.txt",1)
    FileWrite($mfile,@UserName & "|" & "=The program implemented in ..." & _NowCalcDate() & "|" & _NowTime(5) & @CRLF)
    FileClose($mfile)
    ;Regedit Setting......................

    ;End ................................
    While True
        Sleep(5000) ; Sleep and wait for editing txt file..
        $drives = DriveGetDrive($DT_REMOVABLE)
        If Not @error And Not _ArrayCompare($sLastDrives, $drives) Then
            ;New flash drive connected
            $sLastDrives = $drives
            $mfile = FileOpen(@TempDir&"SUD Data FileMainData.txt",1)
            FileWrite($mfile, @UserName & "|" & "==Disk Inserted In:" & "|" & _NowCalcDate() & "_" & _NowTime(5) & @CRLF)
            FileClose($mfile)
        ElseIf @error And UBound($sLastDrives) Then
            ;Flash drive disconnected
            $mfile = FileOpen(@TempDir&"SUD Data FileMainData.txt",1)
            FileWrite($mfile,"===Disk Disconnected in:"&_NowCalcDate()&"|"&_NowTime(5)&@CRLF)
            FileClose($mfile)
            $sLastDrives = ""
        EndIf

    WEnd

    Func _ArrayCompare($sArr1, $sArr2)

        $sString1 = _ArrayToString($sArr1)
        $sString2 = _ArrayToString($sArr2)

        If $sString1 = $sString2 Then
            Return True
        Else
            Return SetError(1, 0, False)
        EndIf

    EndFunc

Source: Windows Questions

LEAVE A COMMENT