Created
January 7, 2018 05:42
-
-
Save maz-1/55f193269fc788d754b2e3fafd809a12 to your computer and use it in GitHub Desktop.
A clink helper program
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#NoEnv | |
#NoTrayIcon | |
#singleinstance,force | |
EnvGet, HomePath, HOMEPATH | |
EnvGet, Windir, WINDIR | |
CtrlIsDown := GetKeyState("Ctrl", "P") | |
if (not A_IsAdmin and CtrlIsDown) | |
{ | |
try Run *RunAs "%A_ScriptFullPath%" "%1%" | |
ExitApp | |
} | |
DestPath = %1% | |
If (DestPath <> "" and InStr( FileExist(DestPath), "D")) | |
SetWorkingDir %DestPath% | |
Else | |
SetWorkingDir %HomePath% | |
ClinkPath := "" | |
ThisProcess := DllCall("GetCurrentProcess") | |
If A_PtrSize = 8 | |
{ | |
Msgbox, You should not run this script in a x64 interpreter | |
Exitapp | |
} | |
Loop, Reg, HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall, K | |
{ | |
pos:=RegExMatch(a_LoopRegName,"^clink_\d+(\.\d+)+$") | |
if (pos>0) | |
{ | |
RegRead, ClinkPath, HKEY_LOCAL_MACHINE, SOFTWARE%Wow64%\Microsoft\Windows\CurrentVersion\Uninstall\%a_LoopRegName%, InstallLocation | |
} | |
} | |
ThisProcess := DllCall("GetCurrentProcess") | |
if DllCall("IsWow64Process", "uint", ThisProcess, "int*", IsWow64Process) | |
Exename = clink_x64.exe | |
Else | |
Exename = clink_x86.exe | |
Run, %Windir%\Sysnative\cmd.exe /s /k `"`"%ClinkPath%\%Exename%`" inject --profile ~/clink`" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment