Jump to content

getting value


wazer
 Share

Recommended Posts

Cant figure this out. I want the script to read the value taskbarsizemove, if its "0" then it should do my function _explorer() and perform my function _taskbarsizemove() and if it returns if the number "1" from this HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "TaskbarSizeMove" it shall do nothing and continue with the script.

$taskbarsizemove = RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "TaskbarSizeMove")

If @error = 0 Then

_taskbarsizemove()

_explorer()

Else ; registry ValueName NOT exist

$taskbarsizemove = "nothing?"

EndIf

FUNC _explorer()

;End Windows Explorer.

While ProcessExists ( "explorer.exe" )

ProcessClose ( "explorer.exe" )

WEnd

Sleep ( 5000 )

;Check for Explorer if not started - then start

While Not ProcessExists ( "explorer.exe" )

Run ( @WindowsDir & "\explorer.exe" )

Sleep ( 3000 )

WEnd

ENDFUNC

FUNC _taskbarsizemove()

REGWRITE("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced","TaskbarSizeMove","REG_DWORD","1")

ENDFUNC

Help me hardcore autoit experts :).

also is there any better way to code/clean this code up abit please show what else it could look like.

Link to comment
Share on other sites

No need for functions for those few tasks

$Taskbarsizemove = RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "TaskbarSizeMove")
If $Taskbarsizemove = 0 Then
    Do
        ProcessClose("explorer.exe")
    Until Not ProcessExists("explorer.exe")
    RegWrite("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "TaskbarSizeMove", "REG_DWORD", "1")
    If Not ProcessWait("explorer.exe", 5) Then Run(@WindowsDir & "\explorer.exe")
EndIf

EDIT: I did not include any checks for @error on the RegRead() or RegWrite()...you can check the Help file for those functions and decide if you want to add/change any code if @error is detected (and for different @error values)

Edited by Varian
Link to comment
Share on other sites

$taskbarsizemove = RegRead ( "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "TaskbarSizeMove" )
If Not $taskbarsizemove Then
   _taskbarsizemove()
   _explorer()
EndIf

Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Link to comment
Share on other sites

  • 2 weeks later...

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...