Sign in to follow this  
Followers 0
Yashied

_RegJump()

13 posts in this topic

#1 ·  Posted (edited)

This function opens a registry editor (regedit.exe) in the specified hive ($sKey). Enjoy!

_RegJump('HKCR\AutoIt3Script')

Func _RegJump($sKey)

    Local $Root, $Text = StringSplit($sKey, '\', 2)

    If IsArray($Text) Then
        $Text = $Text[0]
    Else
        $Text = $sKey
    EndIf
    Switch $Text
        Case 'HKEY_CLASSES_ROOT', 'HKEY_CURRENT_USER', 'HKEY_LOCAL_MACHINE', 'HKEY_USERS', 'HKEY_CURRENT_CONFIG'
            $Root = $Text
        Case 'HKCR'
            $Root = 'HKEY_CLASSES_ROOT'
        Case 'HKCU'
            $Root = 'HKEY_CURRENT_USER'
        Case 'HKLM'
            $Root = 'HKEY_LOCAL_MACHINE'
        Case 'HKU'
            $Root = 'HKEY_USERS'
        Case 'HKCC'
            $Root = 'HKEY_CURRENT_CONFIG'
        Case Else
            Return 0
    EndSwitch

    Local $Class = '[CLASS:RegEdit_RegEdit]'
    Local $Key = 'HKCU\Software\Microsoft\Windows\CurrentVersion\Applets\Regedit'
    Local $Delay = Opt('WinWaitDelay', 0)
    Local $Prev, $Result = 1

    If WinExists($Class) Then
        WinClose($Class)
        If Not WinWaitClose($Class, '', 5) Then
            $Result = 0
        EndIf
    EndIf
    If $Result Then
        $Prev = RegRead($Key, 'Lastkey')
        If @error Then
            $Prev = 0
        EndIf
        If Not RegWrite($Key, 'Lastkey', 'REG_SZ', StringReplace($sKey, $Text, $Root, 1)) Then
            $Result = 0
        Else
            If Not Run('regedit.exe') Then
                $Result = 0
                If IsString($Prev) Then
                    RegWrite($Key, 'Lastkey', 'REG_SZ', $Prev)
                EndIf
            EndIf
        EndIf
    EndIf
    Opt('WinWaitDelay', $Delay)
    Return $Result
EndFunc   ;==>_RegJump
Edited by Yashied
2 people like this

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

Before i used regjump utlity from Sysinternals for this tasks.But now no need use it! Really Great!

Thank you very much Yashied.

+5 from me for Great Job.

Thank you.

Edited by Fire

[size="5"] [/size]

Share this post


Link to post
Share on other sites

Good Job Yashied.


73 108 111 118 101 65 117 116 111 105 116

Share this post


Link to post
Share on other sites

yashield,

this works awesome..

any chance we can get it working when checking remote pc registry?

i tried changing that last key to a remote registry path - didnt work

i also opened regedit, chose a remote path manually, exited regedit... saw that the lastkey value was the remote registry path "hostname\hklm.."

but this didnt work. *sigh*

any ideas?

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

how to use the sample.?

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$Form1 = GUICreate("Form1", 401, 258, 192, 124)
$Button1 = GUICtrlCreateButton("HKLM-Run", 151, 192, 99, 25)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
  Case $GUI_EVENT_CLOSE
   Exit
  Case $Button1
   "HKLMSOFTWAREMicrosoftWindowsCurrentVersionRun";go key
         EndSwitch
WEnd
Edited by ahmettben

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Hi,

Like this:

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$Form1 = GUICreate("Form1", 401, 258, 192, 124)
$Button1 = GUICtrlCreateButton("HKLM-Run", 151, 192, 99, 25)
GUISetState(@SW_SHOW)
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            _RegJump('HKLMSOFTWAREMicrosoftWindowsCurrentVersionRun')
    EndSwitch
WEnd

Regards,

João Carlos.

Edited by JScript
1 person likes this

http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!)

Somewhere Out ThereJames Ingram

somewh10.png

dropbo10.pngDownload Dropbox - Simplify your life!
Your virtual HD wherever you go, anywhere!

Share this post


Link to post
Share on other sites

Posted Image

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

You have to include the function _RegJump into your script. Please read the Help file about Functions as this is a problem that can be easily solved by simply understanding of how AutoIt works.

Edited by guinness
1 person likes this

_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

#include <RegJump.au3>

use such as udf :oops:

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

No, copy the function above and paste into your code. Seriously open that Help file and start learning about functions.

Like this:

; Your code

Func _RegJump()
; UDF code.
EndFunc

If it doesn't work this time post in your own thread as you're hijacking this example thread with questions that can be answered by reading the Help file.

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

#13 ·  Posted (edited)

RegWrite('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Applets\Regedit', 'LastKey', 'REG_SZ', '. . .')
run('regedit -m')

Edited by spf

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