e45678mail

(Solved)Why the .exe file will not auto run?

7 posts in this topic

#1 ·  Posted (edited)

I have put the compiled file of EXE path to :

  • HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run
  • or startup folder.

why the system always will not auto run it when reboot, but .au3 format will function it?

 

=>Thanks all, I have find the root cause is #requireAdmin cmd, remove it function will normally.

Edited by e45678mail

Share this post


Link to post
Share on other sites



#2 ·  Posted

Please add your exe into Exclude Program of Windows Defender or your AntiVirus :)

Share this post


Link to post
Share on other sites

#3 ·  Posted

What exactly did you put in the registry key?
What exactly does you script do?
Does it require the Workdir to be set to the ScriptDir?

as you see... we need input to help you!

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#4 ·  Posted

On 2017/1/6 at 5:59 PM, meoit said:

Please add your exe into Exclude Program of Windows Defender or your AntiVirus :)

thanks for your suggestion, I was to disable the Defender by gpedit.msc or add my .exe file to exclusions list,

still will not popup the UI of my .exe when reboot.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

On ‎06‎/‎01‎/‎2017 at 10:17 AM, Jos said:

What exactly did you put in the registry key?
What exactly does you script do?
Does it require the Workdir to be set to the ScriptDir?

as you see... we need input to help you!

Jos

I am add the auto run by registry as:

RegWrite("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run",@ScriptName,"REG_SZ",$ATPath)

and copy the .exe file to startup folder by  shell:startup.

all of script as below:

#RequireAdmin
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_UseUpx=y
#AutoIt3Wrapper_UseX64=y
#AutoIt3Wrapper_Change2CUI=y
#AutoIt3Wrapper_Add_Constants=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <Process.au3>
#include <FileConstants.au3>
#include <MsgBoxConstants.au3>


#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=d:\ian_chen\Desktop\Auto Install\AutoInstall_v0.2.kxf
$Form1 = GUICreate("AutoInstall v1.0_1223", 601, 513, 187, 126)
GUISetFont(8, 400, 0, "Calibri")
$Radio1 = GUICtrlCreateRadio("All", 32, 456, 75, 35)
GUICtrlSetFont(-1, 12, 400, 0, "Calibri")
$Radio2 = GUICtrlCreateRadio("Clean", 176, 456, 75, 35)
GUICtrlSetFont(-1, 12, 400, 0, "Calibri")
$Group1 = GUICtrlCreateGroup("", 8, 442, 292, 58)
GUICtrlSetFont(-1, 12, 400, 0, "Calibri")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Install = GUICtrlCreateButton("Install All", 384, 455, 171, 41)
GUICtrlSetFont(-1, 12, 400, 0, "Calibri")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

Local $ip = 0
Local $id = 0

local $ini = FileRead(".\autoins.ini")
local $sDev = StringInStr($ini,"DeviceCount=")
local $Dev = StringMid($ini,($sDev+12),2)
local $sOpt = StringInStr($ini,"OptionCount=")
local $Opt = StringMid($ini,($sOpt+12),2)
Local $TT = $Dev+$Opt

While $ip <= $TT
        If $ip <= $dev Then
        Local $FDevice = StringInStr($ini,"Device"&($ip-1))
        local $spath = StringInStr($ini,"path","",1,$FDevice)
        local $epath = StringInStr($ini,".","",1,$spath+15)
        local $path = StringMid($ini,($spath+6),($epath-$spath-2))
        Local $rpath = StringReplace($path,"\\","\")
        local $Label = ("$Label"&$ip)

        $Label = GUICtrlCreateLabel($rpath, 300, 430/$TT*($ip-1)+8, 280, 19)
        GUICtrlSetFont(-1, 10, 400, 0, "Calibri")

        $ip = $ip + 1
        EndIf

        If $ip > $dev Then
        Local $FDevice = StringInStr($ini,"Option"&($ip-$dev-1))
        local $spath = StringInStr($ini,"path","",1,$FDevice)
        local $epath = StringInStr($ini,".","",1,$spath+15)
        local $path = StringMid($ini,($spath+6),($epath-$spath-2))
        Local $rpath = StringReplace($path,"\\","\")
        local $Label = ("$Label"&$ip)

        $Label = GUICtrlCreateLabel($rpath, 300, 430/$TT*($ip-1)+8, 280, 19)
        GUICtrlSetFont(-1, 10, 400, 0, "Calibri")

        $ip = $ip + 1
        EndIf
WEnd

While $id <= $TT
    If $id <= $dev Then
        Local $FDevice = StringInStr($ini,"Device"&($id-1))
        local $sname = StringInStr($ini,"Name","",1,$FDevice)
        local $ename = StringInStr($ini,'"',"",1,$sname+20)
        local $name = StringMid($ini,($sname+10),($ename-$sname-10))
        local $Checkbox = ("$Checkbox"&$id)

        $Checkbox = GUICtrlCreateCheckbox($name, 10, 430/$TT*($id-1)+8, 280, 20)
        GUICtrlSetFont(-1, 10, 400, 0, "Calibri")

        if StringInStr($name,"control") > 0 Then
        GUICtrlSetState(-1,$GUI_DISABLE)
        EndIf
        if StringInStr($name,"Hotkey") > 0  Then
        GUICtrlSetState(-1,$GUI_DISABLE)

        EndIf


    $id = $id + 1

    EndIf
    If $id > $dev Then
        Local $FDevice = StringInStr($ini,"Option"&($id-$dev-1))
        local $sname = StringInStr($ini,"Name","",1,$FDevice)
        local $ename = StringInStr($ini,'"',"",1,$sname+20)
        local $name = StringMid($ini,($sname+10),($ename-$sname-10))
        local $Checkbox = ("$Checkbox"&$id)

        $Checkbox = GUICtrlCreateCheckbox($name, 10, 430/$TT*($id-1)+8, 280, 20)
        GUICtrlSetFont(-1, 10, 400, 0, "Calibri")

        if StringInStr($name,"WLAN") > 0 Then
        GUICtrlSetState(-1,$GUI_DISABLE)
        EndIf
        if StringInStr($name,"BT") > 0  Then
        GUICtrlSetState(-1,$GUI_DISABLE)
        EndIf
        if StringInStr($name,"Blue") > 0  Then
        GUICtrlSetState(-1,$GUI_DISABLE)
        EndIf

        $id = $id + 1

    EndIf
WEnd

IF StringLen(RegRead("HKEY_CURRENT_USER\SOFTWARE\iAN","CBIT")) <= 1 Then
Normal()
Else
continue()
EndIf

Func Normal()
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg

        case $Radio1
            Local $CBIT = $TT+9
            Local $i = $CBIT+$TT
            While $CBIT <= $i
            GUICtrlSetState($CBIT,$GUI_CHECKED)

            if StringInStr(GUICtrlRead($CBIT,1),"Control") > 0 Then
            GUICtrlSetState($CBIT,$GUI_UNCHECKED)
            EndIf
            if StringInStr(GUICtrlRead($CBIT,1),"Honkey") > 0 Then
            GUICtrlSetState($CBIT,$GUI_UNCHECKED)
            EndIf

            if StringInStr(GUICtrlRead($CBIT,1),"WLAN") > 0 Then
            GUICtrlSetState($CBIT,$GUI_UNCHECKED)
            EndIf
            if StringInStr(GUICtrlRead($CBIT,1),"BT") > 0 Then
            GUICtrlSetState($CBIT,$GUI_UNCHECKED)
            EndIf
            if StringInStr(GUICtrlRead($CBIT,1),"Blue") > 0 Then
            GUICtrlSetState($CBIT,$GUI_UNCHECKED)
            EndIf

            $CBIT = $CBIT+1
            WEnd

        case $Radio2
            Local $CBIT = $TT+9
            Local $i = $CBIT+$TT
            While $CBIT <= $i
            GUICtrlSetState($CBIT,$GUI_UNCHECKED)
            $CBIT = $CBIT+1
            WEnd
                Case $GUI_EVENT_CLOSE
            Exit

case $Install

            GUICtrlSetState($install,$GUI_DISABLE)

        Local $LBIT = 8
            Local $i = $LBIT+$TT
            Local $CBIT = $TT+9

            Local $OrderC = ""
            Local $OrderL = ""
            Local $k = ""
            Local $L = ""
            Local $ATPath = @ScriptDir&"\"&@ScriptName

RegWrite("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run",@ScriptName,"REG_SZ",$ATPath)

            While $LBIT <= $i
                if GUICtrlRead($CBIT)= $gui_checked Then
                    $orderC = $orderC & $CBIT &"_"
                    $orderL = $orderL & $LBIT &"_"
                EndIf
                    $LBIT = $LBIT +1
                    $CBIT = $CBIT+1
            WEnd

RegWrite("HKEY_CURRENT_USER\SOFTWARE\iAN","CBIT","REG_SZ",$orderC)
RegWrite("HKEY_CURRENT_USER\SOFTWARE\iAN","LBIT","REG_SZ",$orderL)

            Local $LBIT = 8
            Local $i = $LBIT+$TT
            Local $CBIT = $TT+9

            While $LBIT <= $i
                Local $rpath = GUICtrlRead($LBIT,0)
                Local $test =StringRight($rpath,3)


                    if GUICtrlRead($CBIT)= $gui_checked Then
                    switch $test
                    Case "exe"
                    ShellExecuteWait(@ScriptDir&"\"&$rpath,"-s")
                    $orderC = RegRead("HKEY_CURRENT_USER\SOFTWARE\iAN","CBIT")
                    $orderL = RegRead("HKEY_CURRENT_USER\SOFTWARE\iAN","LBIT")
                    $k = StringMid($orderC,stringinstr($orderC,"_")+1,99)
                    $L = StringMid($orderL,stringinstr($orderL,"_")+1,99)
                    RegWrite("HKEY_CURRENT_USER\SOFTWARE\iAN","CBIT","REG_SZ",$k)
                    RegWrite("HKEY_CURRENT_USER\SOFTWARE\iAN","LBIT","REG_SZ",$L)
                    Sleep(3000)

                    case "msi"
                    ShellExecuteWait(@ScriptDir&"\"&StringReplace($rpath,"msiexec.exe /i ",""),"-qn")
                    $orderC = RegRead("HKEY_CURRENT_USER\SOFTWARE\iAN","CBIT")
                    $orderL = RegRead("HKEY_CURRENT_USER\SOFTWARE\iAN","LBIT")
                    $k = StringMid($orderC,stringinstr($orderC,"_")+1,99)
                    $L = StringMid($orderL,stringinstr($orderL,"_")+1,99)
                    RegWrite("HKEY_CURRENT_USER\SOFTWARE\iAN","CBIT","REG_SZ",$k)
                    RegWrite("HKEY_CURRENT_USER\SOFTWARE\iAN","LBIT","REG_SZ",$L)
                    Sleep(3000)

                    EndSwitch

                EndIf
                $LBIT = $LBIT +1
                $CBIT = $CBIT+1
             wend

                GUICtrlSetState($install,$GUI_ENABLE)
                MsgBox(0,"","Completed!!")
                Run("C:\Windows\System32\control.exe appwiz.cpl", "", @SW_SHOWMAXIMIZED)
               Sleep(1000)
               send("{F5}")

    EndSwitch
WEnd
EndFunc

Func Continue()
                    GUICtrlSetState($install,$GUI_DISABLE)
    Local $CBITfll = RegRead("HKEY_CURRENT_USER\SOFTWARE\iAN","CBIT")
            Local $CBIT = StringLeft($CBITfll,StringInStr($CBITfll,"_")-1)

            While $CBIT <> ""
                GUICtrlSetState($CBIT,$GUI_CHECKED)
                $CBITfll = StringMid($CBITfll,StringInStr(RegRead("HKEY_CURRENT_USER\SOFTWARE\iAN","CBIT"),"_")+1,99)
                $CBIT = StringLeft($CBITfll,StringInStr($CBITfll,"_")-1)
            WEnd

            Local $CBIT = StringLeft(RegRead("HKEY_CURRENT_USER\SOFTWARE\iAN","CBIT"),StringInStr(RegRead("HKEY_CURRENT_USER\SOFTWARE\iAN","CBIT"),"_")-1)
            Local $LBIT = StringLeft(RegRead("HKEY_CURRENT_USER\SOFTWARE\iAN","LBIT"),StringInStr(RegRead("HKEY_CURRENT_USER\SOFTWARE\iAN","LBIT"),"_")-1)

            Local $i = $LBIT+$TT
            Local $OrderC = ""
            Local $OrderL = ""
            Local $k = ""
            Local $L = ""

            While $LBIT <= $i
                Local $rpath = GUICtrlRead($LBIT,0)
                Local $test =StringRight($rpath,3)

                    if GUICtrlRead($CBIT)= $gui_checked Then
                    switch $test
                    Case "exe"
                    $orderC = RegRead("HKEY_CURRENT_USER\SOFTWARE\iAN","CBIT")
                    $orderL = RegRead("HKEY_CURRENT_USER\SOFTWARE\iAN","LBIT")
                    $k = StringMid($orderC,stringinstr($orderC,"_")+1,99)
                    $L = StringMid($orderL,stringinstr($orderL,"_")+1,99)
                    RegWrite("HKEY_CURRENT_USER\SOFTWARE\iAN","CBIT","REG_SZ",$k)
                    RegWrite("HKEY_CURRENT_USER\SOFTWARE\iAN","LBIT","REG_SZ",$L)
                    Sleep(3000)
                    ShellExecuteWait(@ScriptDir&"\"&$rpath,"-s")

                    case "msi"
                    $orderC = RegRead("HKEY_CURRENT_USER\SOFTWARE\iAN","CBIT")
                    $orderL = RegRead("HKEY_CURRENT_USER\SOFTWARE\iAN","LBIT")
                    $k = StringMid($orderC,stringinstr($orderC,"_")+1,99)
                    $L = StringMid($orderL,stringinstr($orderL,"_")+1,99)
                    RegWrite("HKEY_CURRENT_USER\SOFTWARE\iAN","CBIT","REG_SZ",$k)
                    RegWrite("HKEY_CURRENT_USER\SOFTWARE\iAN","LBIT","REG_SZ",$L)
                    Sleep(3000)
                    ShellExecuteWait(@ScriptDir&"\"&StringReplace($rpath,"msiexec.exe /i ",""),"-qn")

            EndSwitch
                EndIf
                $LBIT = $LBIT +1
                $CBIT = $CBIT+1
             wend
                GUICtrlSetState($install,$GUI_ENABLE)
                MsgBox(0,"","Completed!!")
                Run("C:\Windows\System32\control.exe appwiz.cpl", "", @SW_SHOWMAXIMIZED)
               Sleep(1000)
               send("{F5}")

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg

        case $Radio1
            Local $CBIT = $TT+9
            Local $i = $CBIT+$TT
            While $CBIT <= $i
            GUICtrlSetState($CBIT,$GUI_CHECKED)

            if StringInStr(GUICtrlRead($CBIT,1),"Control") > 0 Then
            GUICtrlSetState($CBIT,$GUI_UNCHECKED)
            EndIf
            if StringInStr(GUICtrlRead($CBIT,1),"Honkey") > 0 Then
            GUICtrlSetState($CBIT,$GUI_UNCHECKED)
            EndIf

            if StringInStr(GUICtrlRead($CBIT,1),"WLAN") > 0 Then
            GUICtrlSetState($CBIT,$GUI_UNCHECKED)
            EndIf
            if StringInStr(GUICtrlRead($CBIT,1),"BT") > 0 Then
            GUICtrlSetState($CBIT,$GUI_UNCHECKED)
            EndIf
            if StringInStr(GUICtrlRead($CBIT,1),"Blue") > 0 Then
            GUICtrlSetState($CBIT,$GUI_UNCHECKED)
            EndIf

            $CBIT = $CBIT+1
            WEnd

        case $Radio2
            Local $CBIT = $TT+9
            Local $i = $CBIT+$TT
            While $CBIT <= $i
            GUICtrlSetState($CBIT,$GUI_UNCHECKED)
            $CBIT = $CBIT+1
            WEnd
                Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch

WEnd

EndFunc

 

Edited by Melba23
Added code tags

Share this post


Link to post
Share on other sites

#6 ·  Posted

You should place your code between <> to make it easier to read.  Are you able to attach or post your autoins.ini file?

Share this post


Link to post
Share on other sites

#7 ·  Posted

15 hours ago, e45678mail said:

RegWrite("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run",@ScriptName,"REG_SZ",$ATPath)

Are you sure it will be able to find the @scriptname as doesn't contain the path information. 

15 hours ago, e45678mail said:

and copy the .exe file to startup folder by  shell:startup.

I don't know what that means. Which exact directory do you copy it to?

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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