; ; AutoHotkey Version: 1.x ; Language: English ; Platform: Win9x/NT ; Author: A.N.Other ; ; Script Function: ; Template script (you can customize this template by editing "ShellNew\Template.ahk" in your Windows folder) ; ; SetBatchLines -1 #NoTrayIcon ; No icon in system tray #SingleInstance force ; Run script only one time in memory #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. SendMode Input ; Recommended for new scripts due to its superior speed and reliability. SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. ; needs admin rights to start/stop service ; on vista you have to compile with compile_ahk and uac level requireAdministrator If (A_OSVersion != "WIN_VISTA") If Not A_IsAdmin { DllCall("shell32\ShellExecuteA", uint, 0, str, "RunAs", str, A_AhkPath , str, """" . A_ScriptFullPath . """", str, A_WorkingDir, int, 1) ExitApp } ; check this folder IfExist , %A_ScriptDir%\Ad-Aware.exe aaw_path = %A_ScriptDir% ; check %ProgramFiles%\Ad-Aware Else IfExist , %A_ProgramFiles%\Ad-Aware\Ad-Aware.exe aaw_path = %A_ProgramFiles%\Ad-Aware ; check %ProgramFiles%\Lavasoft\Ad-Aware Else IfExist , %A_ProgramFiles%\Lavasoft\Ad-Aware\Ad-Aware.exe aaw_path = %A_ProgramFiles%\Lavasoft\Ad-Aware ; check registry Else RegRead , aaw_path , HKLM , SOFTWARE\Lavasoft\Ad-Aware , instPath ; if not found If (aaw_path == "") _ERROR_EXIT("Ad-Aware is not installed properly!") ; start service if not running Process , Exist , aawservice.exe If (ErrorLevel = 0) { RunWait , net start aawservice , , Hide UseErrorLevel If ErrorLevel _ERROR_EXIT("The command:`nnet start aawservice`nreturned the error level: " . ErrorLevel . " and the last error was: " . A_LastError) } ; start ad-aware Run , %aaw_path%\Ad-Aware.exe ; wait until ad-aware is closed Process , WaitClose , Ad-Aware.exe ; stop service RunWait , net stop aawservice , , Hide UseErrorLevel If ErrorLevel _ERROR_EXIT("The command:`n net stop aawservice`nreturned the error level: " . ErrorLevel . " and the last error was: " . A_LastError) return _ERROR_EXIT(sMSG) { Msgbox , 262160 , %A_ScriptName% , %sMSG% ExitApp }