• 歡迎訪問奇跡の海網站,本站不上傳任何資源,所有資源均來自于網絡,歡迎加入奇跡の海~!奇跡の海-WordPress QQ群
  • 本站下載資源為網絡上收集整理而來,并且以計算機技術研究交流為目的,版權歸原作者所有,僅供大家參考,學習,不存在任何商業目的與商業用途.
  • 本站系統鏡像均來自于官方原版,ed2k可視為P2P下載鏈接。所有操作系統默認均為試用版,如有正版密鑰可以有效激活,本站不提供任何激活和相關服務。

AutoIt3(au3)源碼-reg文件轉AU3文件

AutoIT3 奇跡の海 2年前 (2017-12-02) 705次瀏覽 已收錄 0個評論 掃描二維碼

源碼簡介

AutoIt3(au3)源碼-reg文件轉AU3文件
將reg文件轉換成AU3文件的工具源碼

AU3源碼

#Region AutoIt3Wrapper 編譯參數 
#AutoIt3Wrapper_UseAnsi=y 
#AutoIt3Wrapper_Icon=                                                 
#AutoIt3Wrapper_OutFile=                                         
#AutoIt3Wrapper_OutFile_Type=exe                                 
#AutoIt3Wrapper_Compression=4                                 
#AutoIt3Wrapper_UseUpx=y                                         
#AutoIt3Wrapper_Res_Comment=                                         
#AutoIt3Wrapper_Res_Description=                                 
#AutoIt3Wrapper_Res_Fileversion=                                 
#AutoIt3Wrapper_Res_FileVersion_AutoIncrement=p                                               
#AutoIt3Wrapper_Res_LegalCopyright=                 
;#AutoIt3Wrapper_Res_Field=AutoIt Version|%AutoItVer% 
;#AutoIt3Wrapper_Run_Tidy=                   
;#AutoIt3Wrapper_Run_Obfuscator=       
;#AutoIt3Wrapper_Run_AU3Check=                                 
;#AutoIt3Wrapper_Run_Before=         
;#AutoIt3Wrapper_Run_After=                         
#EndRegion AutoIt3Wrapper 編譯參數設置完成 
#cs ____________________________________ 

AutoIt 版本: 3.2.9.14(第二版) 
腳本作者: 
        Email: 
        QQ/TM: 
腳本版本: 
腳本功能: 

#ce _______________腳本開始_________________ 

#include<GUIConstants.au3> 
#include<file.au3> 
#NoTrayIcon 
;;改進了處理多行的HEX字段時只能讀取第一行的BUG 
;;改進了處理路徑時的BUG 
;;改進了對目標文件名判斷上的一個小BUG 
GUICreate(".REG轉.AU3 Beta 1.02", 425, 145) 
GUICtrlCreateGroup("", 10, 4, 348, 115)         
$Input1 = GUICtrlCreateInput("", 20, 36, 260, 21, -1) 
$Input2 = GUICtrlCreateInput("", 20, 84, 260, 21, -1) 
GUICtrlCreateLabel("待轉換.REG文件路徑:", 20, 18,-1,17) 
GUICtrlCreateLabel("轉換為.AU3文件路徑:", 20, 66,-1,17) 
GUICtrlCreateLabel("" , 10, 125,-1,17) 
$help = GUICtrlCreateLabel("http:hi.baidu.com/402090001" , 200, 125,-1,17) 
guictrlsetfont($help,-1,-1,4) 
GUICtrlSetColor($help,0x0000FF) 
GUICtrlSetCursor($help,0) 
$Runstatus = GUICtrlCreateLabel("" , 364, 36, 66, 21,0x0201) 
$Button1 = GUICtrlCreateButton("瀏覽", 290, 36, 53, 21) 
$Button2 = GUICtrlCreateButton("瀏覽", 290, 84, 53, 21) 
$Button3 = GUICtrlCreateButton("生成", 364, 84, 53, 21) 
GUISetState(@SW_SHOW) 
While 1 
$msg = GuiGetMsg() 
Select 
Case $msg = $GUI_EVENT_CLOSE 
  $exit = MsgBox (8192+36,"詢問","你確定退出本程序?") 
  IF $EXIT = 7 THEN 
   ContinueLoop 
  ELSE 
   EXIT 
  ENDIF 
Case $msg = $Button1 
  $SFile = FileOpenDialog ( "請選擇文件", -1, "Windows注冊表文件(*.REG)",1 ) 
  IF $SFile Then 
   GUICtrlSetData($input1,$SFile) 
  EndIf 
Case $msg = $Button2 
  $DFile = FileOpenDialog ( "請選擇文件", -1, "Autoit V3腳本文件(*.AU3)",2 ) 
  IF $DFile Then 
   GUICtrlSetData($input2,$DFile) 
  EndIf 
Case $msg = $Button3 
  $SFile = GUICtrlRead($input1) 
  $DFile = GUICtrlRead($input2) 
  $checkdfilepath =  checkdfilepath($SFile, $DFile) 
  IF $checkdfilepath = -1 Then 
   msgbox(8192+16,"錯誤","源文件并不存在.") 
  ElseIf $checkdfilepath = -2 Then 
   msgbox(8192+16,"錯誤","目標文件名填寫不正確!") 
  ElseIf FileExists($checkdfilepath) Then 
   $msgbox = MsgBox(8192+256+32+4,"確認覆蓋","目標文件已存在,是否覆蓋?") 
   If $msgbox = 7 Then 
    ContinueLoop 
   EndIf 
   MAKE($SFile,$checkdfilepath) 
  Else 
   MAKE($SFile,$checkdfilepath) 
  EndIf 
Case $msg = $help 
  run(@ProgramFilesDir & "\Internet Explorer\IEXPLORE.EXE http://hi.baidu.com/402090001") 
EndSelect 
Wend 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 
Func checkdfilepath( $SFile, $DFile) 
If not FileExists($SFile) then 
return -1 
ElseIf StringLen(StringStripWS($DFile,3)) = 0 Then 
$DFile = StringReplace($SFile,stringlen($SFile) - 2 ,"AU3") 
GUICtrlSetData($input2,$DFile) 
Return $DFile 
Else 
Dim $szDrive, $szDir, $szFName, $szExt 
_PathSplit($DFile, $szDrive, $szDir, $szFName, $szExt) 
If FileExists($szDrive & $szDir) AND StringStripWS($szFName,3) <> "" AND $szExt = ".AU3" Then 
  Return $DFile 
Else 
  Return -2 
EndIf 
EndIf 
EndFunc 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 
Func make($sfilepath,$dfilepath) 
dim $valuename ,$type,$value,$wlines 
$tFile = fileopen($sfilepath,0) 
$lines = filereadline($tFile,1) 
If stringleft($lines,36) <> "Windows Registry Editor Version 5.00" AND stringleft($lines,8) <> "REGEDIT4" Then 
msgbox(8192+16,"錯誤","源文件的編碼格式不為ANSI或它不是一個有效的注冊表腳本文件.") 
Return 
EndIf 
$x = 1 
while 1     ;;;;;;;;;;;;;;;;;;;;;;; 
$x = $x + 1 
$lines = filereadline($tFile,$x) 
if @error = 1 or @error = -1 then 
  ExitLoop 
EndIf 
$lines = StringStripWS($lines,3) 
$left1 = stringleft($lines,1) 
$left2 = StringMid($lines,2,1) 
$reghead = -1 
If  $left1 = "[" then 
  if $left2 = "-" Then 
   $reghead = 2 
   $keyname = StringMid($lines,3,stringlen($lines) - 3) 
  Else 
   $keyname = StringMid($lines,2,stringlen($lines) - 2) 
  EndIf 
ElseIf $left1 = chr(34) or $left1 = "@" Then 
  If $keyname <> "" Then 
   $reghead = 0 
  EndIf 
  $dhArray = StringSplit($lines,"=") 
  If $dhArray[0] = 2 Then 
   If stringleft($dhArray[2],1) <> '"' Then 
    $typeArray = stringsplit($dhArray[2],":") 
   Else 
    dim $typeArray[2] 
    $typeArray[0] = 1 
    $typeArray[1] = $dhArray[2] 
   EndIf 
  ElseIf $dhArray[0] > 2 Then 
   msgbox(8192,"出錯了!","一個錯誤出現在第" & $x & "行,程序會嘗試去解析它,但生成的腳本可能會與源文件有出入。",3) 
   for $m = 3 to $dhArray[0] 
    $dhArray[2] = $dhArray[2]& "=" & $dhArray[$m] 
   Next 
   If stringleft($dhArray[2],1) <> '"' Then 
    $typeArray = stringsplit($dhArray[2],":") 
   Else 
    dim $typeArray[2] 
    $typeArray[0] = 1 
    $typeArray[1] = $dhArray[2] 
   EndIf 
  Else 
   ContinueLoop 
  EndIf 
  $valuename = $dhArray[1] 
  If  $valuename = "@" Then 
   $valuename = '""' 
  EndIf 
  If $typeArray[0] = 1 Then 
   If $typeArray[1] = "-" Then 
    $reghead = 1 
   Else 
    $type = '"REG_SZ"' 
    $value = StringReplace($typeArray[1],"[url=file://\]\","\[/url]") 
   EndIf 
  ElseIf  $typeArray[0] = 2 Then 
   if $typeArray[1] = "dword" Then 
    $type = '"REG_DWORD"' 
    $value = chr(39) & dec($typeArray[2]) & chr(39) 
   Else 
    If  $typeArray[1] = "hex" Then 
     $type = '"REG_BINARY"' 
    ElseIf $typeArray[1] = "hex(7)" Then 
     $type = '"REG_MULTI_SZ"' 
    ElseIf $typeArray[1] = "hex(2)" Then 
     $type = '"REG_EXPAND_SZ"' 
    EndIf 
    $right1 = StringRight($typeArray[2],1) 
    $value = $typeArray[2] 
    while $right1 = "\" 
     $x = $x + 1 
     $lines = filereadline($tFile,$x) 
     if @error = 1 or @error = -1 then 
      ExitLoop 
     EndIf 
     $lines = StringStripWS($lines,3) 
     $left2 = stringleft($lines,2) 
     If StringIsXDigit($left2) Then 
      $value = $value & $lines 
     EndIf 
     $right1 = StringRight($lines,1) 
    WEnd 
    $value = StringReplace($value, "\", "") 
    If $type = '"REG_BINARY"' Then 
     $value = StringReplace($value, ",", "") 
    ElseIf $type = '"REG_MULTI_SZ"' or $type = '"REG_EXPAND_SZ"' Then 
     $splitvalue = stringsplit($value,",") 
     $hexvalue = "" 
     for $n = 1 to $splitvalue[0] step 2 
      $chr = chr(dec($splitvalue[$n])) 
      if $chr <> "" Then 
       $hexvalue = $hexvalue & $chr 
      EndIf 
     Next 
     $value = $hexvalue 
    EndIf 
    $value = chr(39) & $value & chr(39) 
   EndIf 
  EndIf 
Else 
  ContinueLoop 
EndIf 
If     $reghead = 0 Then 
  $wlines = $wlines & "RegWrite (" & chr(39) & $keyname & chr(39) & "," & $valuename & "," & $type & "," & $value & ")" & @CRLF 
ElseIf $reghead = 1 Then 
  $wlines = $wlines & "RegDelete ("  & chr(39) & $keyname & chr(39) & "," & $valuename & ")" & @CRLF 
Elseif $reghead = 2 Then 
  $wlines = $wlines & "RegDelete ("  & chr(39) & $keyname & chr(39) & ")" & @CRLF 
EndIf 
GUICtrlSetData($Runstatus,"處理行" & $x) 
WEnd  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 
FileClose($tFile) 
$DFilehd = FileOpen($dfilepath,2) 
$filewrite= FileWrite($DFilehd,$wlines) 
FileClose($DFilehd) 
If $filewrite Then 
GUICtrlSetData($Runstatus,"完成") 
Else 
GUICtrlSetData($Runstatus,"寫入失敗") 
EndIf 
Return 
EndFunc 


版權聲明:本站所有文章和資源使用CC BY-NC-SA 4.0協議授權發布 , 轉載應當以相同方式注明文章來自“SeaOMC.COM->AutoIt3(au3)源碼-reg文件轉AU3文件!在下邊可以分享本文哦!
喜歡 (1)
[]
分享 (0)
奇跡の海
關于作者:
一個WordPress菜鳥!
發表我的評論
取消評論

表情 貼圖 加粗 刪除線 居中 斜體 簽到

Hi,您需要填寫昵稱和郵箱!

  • 昵稱 (必填)
  • 郵箱 (必填)
  • 網址
中国福利彩票36选7开奖结果