Jump to content
Sign in to follow this  
wazer

getting value

Recommended Posts

wazer

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.

Share this post


Link to post
Share on other sites
Varian

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

Share this post


Link to post
Share on other sites
wakillon

$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

Share this post


Link to post
Share on other sites
wazer

Thank you two :), ill look at it and report back ;).

Share this post


Link to post
Share on other sites
wazer

Both of your suggestions worked great, yet again thanks guys!. sorry i havnt replyd before now, i simple didnt have the time for it!.

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.