Sign in to follow this  
Followers 0
tsolrm

add to registry

9 posts in this topic

I want to add my script to start up and i'm trying to use registry to do this

RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "TEST.exe", "REG_SZ", @WindowsDir&"\TEST.exe")

However when I open that folder in registry using regedit, i'm not seeing any changes. What am I doing wrong?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

You're probably using vista or windows seven under a guest or non admin account or UAC is enabled.

Try adding #RequireAdmin to the top of your script and report back here with results.

Edited by ApudAngelorum

Things that I've done..

Icon Resource Editor: icon resource editor 

AutoIt Piano: a piano

AutoIt Unlocker: unlocks files when you want to delete them

Colorful tooltips: a wrapper for the tool tips UDF

Rouge GoogleBot: a full screen animation

ASciTE text editor: a text editor written in autoit

Warning: Posts by this user are subject to change or may disappear without notice.

Share this post


Link to post
Share on other sites

I've already included the requireadmin bit and yes i am using W7

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I've already included the requireadmin bit and yes i am using W7

So you're 100% sure that the script is running with administrator privileges and the write operation is not working still?

This is an incredible anomaly.

Maybe if you're using a x64 bit system and running the script using the x32 x64 bit interpreter, you might give this a try?

RegWrite("HKLM64SOFTWAREMicrosoftWindowsCurrentVersionRun", "TEST.exe", "REG_SZ", @WindowsDir&"TEST.exe")

Edited by ApudAngelorum

Things that I've done..

Icon Resource Editor: icon resource editor 

AutoIt Piano: a piano

AutoIt Unlocker: unlocks files when you want to delete them

Colorful tooltips: a wrapper for the tool tips UDF

Rouge GoogleBot: a full screen animation

ASciTE text editor: a text editor written in autoit

Warning: Posts by this user are subject to change or may disappear without notice.

Share this post


Link to post
Share on other sites

Right you've definitely showed me the right direction.

I've removed "#AutoIt3Wrapper_UseX64=n" from my code and the changes have happened.

However without this bit of code people running the x32 system will be unable to run the script. Anyway around this?

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

There are ways to make the script work on both architectures, research a little, it's not too hard to do.

Correction: It's not hard at all. Just make sure you use the right base key depending on the interpreter architecture and the machines architecture.

Func _CheckBaseKey($HKType)
    Local $CHECK = False
    If (@OSArch <> "X86") And @AutoItX64 Then
        If Number(StringTrimLeft($HKType, StringLen($HKType) - 2)) <> 64 Then
            #cs
                Jon once said somewhere that if running a compiled autoit script with an x86 interpreter
                the x64 OS will manually correct the key destination unless running with the x64 interpreter
                the system will assume the destination is correct, so just in case, we will attempt a correction
                manually in this area just for the heck of it..
                Also note: If no match is found, we will throw an error because this shouldn't be written anywhere else.
            #ce
            Local Const $KeyVal[4][2] = [ _
                    ["HKCU", "HKCU64"], _
                    ["HKLM", "HKLM64"], _
                    ["HKEY_LOCAL_MACHINE", "HKEY_LOCAL_MACHINE64"], _
                    ["HKEY_CURRENT_USER", "HKEY_CURRENT_USER64"] _
                    ]
            For $I = 0 To UBound($KeyVal, 1) - 1
                If StringInStr($KeyVal[$I][0], $HKType, 2) Then
                    $HKType = $KeyVal[$I][1]
                    $CHECK = True
                    ExitLoop
                EndIf
            Next
            If Not $CHECK Then Return SetError(1, 0, False)
        EndIf
    EndIf
    Return SetError(0, 0, $HKType)
EndFunc   ;==>_CheckBaseKey
Edited by ApudAngelorum
1 person likes this

Things that I've done..

Icon Resource Editor: icon resource editor 

AutoIt Piano: a piano

AutoIt Unlocker: unlocks files when you want to delete them

Colorful tooltips: a wrapper for the tool tips UDF

Rouge GoogleBot: a full screen animation

ASciTE text editor: a text editor written in autoit

Warning: Posts by this user are subject to change or may disappear without notice.

Share this post


Link to post
Share on other sites

Thanks!

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Cheers Chimaera, was about to suggest that too.

Edited by guinness

_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

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  
Followers 0