AutoIt Change the Personal Folders widget _autoit

Source: Internet
Author: User
Tags volatile

v0.3 2008 Year June 1
Adds the feature "Select All, Cancel All" in the Options window.
to increase the option to restore links to the default path in the main window.

v0.2 2008 May 23
Add the pop-up window for adding items and dynamically changing the main window.
The background color is highlighted for the changed path.

v0.1 2008 Year May 23
Tests through "My Documents, my music, my videos, my favorites, my desktop."
Dynamically add option functionality when programming is complete.
#Region * * * * * Parameters created in Autoit3wrapper_gui * * * * * * #AutoIt3Wrapper_Icon =
\ tool \3.2.11.0.1\aut2exe\icons\ce.ico
#AutoIt3Wrapper_Outfile = Personal Folders Settings tool. V0.3.exe
#AutoIt3Wrapper_Res_Comment = To change the path of a personal folder, restart the computer immediately after application.
#AutoIt3Wrapper_Res_Description =alex Works
#AutoIt3Wrapper_Res_Fileversion =0.3.1.080601
#AutoIt3Wrapper_ Res_legalcopyright=alexandrer King
#EndRegion; * * * directives created by Autoit3wrapper_gui * * * * * * * * *

#CS Registry Path = HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders
 0  "AppData" = Application Data
 1  "Cookies" =cookies
 2  "Desktop" = Desktop
 3  "Favorites" = Favorites
 4  "NetHood" = Network Places for storing shortcuts to other computers that you add to your network Places.
 5  "Personal" = My Documents
 6  "PrintHood" = Printer for storing shortcuts to added printers.
 7  "Recent" = recently opened file
 8  "SendTo" = Sent to
 9  Start Menu "=" start "
 10   "Templates" = Template
 11  "Programs" ="Start menu \ Program
 12 " Startup "=" Start menu \ program \ Start
 13  ' Local Settings ' =local settings
 14  ' local appdata ' =local application Data
 15   "Cache" =internet cached file
 16  "History" = history
 17  "my Pictures" = my picture
 18  " Fonts "= Font
 19 " My Music "= Mine
 20 " CD burning "=cd burning
 21 " my Video "= My video
#CE

#include <guiconstants.au3>
#include <array.au3>
Opt ("Guioneventmode", 1); switch to onevent mode

; The following is a variable definition
local Const $AllItem =
Global $HomeDriver, $HomePath, $HomeEnvironment, $nNumber
Dim $aDict [3][ $AllItem] = [["AppData", "Cookies", "Desktop", "Favorites", "NetHood", "Personal", _
   "PrintHood", " Recent "," SendTo "," Start menu "," Templates "," Programs ", _
  " Startup "," local Settings "," Local AppData ", "Cache", "History", _
   "My Pictures", "Fonts", "I Music", "CD Burning", "My Video"],["Application", _
 &n BSP; " Cookies "," desktop "," Favorites "," My Network Places, My Documents, printers, recently opened, _
   Send To, Start menu, templates, Programs, start, local settings, local data, and so on, "slow down." Save ", _
  " History "," My Pictures, fonts, my music, CD burning, my videos]
Dim $aIndex [6] = ["2", "3", "5", "", "" ","] $nNumber = UBound ($aIndex)
; Place the relevant information in a 8xX array, which is obtained from the adict array by Aindex as the index, which is stored separately: project name, Chinese, key value, Labelid,inputid, Changebuttonid, new key value, Defaultbuttonid
Dim $avArray [$nNumber][8]
Dim $Form _main, $Form _child, $Button _apply
Dim $TempIndex [$AllItem]

; The following is the GUI
Maingui ()

; The following is the program body
While 1
Sleep (1000); Empty loops
Wend

; The following is a child function
Func Maingui ()
Local Const $mWidth = 641
Local $mHeight = Bayi + $nNumber * 30
$HomeDriver = RegRead ("Hkey_current_user\volatile Environment", "homedrive")
$HomePath = RegRead ("Hkey_current_user\volatile Environment", "HomePath")
$HomeEnvironment = $HomeDriver & $HomePath

#Region ### START Koda GUI Section ###
$Form _main = guicreate ("Personal Folder settings by Alexandrer King", $mWidth, $mHeight,-1,-1)
Guisetonevent ($GUI _event_close, "close")
Guisetfont (9, 800, 0, "Microsoft Ya Hei")
$Label _home = Guictrlcreatelabel ("Main path for current User:" & $HomeEnvironment, 10, 10, 520, 20)
For $Loop 1 = 1 to $nNumber
$sTemp 1 = RegRead ("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders", $aDict [0][ $aIndex [$Loop 1-1]])
$avArray [$Loop 1-1][0] = $aDict [0][$aIndex [$Loop 1-1]]
$avArray [$Loop 1-1][1] = $aDict [1][$aIndex [$Loop 1-1]]
$avArray [$Loop 1-1][2] = $sTemp 1
$avArray [$Loop 1-1][3] = Guictrlcreatelabel ($avArray [$Loop 1-1][1], ten + * $Loop 1, 60, 20)
$avArray [$Loop 1-1][4] = Guictrlcreateinput ($avArray [$Loop 1-1][2], 1, 490, 20)
Guictrlsetstate ( -1, $GUI _disable)
Guictrlsetbkcolor ( -1, 0xf0f0f0); Light
$avArray [$Loop 1-1][5] = Guictrlcreatebutton ("C", 570, + * $Loop 1, 30, 20)
Guictrlsetonevent ( -1, "Pointfolder")
$avArray [$Loop 1-1][7] = Guictrlcreatebutton ("D", +, + * $Loop 1, 30, 20)
Guictrlsetonevent ( -1, "Pointdefault")
Next
$Button _child = Guictrlcreatebutton ("Configuration Item", $mHeight-40, 70, 25)
Guictrlsetonevent ( -1, "Childgui")
$Button _apply = Guictrlcreatebutton ("Apply Changes", $mHeight-40, 70, 25)
Guictrlsetonevent ( -1, "Writereg")
Guictrlsetstate ( -1, $GUI _disable)
Guisetstate (@SW_SHOW)
#EndRegion ### START Koda GUI Section ###
Endfunc; ==>maingui.

Func Childgui ()
#CS ===================================================================
The following are common matrix arrangement algorithms:
X-axis base coordinates of XBase distance coordinate 0,0
Y-axis Base coordinates of ybase distance coordinate 0,0
X-Axis dimensions + spacing of Xoffset controls
Y-Axis dimension + spacing for Yoffset controls
Scale the row control variable of the Y axis
Matrix coefficients of matrices
Positionx x-Axis coordinates
Positiony y axis coordinates
#CE ===================================================================
Guidelete ($Form _main)
Local Const $Matrix = Round (Sqrt ($AllItem), 0)
Local Const $XOffset = $YOffset = 30
Local Const $XBase = ten, $YBase = 10
Local $Scale = 0
Local Const $cWidth = 481, $cHeight = 241
$Form _child = Guicreate ("Select items to Configure", $cWidth, $cHeight,-1,-1)
Guisetonevent ($GUI _event_close, "Newgui")
Guisetfont (-1, 8, 400, 0, "Microsoft Ya-hei")
Guictrlcreatelabel ("Please tick the items you want to configure in the list below", 10, 15, 300, 20)
For $Loop 4 = 1 to $AllItem
$positionX = $XBase + Mod (($Loop 4-1), $Matrix) * $XOffset
If $positionX = $XBase Then
$Scale = $Scale + 1
EndIf
$positionY = $YBase + $Scale * $YOffset
$TempIndex [$Loop 4-1] = Guictrlcreatecheckbox ($aDict [1][$Loop 4-1], $positionX, $positionY, 90, 20)
Next
While UBound ($aIndex)
Guictrlsetstate ($TempIndex [_arraypop ($aIndex)], $GUI _checked)
Wend
$Button _selectall = Guictrlcreatebutton ("All selected", $cWidth/2 +, $cHeight-40, 50, 25)
Guictrlsetonevent ( -1, "SelectAll")
$Button _unselectall = Guictrlcreatebutton ("All Canceled", $cWidth/2-40, 50, 25)
Guictrlsetonevent ( -1, "Unselectall")
$Button _childexit = Guictrlcreatebutton ("OK", $cWidth/2-$cHeight-40, 60, 30)
Guictrlsetonevent ( -1, "Newgui")
Guisetstate (@SW_SHOW)
Endfunc; ==>childgui.

Func SelectAll ()
For $Loop 6 = 1 to $AllItem
Guictrlsetstate ($TempIndex [$Loop 6-1], $GUI _checked)
Next
Endfunc; ==>selectall.

Func Unselectall ()
For $Loop 7 = 1 to $AllItem
Guictrlsetstate ($TempIndex [$Loop 7-1], $GUI _unchecked)
Next
Endfunc; ==>unselectall.

Func Newgui ()
 dim $aIndex [1]
 for $Loop 5 = 1 to $AllItem
  if guictrlread ($TempIndex [ $Loop 5-1]) = $GUI _checked Then
   _arrayadd ($aIndex, $Loop 5-1)
  endif
  Next
 if UBound ($aIndex) = 1 Then
   $yonc = MsgBox (0x1024, "note", "You have canceled all options" & @CRLF & _
     "This will make the program without configurable items" & @CRLF & _
     "Dot < is > re-select, point < No > Exit this program. "
  if $yonc = 6 Then
   return
  else
   exit
  endif
 endif
 _arraydelete ($aIndex, 0)
  $nNumber = UBound ($aIndex)
  ReDim $avArray [$nNumber][8]
 maingui ()
 guidelete ($Form _child)
endfunc  ;==> Newgui

Func Writereg ()
 for $Loop 3 = 1 to $nNumber
  if $avArray [$Loop 3-1][6] <> "Then
  ;   regwrite ("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders", $avArray [$Loop 3-1][0], "REG_EXPAND_SZ", $avArray [$Loop 3-1][6])
    $avArray [$Loop 3-1][6] = "
   guictrlsetbkcolor ($avArray [$Loop 3-1][4], 0xf0f0f0); Tint
  endif
 next
 guictrlsetstate ($Button _apply, $GUI _disable)
endfunc    ==>writereg

Func pointfolder ()
 local $iIndex, $sNEWFolder
  $iIndex = _arraysearch ($avArray, @GUI_CtrlId, 0, 0, 0, 1, 1, 5)
  $sNEWFolder = Fileselectfolder (Specify new location, "", 7)
 if not @error Then
   $avArray [$iIndex] [6] = $sNEWFolder
  guictrlsetdata ($avArray [$iIndex][4], $sNEWFolder)
   Guictrlsetbkcolor ($avArray [$iIndex][4], 0xd5f0f0); Tint slightly darker
  guictrlsetstate ($Button _apply, $GUI _enable)
 endif
endfunc  ;==> Pointfolder

Func Pointdefault ()
Local $iIndex, $sNEWFolder
$iIndex = _arraysearch ($avArray, @GUI_CtrlId, 0, 0, 0, 1, 1, 7)
$sNEWFolder = RegRead ("hkey_users\.") Default\software\microsoft\windows\currentversion\explorer\user Shell Folders ", $avArray [$iIndex][0])
If not @error Then
$sTempNEWFolder = StringReplace ($sNEWFolder, "%USERPROFILE%", $HomeEnvironment)
$avArray [$iIndex][6] = $sTempNEWFolder
Guictrlsetdata ($avArray [$iIndex][4], $sTempNEWFolder)
Else
$avArray [$iIndex][6] = ""
Guictrlsetdata ($avArray [$iIndex][4], "")
EndIf
Guictrlsetbkcolor ($avArray [$iIndex][4], 0xd5f0f0); Slightly darker tint
Guictrlsetstate ($Button _apply, $GUI _enable)
Endfunc; ==>pointdefault.

Func Close ()
Exit
Endfunc; ==>close.

Screenshot2.png (30.95 KB)

2008-6-1 21:04

Package Download Autotipersonal.v0.3.b080601.rar

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.