找回密码
 加入
搜索
查看: 4179|回复: 2

[AU3基础] Autohotkey語法變更

[复制链接]
发表于 2014-11-27 21:13:54 | 显示全部楼层 |阅读模式
本帖最后由 FMP 于 2014-12-3 14:34 编辑

小弟還有一個Autohotkey語法需改成AutoIT語法
請各位指導小弟要怎麼修改
謝謝~
If ( A_OSVersion = "WIN_XP" or A_OSVersion = "WIN_VISTA" ) {

 
  If (UserDomain = "AAA")
  {
    VMOK := InStr(A_ComputerName,"VM",false,1)
    If (VMOK = 1)
    {
      Gosub, PreinstallAAA
    }
    NBOK := InStr(A_ComputerName,"NB",false,1)
    If (NBOK = 1)
    {
      Gosub, PreinstallAAA
    }
    PCOK := InStr(A_ComputerName,"PC",false,1)
    If (PCOK = 1)
    {
      Gosub, PreinstallAAA
    }
  } else { 
    Gosub, PreinstallnotAAA
  } 
} else {
  return
}
return

PreinstallAAA:
Location = \\100.10.1.10\public\Software\share
file1 = Preinstall.gif
FileGetSize, size1, %A_ProgramFiles%\%file1%
        if ( size1 != 4075 )
        { 
        Filecopy, %Location%\%file1%, C:\Program Files, 1
        Sleep, 100
        }
Subject = Preinstallation check --by AAAMIS
SetTitleMatchMode, 2
SetTitleMatchMode, fast
SplashImage, C:\Program Files\%file1% ,b2 fmn18 fs12, ,%Subject% ,Wintitle999
WinMove, Wintitle999, , 0, 0
RunAs, abc, 1qaz2wsx, AAA
Runwait, at /delete /yes,,hide
Runwait, at 12:05 /interactive /every:Monday`,Tuesday`,Wednesday`,Thursday`,Friday "%Location%\Function_copy_desktop_tool.exe",,hide
Runwait, at 12:22 /interactive /every:Wednesday "%Location%\Function_Wed_5S_Notice.exe",,hide
Runwait, at 12:45 /interactive /every:Monday`,Tuesday`,Wednesday`,Thursday`,Friday "C:\Program Files\ccleaner_zip.exe",,hide
Runwait, at 11:59 /interactive /every:Monday`,Tuesday`,Wednesday`,Thursday`,Friday "%Location%\Install_McAfee_ENG.exe",,hide
Runwait, %comspec% /c "net localgroup "Administrators" /delete TOT\%username%", ,hide
Runwait, %comspec% /c "net localgroup "Power Users" /add "TOT\Domain Users"", ,hide
Runwait, %comspec% /c "net localgroup "Administrators" /add "TOT\MIS-FIX"", ,hide
Runwait, %comspec% /c "net localgroup "Administrators" /add "TOT\TECH-Maintain"", ,hide
SplashImage, OFF


RunAs

Run, %comspec% /c "gpupdate /force", ,hide
Run, %comspec% /c "wuauclt /detectnow", ,hide
Runwait, %Location%\AUTO-TOOLS\Install_McAfee.exe
RegRead, OutputVar, HKEY_LOCAL_MACHINE, SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{23170F69-40C1-2701-0465-000001000000}, DisplayName
if(OutputVar = "7-Zip 4.65")
{
  ;do nothing
} else {
        Runwait, %Location%\AUTO-TOOLS\Install_7-zip.exe
}
Runwait, %Location%\AUTO-TOOLS\Install_Adobe_Reader_9_update.exe
Runwait, %Location%\AUTO-TOOLS\Install_adobe_flash_player.exe
return

PreinstallnotAAA:
Location = \\100.10.1.10\public\Software\share
Runwait, at /delete /yes,,hide
Runwait, at 12:05 /interactive /every:Monday`,Tuesday`,Wednesday`,Thursday`,Friday "%Location%\Function_copy_desktop_tool.exe",,hide
return
 楼主| 发表于 2014-12-3 14:34:32 | 显示全部楼层
懇請各位幫幫忙了!!
 楼主| 发表于 2014-12-15 21:34:22 | 显示全部楼层
小弟有嘗試改了一些
請各位幫我看看哪裡改的對不對
#include <GUIConstantsEx.au3>

@OSVersion = "WIN_XP" Or  @OSVersion = "WIN_7" 

  
 @LogonDomain= "AAA"
  {
    ;判別VM
    VMOK := InStr(A_ComputerName,"VM",false,1)
    If (VMOK = 1)
    {
      Gosub, PreinstallAAA
    }
    ;判別NB
    NBOK := InStr(A_ComputerName,"NB",false,1)
    If (NBOK = 1)
    {
      Gosub, PreinstallAAA
    }
    ;判別PC
    PCOK := InStr(A_ComputerName,"PC",false,1)
    If (PCOK = 1)
    {
      Gosub, PreinstallAAA
    }
  } else { 
    Gosub, PreinstallnotAAA
  } 
} else {
  return
}
return

PreinstallAAA:
$Location = "\\100.10.1.10\public\Software\share"
$file1 = "Preinstall.gif"
$size1 = FileGetSize(@ProgramFilesDir &  $file1)
if ( $size1 <> 4075 ) Then FileCopy($Location & '\' & $file1, @ProgramFilesDir &  $file1, 1)        
Sleep, (100)

$Label1 = GuiCtrlCreateLabel ("Preinstallation check --by (AAA)MIS")
SetTitleMatchMode, 2
SetTitleMatchMode, fast
SplashImage, C:\Program Files\%file1% ,b2 fmn18 fs12, ,%Subject% ,Wintitle999
WinMove, Wintitle999, , 0, 0
RunAs, autorun, qwertyuiop[], AAA
Runwait, at /delete /yes,,hide
Runwait, at 12:05 /interactive /every:Monday`,Tuesday`,Wednesday`,Thursday`,Friday "%Location%\Function_copy_desktop_tool.exe",,hide
Runwait, at 12:22 /interactive /every:Wednesday "%Location%\Function_Wed_5S_Notice.exe",,hide
Runwait, at 12:45 /interactive /every:Monday`,Tuesday`,Wednesday`,Thursday`,Friday "C:\Program Files\ccleaner_zip.exe",,hide
Runwait, at 11:59 /interactive /every:Monday`,Tuesday`,Wednesday`,Thursday`,Friday "%Location%\Install_McAfee.exe",,hide
Runwait, %comspec% /c "net localgroup "Administrators" /delete TOT\%username%", ,hide
Runwait, %comspec% /c "net localgroup "Power Users" /add "TOT\Domain Users"", ,hide
Runwait, %comspec% /c "net localgroup "Administrators" /add "TOT\MIS-FIX"", ,hide
Runwait, %comspec% /c "net localgroup "Administrators" /add "TOT\TECH-Maintain"", ,hide
SplashImage, OFF



RunAs


Run, %comspec% /c "gpupdate /force", ,hide
Run, %comspec% /c "wuauclt /detectnow", ,hide
Runwait( $Location & "\AUTO-TOOLS\Install_McAfee.exe")
$DisplayName=RegRead(" HKEY_LOCAL_MACHINE, SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{23170F69-40C1-2701-0465-000001000000}"," DisplayName")
if $DisplayName > = "7-Zip 4.65")
else 
Runwait( $Location & "\AUTO-TOOLS\Install_7-zip.exe")

Runwait( $Location & "\AUTO-TOOLS\Install_Adobe_Reader_9_update.exe")
Runwait( $Location & "\AUTO-TOOLS\Install_adobe_flash_player.exe")
return

PreinstallnotAAA:
$Location = "\\100.10.1.10\public\Software\share"
Runwait, at /delete /yes,,hide
Runwait, at 12:05 /interactive /every:Monday`,Tuesday`,Wednesday`,Thursday`,Friday "%Location%\Function_copy_desktop_tool.exe",,hide
return
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-12-23 11:44 , Processed in 0.090203 second(s), 22 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表