Satechnology
Новичок
- Сообщения
- 3
- Репутация
- 0
Приветствую.
Пишу скрипт следующего содержания:
#NoTrayIcon
#include <GuiConstantsEx.au3>
#include <TreeViewConstants.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
;------------------------------------------------------------------
$NameLnk = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{6239CC93-2A9C-4653-BF2C-5B33687432B5}", "")
$GUI=GUICreate("",400,265)
$INPUT1=GUICtrlCreateInput("",85,110,305,25)
$INPUT2=GUICtrlCreateInput($NameLnk,85,140,305,25)
$BUTTON=GUICtrlCreateButton("Сохранить и выйти",10,225,150,25)
;------------------------------------------------------------------
GuiCtrlCreateLabel("Имя ярлыка:", 10, 145)
GUISetState()
GuiCtrlCreateLabel("Пароль:", 10, 115)
GUISetState()
GuiCtrlCreateGroup("", 2, 95, 396, 80)
GuiCtrlCreatePic("100.gif",0,0, 400,100)
;------------------------------------------------------------------
$1Stlnk = RegRead ("HKEY_CURRENT_USER\Software\FolderProtect", "1-Stlnk")
$2Stlnk = RegRead ("HKEY_CURRENT_USER\Software\FolderProtect", "2-Stlnk")
$Radio1 = GuiCtrlCreateCheckbox ("Отображать ярлык в окне Мой компьютер", 20, 180, 250, 20)
$Radio2 = GuiCtrlCreateCheckbox ("Отображать ярлык на рабочем столе", 20, 200, 250, 20)
;------------------------------------------------------------------
If $1Stlnk = 1 Then
$Radio1 = GuiCtrlSetState($Radio1, $GUI_CHECKED)
;Else
;$Radio1 = GuiCtrlSetState(-0, $GUI_CHECKED)
EndIf
;------------------------------------------------------------------
If $2Stlnk = 1 Then
$Radio2 = GuiCtrlSetState($Radio2, $GUI_CHECKED)
;Else
;$Radio1 = GuiCtrlSetState(-0, $GUI_CHECKED)
EndIf
;------------------------------------------------------------------
while true
Switch GUIGetMsg()
case -3
exitloop
case $BUTTON
RegWrite("HKEY_CURRENT_USER\Software\FolderProtect", "", "REG_SZ", GUICtrlRead($INPUT2))
RegWrite("HKEY_CURRENT_USER\Software\FolderProtect", "NameLnk", "REG_SZ", GUICtrlRead($INPUT2))
RegWrite("HKEY_CURRENT_USER\Software\FolderProtect", "Pass", "REG_SZ", GUICtrlRead($INPUT1))
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{6239CC93-2A9C-4653-BF2C-5B33687432B5}", "", "REG_SZ", GUICtrlRead($INPUT2))
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{6239CC93-2A9C-4653-BF2C-5B33687432B5}", "InfoTip", "REG_SZ", GUICtrlRead($INPUT2))
;------------------------------------------------------------------
If GUICtrlRead($Radio1) = $GUI_CHECKED Then
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{6239CC93-2A9C-4653-BF2C-5B33687432B5}", "", "REG_SZ", "")
RegWrite("HKEY_CURRENT_USER\Software\FolderProtect", "1-Stlnk", "REG_SZ", "1")
Else
RegDelete("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{6239CC93-2A9C-4653-BF2C-5B33687432B5}")
RegWrite("HKEY_CURRENT_USER\Software\FolderProtect", "1-Stlnk", "REG_SZ", "0")
EndIf
; ------------------------------------------------------------------
If GUICtrlRead($Radio2) = $GUI_CHECKED Then
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\{6239CC93-2A9C-4653-BF2C-5B33687432B5}", "", "REG_SZ", GUICtrlRead($INPUT2))
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{6239CC93-2A9C-4653-BF2C-5B33687432B5}", "", "REG_SZ", GUICtrlRead($INPUT2))
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{6239CC93-2A9C-4653-BF2C-5B33687432B5}", "InfoTip", "REG_SZ", GUICtrlRead($INPUT2))
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{6239CC93-2A9C-4653-BF2C-5B33687432B5}\InprocServer32}")
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{6239CC93-2A9C-4653-BF2C-5B33687432B5}\shell")
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{6239CC93-2A9C-4653-BF2C-5B33687432B5}\TypeLib", "", "REG_SZ", "{6239CC93-2A9C-4653-BF2C-5B33687432B5}")
RegWrite("HKEY_CURRENT_USER\Software\FolderProtect", "2-Stlnk", "REG_SZ", "1")
Else
RegDelete("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\{6239CC93-2A9C-4653-BF2C-5B33687432B5}")
RegWrite("HKEY_CURRENT_USER\Software\FolderProtect", "2-Stlnk", "REG_SZ", "0")
EndIf
;------------------------------------------------------------------
;MsgBox(4096, "Program files are in:",GUICtrlRead($Radio2))
Exit
EndSwitch
wend
;------------------------------------------------------------------
;FileClose($FILE)
Скрипт работает нормально при первом запуске, но когда запускаю скрипт второй раз то при нажатии на Сохранить и выйти $Radio1 и $Radio2 возвращает ноль, а должно возвращать 1
Пишу скрипт следующего содержания:
#NoTrayIcon
#include <GuiConstantsEx.au3>
#include <TreeViewConstants.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
;------------------------------------------------------------------
$NameLnk = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{6239CC93-2A9C-4653-BF2C-5B33687432B5}", "")
$GUI=GUICreate("",400,265)
$INPUT1=GUICtrlCreateInput("",85,110,305,25)
$INPUT2=GUICtrlCreateInput($NameLnk,85,140,305,25)
$BUTTON=GUICtrlCreateButton("Сохранить и выйти",10,225,150,25)
;------------------------------------------------------------------
GuiCtrlCreateLabel("Имя ярлыка:", 10, 145)
GUISetState()
GuiCtrlCreateLabel("Пароль:", 10, 115)
GUISetState()
GuiCtrlCreateGroup("", 2, 95, 396, 80)
GuiCtrlCreatePic("100.gif",0,0, 400,100)
;------------------------------------------------------------------
$1Stlnk = RegRead ("HKEY_CURRENT_USER\Software\FolderProtect", "1-Stlnk")
$2Stlnk = RegRead ("HKEY_CURRENT_USER\Software\FolderProtect", "2-Stlnk")
$Radio1 = GuiCtrlCreateCheckbox ("Отображать ярлык в окне Мой компьютер", 20, 180, 250, 20)
$Radio2 = GuiCtrlCreateCheckbox ("Отображать ярлык на рабочем столе", 20, 200, 250, 20)
;------------------------------------------------------------------
If $1Stlnk = 1 Then
$Radio1 = GuiCtrlSetState($Radio1, $GUI_CHECKED)
;Else
;$Radio1 = GuiCtrlSetState(-0, $GUI_CHECKED)
EndIf
;------------------------------------------------------------------
If $2Stlnk = 1 Then
$Radio2 = GuiCtrlSetState($Radio2, $GUI_CHECKED)
;Else
;$Radio1 = GuiCtrlSetState(-0, $GUI_CHECKED)
EndIf
;------------------------------------------------------------------
while true
Switch GUIGetMsg()
case -3
exitloop
case $BUTTON
RegWrite("HKEY_CURRENT_USER\Software\FolderProtect", "", "REG_SZ", GUICtrlRead($INPUT2))
RegWrite("HKEY_CURRENT_USER\Software\FolderProtect", "NameLnk", "REG_SZ", GUICtrlRead($INPUT2))
RegWrite("HKEY_CURRENT_USER\Software\FolderProtect", "Pass", "REG_SZ", GUICtrlRead($INPUT1))
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{6239CC93-2A9C-4653-BF2C-5B33687432B5}", "", "REG_SZ", GUICtrlRead($INPUT2))
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{6239CC93-2A9C-4653-BF2C-5B33687432B5}", "InfoTip", "REG_SZ", GUICtrlRead($INPUT2))
;------------------------------------------------------------------
If GUICtrlRead($Radio1) = $GUI_CHECKED Then
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{6239CC93-2A9C-4653-BF2C-5B33687432B5}", "", "REG_SZ", "")
RegWrite("HKEY_CURRENT_USER\Software\FolderProtect", "1-Stlnk", "REG_SZ", "1")
Else
RegDelete("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{6239CC93-2A9C-4653-BF2C-5B33687432B5}")
RegWrite("HKEY_CURRENT_USER\Software\FolderProtect", "1-Stlnk", "REG_SZ", "0")
EndIf
; ------------------------------------------------------------------
If GUICtrlRead($Radio2) = $GUI_CHECKED Then
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\{6239CC93-2A9C-4653-BF2C-5B33687432B5}", "", "REG_SZ", GUICtrlRead($INPUT2))
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{6239CC93-2A9C-4653-BF2C-5B33687432B5}", "", "REG_SZ", GUICtrlRead($INPUT2))
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{6239CC93-2A9C-4653-BF2C-5B33687432B5}", "InfoTip", "REG_SZ", GUICtrlRead($INPUT2))
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{6239CC93-2A9C-4653-BF2C-5B33687432B5}\InprocServer32}")
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{6239CC93-2A9C-4653-BF2C-5B33687432B5}\shell")
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{6239CC93-2A9C-4653-BF2C-5B33687432B5}\TypeLib", "", "REG_SZ", "{6239CC93-2A9C-4653-BF2C-5B33687432B5}")
RegWrite("HKEY_CURRENT_USER\Software\FolderProtect", "2-Stlnk", "REG_SZ", "1")
Else
RegDelete("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\{6239CC93-2A9C-4653-BF2C-5B33687432B5}")
RegWrite("HKEY_CURRENT_USER\Software\FolderProtect", "2-Stlnk", "REG_SZ", "0")
EndIf
;------------------------------------------------------------------
;MsgBox(4096, "Program files are in:",GUICtrlRead($Radio2))
Exit
EndSwitch
wend
;------------------------------------------------------------------
;FileClose($FILE)
Скрипт работает нормально при первом запуске, но когда запускаю скрипт второй раз то при нажатии на Сохранить и выйти $Radio1 и $Radio2 возвращает ноль, а должно возвращать 1