Compare commits
4 Commits
57e132fafd
...
1.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
05800d08a9 | ||
|
|
7d967c7f33 | ||
|
|
1dd0557970 | ||
| 1e77871bd8 |
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Chromedriver-Mover.exe
|
||||||
71
Chromedriver-Mover-Compiler.ahk
Normal file
71
Chromedriver-Mover-Compiler.ahk
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
;---ENVIRONMENT---------------------------------------------------------------------
|
||||||
|
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
|
||||||
|
;#Warn ; Enable warnings to assist with detecting common errors.
|
||||||
|
;DetectHiddenWindows, On
|
||||||
|
#SingleInstance, Force
|
||||||
|
DetectHiddenWindows, ON
|
||||||
|
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
|
||||||
|
; Menu, Tray, Icon, RMScriptManager.ico
|
||||||
|
|
||||||
|
;---Notes/Extra Info/#Includes------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
;---VARIABLES-----------------------------------------------------------------------
|
||||||
|
|
||||||
|
;---MAIN SCRIPT---------------------------------------------------------------------
|
||||||
|
|
||||||
|
AHKFilepath = %A_ScriptDir%\Chromedriver-Mover.ahk
|
||||||
|
Exefilepath = %A_ScriptDir%\Chromedriver-Mover.exe
|
||||||
|
icopath = %A_ScriptDir%\Chromedriver-Mover.ico
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; Kill any active intances of the uploaders so the .exe file can be overwriten by the compilation
|
||||||
|
process, close, Chromedriver-Mover.exe
|
||||||
|
|
||||||
|
sleep, 1000
|
||||||
|
|
||||||
|
; Delete the .exe file so it can be repalced
|
||||||
|
if(FileExist(Exefilepath)){
|
||||||
|
FileDelete, %Exefilepath%
|
||||||
|
if(ErrorLevel){
|
||||||
|
msgbox, failed to delete Exe file. Please delete manually and re-run the compiler.
|
||||||
|
ExitApp
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(!FileExist(AHKFilepath)){
|
||||||
|
msgbox, %AHKFilepath% does not exist`nExiting
|
||||||
|
ExitApp
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(!FileExist(icopath)){
|
||||||
|
msgbox, %icopath% does not exist`nExiting
|
||||||
|
ExitApp
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
run, %comspec% /c ""C:\Program Files\AutoHotkey\Compiler\Ahk2Exe.exe" /in "%AHKFilepath%" /out "%exefilepath%" /icon "%icopath%""
|
||||||
|
|
||||||
|
ExitApp
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;---FUNCTIONS-----------------------------------------------------------------------
|
||||||
133
Chromedriver-Mover.ahk
Normal file
133
Chromedriver-Mover.ahk
Normal file
@@ -0,0 +1,133 @@
|
|||||||
|
; 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
|
||||||
|
|
||||||
|
if(InStr(A_ScriptFullPath, ".ahk")){
|
||||||
|
try Menu, Tray, Icon, %A_ScriptDir%\Assets\icon.ico
|
||||||
|
}
|
||||||
|
|
||||||
|
; Menu, Tray, Icon, C:\Users\%A_Username%\Syncthing\Git\Copy-ChromeDriver-To-Program-Files\Assets\icon.ico
|
||||||
|
|
||||||
|
ChromeDriverTemporaryFilepath = %1%
|
||||||
|
|
||||||
|
; Msgbox % "Passed in ChromeDriverTemporaryFilepath: " ChromeDriverTemporaryFilepath
|
||||||
|
|
||||||
|
; msgbox
|
||||||
|
; VARIABLES
|
||||||
|
;------------------------------------------------
|
||||||
|
SettingsFilepath = %A_ScriptDir%\ChromedriverMover.ini
|
||||||
|
|
||||||
|
; Msgbox % "SettingsFilepath: " SettingsFilepath
|
||||||
|
if(ChromeDriverTemporaryFilepath)
|
||||||
|
IniWrite, %ChromeDriverTemporaryFilepath%, %SettingsFilepath%, Selenium, ChromeDriverTemporaryFilepath
|
||||||
|
|
||||||
|
|
||||||
|
; MAIN SCRIPT
|
||||||
|
;------------------------------------------------
|
||||||
|
StartScriptAsAdmin()
|
||||||
|
|
||||||
|
if(ChromeDriverTemporaryFilepath = "")
|
||||||
|
IniRead, ChromeDriverTemporaryFilepath, %SettingsFilepath%, Selenium, ChromeDriverTemporaryFilepath
|
||||||
|
|
||||||
|
|
||||||
|
ChromeDriverProgramFilesFilepath = C:\Program Files\SeleniumBasic\chromedriver.exe
|
||||||
|
|
||||||
|
|
||||||
|
if(FileExist(ChromeDriverProgramFilesFilepath)){
|
||||||
|
|
||||||
|
FileDelete, %ChromeDriverProgramFilesFilepath%
|
||||||
|
if(ErrorLevel){
|
||||||
|
msgbox, failed to delete old chromedriver from: C:\Program Files\SeleniumBasic\chromedriver.exe. Please make sure all Selenium Connected instances of Chromium are closed and then try again or move the Chromedriver.exe file manually from:`n%ChromeDriverTemporaryFilepath%
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(FileExist(ChromeDriverProgramFilesFilepath)){
|
||||||
|
msgbox, failed to delete old chromedriver from: C:\Program Files\SeleniumBasic\chromedriver.exe. Please run this program as admin or move the chromedriver manually from:`n%ChromeDriverTemporaryFilepath%
|
||||||
|
ExitApp
|
||||||
|
}
|
||||||
|
|
||||||
|
; msgbox, pause
|
||||||
|
|
||||||
|
; Msgbox % "ChromeDriverTemporaryFilepath: " ChromeDriverTemporaryFilepath
|
||||||
|
|
||||||
|
if(!InStr(ChromeDriverTemporaryFilepath, ".exe")){ ; parent directory passed in instead of exact filepath. Loop through directory contents and find the .exe file
|
||||||
|
|
||||||
|
Loop, files, %ChromeDriverTemporaryFilepath%\*.*, DFR
|
||||||
|
{ ; D = Directories, F = Files, R = Recursive
|
||||||
|
|
||||||
|
SplitPath, A_LoopFileFullPath, FileNameWExt, FileDir, FileExt, FileNameNoExt,
|
||||||
|
|
||||||
|
if(FileNameWExt = "chromedriver.exe"){
|
||||||
|
ChromeDriverTemporaryFilepath := A_LoopFileFullPath
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!InStr(ChromeDriverTemporaryFilepath, ".exe")){
|
||||||
|
msgbox, Failed to find chromedriver.exe to move. Please move the chromedriver manually.
|
||||||
|
ExitApp
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FileCopy, %ChromeDriverTemporaryFilepath%, %ChromeDriverProgramFilesFilepath%, 1
|
||||||
|
if(ErrorLevel){
|
||||||
|
msgbox, unable to copy chromedriver.exe from: `n%ChromeDriverTemporaryFilepath%`nto:`n%ChromeDriverProgramFilesFilepath%
|
||||||
|
ExitApp
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(!FileExist(ChromeDriverProgramFilesFilepath)){
|
||||||
|
msgbox, failed to move chromedriver to %ChromeDriverProgramFilesFilepath%. Please run this program as admin or move the chromedriver manually.
|
||||||
|
ExitApp
|
||||||
|
}
|
||||||
|
|
||||||
|
; clear the settings file
|
||||||
|
IniWrite, %A_Tab%, %SettingsFilepath%, Selenium, ChromeDriverTemporaryFilepath
|
||||||
|
|
||||||
|
ExitApp
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; 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
|
||||||
BIN
Chromedriver-Mover.ico
Normal file
BIN
Chromedriver-Mover.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 179 KiB |
@@ -20,9 +20,9 @@ IfMsgBox Yes, {
|
|||||||
; Open Instructions Gitea page
|
; Open Instructions Gitea page
|
||||||
|
|
||||||
if(InStr(A_ScriptName, "Video"))
|
if(InStr(A_ScriptName, "Video"))
|
||||||
URL = https://git.freedomainplaylists.com/yuriy/Freedomain-Video-Uploader#installation
|
URL = https://freedomain.dev/yuriy/video-uploader#installation
|
||||||
else,
|
else,
|
||||||
URL = https://freedomain.dev/yuriy/social-media-poster
|
URL = https://freedomain.dev/yuriy/social-media-poster#installation
|
||||||
|
|
||||||
run, %URL%
|
run, %URL%
|
||||||
run, "%A_ScriptFullPath%" "LastPost"
|
run, "%A_ScriptFullPath%" "LastPost"
|
||||||
|
|||||||
Reference in New Issue
Block a user