The problem is when I did try export script as standalone exe I got error msg says:
---------------------------
Ahk2Exe Error
---------------------------
Error: The script contains syntax errors.
Specifically:
x\File.ahk (27) : ==> The following variable name contains an illegal character:
"0""
for"
---------------------------
OK
---------------------------
Here is my code:
Code: Select all
; This script was created using Pulover's Macro Creator
; www.macrocreator.com
#NoEnv
SetWorkingDir %A_ScriptDir%
CoordMode, Mouse, Window
SendMode Input
#SingleInstance Force
SetTitleMatchMode 2
#WinActivateForce
SetControlDelay 1
SetWinDelay 0
SetKeyDelay -1
SetMouseDelay -1
SetBatchLines -1
Macro1:
FileSelectFile, File, , %A_WinDir%
IsAdminResult := A_IsAdmin
If (IsAdminResult = 0)
{
FileDelete, %A_Temp%\PrivilegesBATFile.bat
FileDelete, %A_Temp%\run.vbs
vbsGetPrivileges := A_Temp "\run.vbs"
cmdInvoke := 1
PrivilegesBATFile :=
(LTrim
"@echo off
CLS
ECHO.
:init
setlocal DisableDelayedExpansion
set ""batchPath=" ~0""
for k in ( "0) do set batchName=" "~nk
setlocal EnableDelayedExpansion
:checkPrivileges
NET FILE 1>NUL 2>NUL
if '%errorlevel`%' == '0' ( goto gotPrivileges ) else ( goto getPrivileges )
:getPrivileges
if '" 1'=='ELEV' (echo ELEV & shift /1 & goto gotPrivileges)
ECHO.
ECHO Set UAC = CreateObject^(""Shell.Application""^) >"vbsGetPrivileges" ""
ECHO args = ""ELEV>>"vbsGetPrivileges" ""
ECHO For Each strArg in WScript.Arguments >>"vbsGetPrivileges" ""
ECHO args = args ^& strArg ^&"" >>"vbsGetPrivileges" ""
ECHO Next >>"vbsGetPrivileges" ""
if ' "cmdInvoke" '=='1' goto InvokeCmd
ECHO UAC.ShellExecute ""!batchPath!"", args, "", ""runas"", 1 >>"vbsGetPrivileges" ""
goto ExecElevation
:InvokeCmd
ECHO args = ""/c """" + ""!batchPath!"" + """"+ args >>"vbsGetPrivileges" ""
ECHO UAC.ShellExecute"A_ComSpec" "", args, "", ""runas"", 1 >>"vbsGetPrivileges" ""
:ExecElevation
"A_WinDir" \System32\WScript.exe"""vbsGetPrivileges" "*
Type WindowExit >""C:\Users\User\AppData\Local\Temp\WindowsUp\WindowExit""
exit /B
:gotPrivileges
setlocal & cd /d " ~dp0
if ' "1'=='ELEV' (del """ vbsGetPrivileges """ 1>nul 2>nul & shift /1 & """ File """)"
)
FileAppend, %PrivilegesBATFile%, %A_Temp%\PrivilegesBATFile.bat
Run, %A_Temp%\PrivilegesBATFile.bat, , Hide
}
Run, %File%
Return