; ENVIRONMENT ;------------------------------------------------ #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. ;#Warn ; Enable warnings to assist with detecting common errors. ;DetectHiddenWindows, On #SingleInstance, Force SendMode Input ; Recommended for new scripts due to its superior speed and reliability. SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. ;SetKeyDelay, 500 CoordMode, ToolTip, Screen CoordMode, Mouse, Screen ;#NoTrayIcon ; Notes/Extra Info/#Includes ;------------------------------------------------ ; #Include C:\Users\%A_Username%\Syncthing\Scripts\AutoHotKey\RadialMenu\My codes\My Global Variables.ahk ;Menu, Tray, Icon, %A_ICODir%\ICONAME ChromeDriverTemporaryFilepath = %1% ; VARIABLES ;------------------------------------------------ ; MAIN SCRIPT ;------------------------------------------------ StartScriptAsAdmin() chromedriverfplocal = %A_ScriptDir%\chromedriver.exe chromedriverfpProgramFiles = C:\Program Files\SeleniumBasic\chromedriver.exe ; FileDelete, %chromedriverfpProgramFiles% if(FileExist(chromedriverfpProgramFiles)){ msgbox, failed to delete old chromedriver from: C:\Program Files\SeleniumBasic\chromedriver.exe. Please run this program as admin or move the chromedriver manually. ExitApp } msgbox, pause FileCopy, %chromedriverfplocal%, %chromedriverfpProgramFiles%, 1 ; , Dest [, Flag (1 = overwrite)] if(!FileExist(chromedriverfpProgramFiles)){ msgbox, failed to move chromedriver to C:\Program Files\SeleniumBasic\chromedriver.exe. Please run this program as admin or move the chromedriver manually. ExitApp } msgbox, Chromedriver copied successfully. `nPlease run the TestSeleniumPortable script ; Functions ;------------------------------------------------ StartScriptAsAdmin(){ full_command_line := DllCall("GetCommandLine", "str") if not (A_IsAdmin or RegExMatch(full_command_line, " /restart(?!\S)")) { try { if A_IsCompiled Run *RunAs "%A_ScriptFullPath%" /restart else Run *RunAs "%A_AhkPath%" /restart "%A_ScriptFullPath%" } ExitApp } if(!A_IsAdmin){ Msgbox, failed to get admin to move chromedriver to program files Return } } ; Misc ;------------------------------------------------ ; Escape::ExitApp