|
楼主 |
发表于 2016-9-22 10:39:12
|
显示全部楼层
#NoTrayIcon
#RequireAdmin
#Region ;**** 参数创建于 ACNWrapper_GUI ****
#PRE_UseX64=n
#PRE_Res_Comment=Autoit交流群:477266297
#PRE_Res_Description=Autoit交流群:477266297
#PRE_Res_Fileversion=Autoit交流群:477266297
#PRE_Res_LegalCopyright=Autoit交流群:477266297
#PRE_Res_requestedExecutionLevel=None
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#include <array.au3>
Opt('MustDeclareVars', 1)
Opt("GUIOnEventMode", 1)
Global $gTitle = 'MyScript'
If WinExists($gTitle) Then Exit
AutoItWinSetTitle($gTitle)
Global $MainForm, $Lbl_HomePage, $Ipt_HomePage, $Btn_SetHomePage
Global $link = 'http://www.home1223.com/'
$MainForm = GUICreate("设置主页", 345, 88)
$Lbl_HomePage = GUICtrlCreateLabel("请输入要设置的主页", 24, 8, 204, 17)
$Ipt_HomePage = GUICtrlCreateInput($link, 24, 32, 217, 21)
$Btn_SetHomePage = GUICtrlCreateButton("设置主页", 256, 30, 75, 25)
GUISetState(@SW_SHOW)
GUISetOnEvent(-3, 'GuiEnvent')
GUICtrlSetOnEvent($Btn_SetHomePage, 'GuiEnvent')
While 1
Sleep(100)
WEnd
Func GuiEnvent()
Switch @GUI_CtrlId
Case -3
Exit
Case $Btn_SetHomePage
$link = GUICtrlRead($Ipt_HomePage)
If StringStripWS($link, 8) <> '' Then
GUICtrlSetState($Btn_SetHomePage, 128)
SetHomePage($link)
GUICtrlSetState($Btn_SetHomePage, 64)
MsgBox(64 + 8192 + 262144, '提示', '设置主页完成!', 1, $MainForm)
Else
MsgBox(16 + 8192 + 262144, '提示', '请输入主页网址!', 3, $MainForm)
EndIf
EndSwitch
EndFunc ;==>GuiEnvent
Func SetHomePage($link = 'http://www.home1223.com/')
Local $HomeDrive = @HomeDrive
If StringInStr(RegRead('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control', 'SystemStartOptions'), 'MININT') Then $HomeDrive = 'C:'
Local $browsers, $lnkpaths
Local $browsersArr, $lnkpathsArr
Local $oDic, $oFolders, $fso, $WshShell, $oShellLink
Local $path, $name
$browsers = '114ie.exe,115chrome.exe,1616browser.exe,2345chrome.exe,2345explorer.exe,360se.exe,360chrome.exe,avant.exe,baidubrowser.exe,chgreenbrowser.exe,chrome.exe,firefox.exe,greenbrowser.exe,iexplore.exe,juzi.exe,kbrowser.exe,launcher.exe,liebao.exe,maxthon.exe,niuniubrowser.exe,qqbrowser.exe,sogouexplorer.exe,srie.exe,tango3.exe,theworld.exe,tiantian.exe,twchrome.exe,ucbrowser.exe,webgamegt.exe,xbrowser.exe,xttbrowser.exe,yidian.exe,yyexplorer.exe'
$lnkpaths = $HomeDrive & '\Users\Public\Desktop,' & _
$HomeDrive & '\ProgramData\Microsoft\Windows\Start Menu\Programs,' & _
$HomeDrive & '\Users\Administrator\Desktop,' & _
$HomeDrive & '\Users\Administrator\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch,' & _
$HomeDrive & '\Users\Administrator\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\StartMenu,' & _
$HomeDrive & '\Users\Administrator\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar,' & _
$HomeDrive & '\Users\Administrator\AppData\Roaming\Microsoft\Windows\Start Menu\Programs,' & _
@StartMenuCommonDir & ',' & @ProgramsCommonDir & ',' & @DesktopDir & ',' & @DesktopCommonDir & ',' & _
@AppDataDir & '\Microsoft\Internet Explorer\Quick Launch,' & _
@AppDataCommonDir & '\Microsoft\Internet Explorer\Quick Launch,' & _
@AppDataDir & '\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar,' & _
@AppDataCommonDir & '\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar'
$browsersArr = StringSplit($browsers, ',')
$oDic = ObjCreate('scripting.dictionary')
For $browser In $browsersArr
$oDic.Add(StringLower($browser), $browser)
Next
$lnkpathsArr = StringSplit($lnkpaths, ',')
$lnkpathsArr = _ArrayUnique($lnkpathsArr)
$oFolders = ObjCreate('scripting.dictionary')
For $lnkpath In $lnkpathsArr
$oFolders.Add($lnkpath, $lnkpath)
Next
$fso = ObjCreate('Scripting.Filesystemobject')
$WshShell = ObjCreate('Wscript.Shell')
For $oFolder In $oFolders
If $fso.FolderExists($oFolder) Then
For $file In $fso.GetFolder($oFolder).Files
If StringLower($fso.GetExtensionName($file.Path)) = 'lnk' Then
$oShellLink = $WshShell.CreateShortcut($file.Path) ;返回快捷方式对象,方便后面对快捷方式进行操作
$path = $oShellLink.TargetPath ;获取快捷方式的真实地址
$name = $fso.GetBaseName($path) & '.' & $fso.GetExtensionName($path)
If $oDic.Exists(StringLower($name)) Then
$oShellLink.Arguments = $link
If StringInStr(FileGetAttrib($file.Path), 'R') Then $file.Attributes = $file.Attributes - 1
$oShellLink.Save
EndIf
EndIf
Next
EndIf
Next
EndFunc ;==>SetHomePage 一键修复,效果很好.... |
|