Initial Commit of V2.7

This commit is contained in:
2023-01-25 22:10:48 -05:00
parent 66c93e4d01
commit 27d556eb0c
29 changed files with 7145 additions and 2 deletions

View File

@@ -0,0 +1,174 @@
; 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
;Menu, Tray, Icon, ..\Icons\ICONNAMEHERE
; Notes/Extra Info/#Includes
;------------------------------------------------
; https://old.reddit.com/r/PowerShell/comments/nksoh1/keeping_selenium_chromedriver_uptodate/
; VARIABLES
;------------------------------------------------
; MAIN SCRIPT
;------------------------------------------------
#Include C:\Users\%A_UserName%\Documents\Autohotkey\Lib\RunCMD.ahk
#include C:\Users\%A_username%\Documents\Autohotkey\Lib\URLDownloadToVar.ahk
; MAIN SCRIPT
;------------------------------------------------
; MsgBox A_IsAdmin: %A_IsAdmin%`nCommand line: %full_command_line%
; run as admin
full_command_line := DllCall("GetCommandLine", "str")
; Msgbox % "full_command_line: " full_command_line
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 0x40040, Information, Failed to get Administrator Authentication which is only needed for copying the chromedriver.exe file into /Program Files/SeleniumBasic. `n`nPress OK to continue and to just download the chromedriver.exe file to the current folder. `n(You will have to move it manually into /Program Files/Selenium Basic)
}
ToolTip, Downloading Chromedriver for your installed chrome version, 850, 0
; ChromeFilepath = C:\Program Files\Chromium\Application\chrome.exe
IniRead, ChromeFilepath, C:\Users\%A_username%\Documents\Autohotkey\Lib\ScriptSettings.ini, Selenium, %A_Computername%, %A_Space%
; Msgbox % "ChromeFilepath: " ChromeFilepath
if(ChromeFilepath = ""){
if(FileExist("C:\Program Files\Google\Chrome\Application\chrome.exe")){
ChromeFilepath = C:\Program Files\Google\Chrome\Application\chrome.exe
}
else if (FileExist("C:\Program Files (x86)\Google\Chrome\Application\chrome.exe")){
ChromeFilepath = C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
}
else, {
IniRead, ChromeFilepath, C:\Users\%A_username%\Documents\Autohotkey\Lib\ScriptSettings.ini, Selenium, %A_Computername%, "Filepath not found"
if(!FileExist(ChromeFilepath)){
msgbox, Chrome.exe not found. Exiting
ExitApp
}
}
}
; Msgbox % "ChromeFilepath: " ChromeFilepath
/* IniRead, ChromeFilepath, C:\Users\%A_username%\Documents\Autohotkey\Lib\ScriptSettings.ini, Selenium, %A_Computername%, "Filepath not found"
if(!FileExist(ChromeFilepath)){
msgbox, Chrome.exe not found. Exiting
ExitApp
}
*/
; ChromeFilepath = C:\Users\%A_username%\Downloads\chromedriver.exe
; VARIABLES
;------------------------------------------------
ChromeDriverZipSavePath = C:\Users\%A_username%\Downloads\chromedriver.zip
ChromeDriverExeExtractParentFolderPath = C:\Users\%A_username%\Downloads\
ChromeDriverExeExtractedFilepath = %ChromeDriverExeExtractParentFolderPath%chromedriver.exe
ChromeDriverFinalDestination = C:\Program Files\SeleniumBasic\chromedriver.exe
; Msgbox % "ChromeFilepath: " ChromeFilepath
; Check Chrome Version
; ChromeFilepath = C:\Program Files\Chromium\Application\chrome.exe
Command = powershell (Get-Item '%ChromeFilepath%').VersionInfo.ProductVersion
; Command := "powershell (Get-Item 'C:\Program Files\Chromium\Application\chrome.exe').VersionInfo | Select-Object ProductVersion"
Chromeversion := RunCMD(Command)
Chromeversion := SubStr(Chromeversion, 1, 2)
; Msgbox % "Chromeversion: " Chromeversion
; Chromeversion :=
if(Chromeversion = ""){
MsgBox 0x40040, Information, Failed to grab chrome version.`n`nMost Likely reason is that the chrome filepath is incorrect: `nGiven Chrome Filepath:`n%ChromeFilepath%
ExitApp
}
; Msgbox % "Chromeversion: " Chromeversion
; Query what the latest release chromedriver for the current chrome version is
URL = https://chromedriver.storage.googleapis.com/LATEST_RELEASE_%Chromeversion%
URLContents := URLDownloadToVar(URL)
; Msgbox % "URLContents: " URLContents
; Chromedriver is always saved in the following format:
url = https://chromedriver.storage.googleapis.com/%URLContents%/chromedriver_win32.zip
; Donwload chromedriver
UrlDownloadToFile, %url%, %ChromeDriverZipSavePath%
ChromeDriverZipSavePath = '%ChromeDriverZipSavePath%'
ChromeDriverExeExtractPath = '%ChromeDriverExeExtractPath%'
; Extract the downloaded zip file using powershell
Command = powershell Expand-Archive -LiteralPath %ChromeDriverZipSavePath% -DestinationPath %ChromeDriverExeExtractParentFolderPath% -Force
; Clipboard := Command
; Msgbox % "Command: " Command
; Command := "powershell (Get-Item 'C:\Program Files\Chromium\Application\chrome.exe').VersionInfo.ProductVersion"
; Command := "powershell (Get-Item 'C:\Program Files\Chromium\Application\chrome.exe').VersionInfo | Select-Object ProductVersion"
PowerShellReturn := RunCMD(Command)
Msgbox % "PowerShellReturn: " PowerShellReturn
if(!FileExist(ChromeDriverExeExtractedFilepath)){
Msgbox, Extracting failed for some reason. `nYou can find the downloaded .zip file in %ChromeDriverZipSavePath%`n`nClick OK to Exit
ExitApp
}
if(!A_IsAdmin){
Msgbox, Chromedriver was successfully downloaded to:`n %ChromeDriverExeExtractedFilepath%. `n`nPlease copy it over manually to:`n %ChromeDriverFinalDestination%`n`nClick OK to Exit
ExitApp
}
; If run as admin, copy over to Program FIles
if(A_IsAdmin){
FileMove, %ChromeDriverExeExtractedFilepath%, %ChromeDriverFinalDestination%, 1
if(ErrorLevel){
msgbox, Failed to move chromedriver.exe to /Program Files/SeleniumBasic. `n`nMost Likely reason is that ChromeDriver is currently running in the background because of a recently run script. `nPlease Copy it over manually`n`nClick OK to exit.
ExitApp
}
}
msgbox, Chromedriver.exe successfully copied to: `n%ChromeDriverFinalDestination% `n`nClick OK to Exit.
ExitApp
; Functions
;------------------------------------------------

Binary file not shown.

View File

@@ -0,0 +1,92 @@
;---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------------------------------------------------------
; msgbox
;---VARIABLES-----------------------------------------------------------------------
/*ScriptToCompile = %1%
CompileType = %2% ; Testing OR Production
if(CompileType = "")
CompileType = Testing
; Msgbox % "CompileType: " CompileType
if(ScriptToCompile = "")
ExitApp
*/
; Msgbox % "ScriptToCompile: " ScriptToCompile
ScriptToCompile = SocialMediaPoster
; ScriptToCompile = ScriptUpdater
;---MAIN SCRIPT---------------------------------------------------------------------
if(ScriptToCompile = "SocialMediaPoster"){
AHKFilepath = %A_ScriptDir%\..\Freedomain Social Media Poster.ahk
Exefilepath = %A_ScriptDir%\..\Freedomain Social Media Poster.exe
icopath = %A_ScriptDir%\..\Assets\FreedomainSMP.ico
}
if(ScriptToCompile = "ScriptUpdater"){
AHKFilepath = %A_ScriptDir%\..\Tools\Freedomain Program Updater.ahk
Exefilepath = %A_ScriptDir%\..\Tools\Freedomain Program Updater.exe
icopath = %A_ScriptDir%\..\Assets\Update.ico
}
; Kill any active intances of the uploaders so the .exe files can be overwriten by the compilation
run, %A_ScriptDir%\Kill Open Freedomain Programs.ahk
sleep, 500
; 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% /K ""C:\Program Files\AutoHotkey\Compiler\Ahk2Exe.exe" /in "%AHKFilepath%" /out "%exefilepath%" /icon "%icopath%""
; OldNotify(ScriptToCompile,"Compiled Successfully",5)
; sleep, 5000
ExitApp
;---FUNCTIONS-----------------------------------------------------------------------

View File

@@ -0,0 +1,119 @@
;---ENVIRONMENT---------------------------------------------------------------------
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#SingleInstance, Force
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
CoordMode, ToolTip, Screen
CoordMode, Mouse, Screen
FileEncoding, UTF-8-RAW ; Needed for special symbols that are used in video descritions
#Include %A_ScriptDir%\..\Lib\SharedFunctions.ahk
#Include %A_ScriptDir%\..\Lib\Json.ahk
; #Include %A_scriptdir%\RunCMD.ahk
;---VARIABLES-----------------------------------------------------------------------
global driver
; JSVideoDescription = hey there how goes it
WinActivate, ahk_class Chrome_WidgetWin_1
WinGetTitle, Chrome_Window_Title, A
Chrome_Window_Title := StrSplit(Chrome_Window_Title, " - Google Chrome")
Chrome_Window_Title := Chrome_Window_Title[1]
Driver := ConnectToChrome("", ConnectActiveTab := 1, ActiveTabTitle := Chrome_Window_Title) ; open new tab page with with specified profile
;---MAIN SCRIPT---------------------------------------------------------------------
js = return document.querySelector(".header__contain").innerText
try status := driver.executeScript(js)
ExitApp
ConnectToChrome(URL := "", ConnectActiveTab := 0, WinGetActiveChromeTabTitle := ""){
; Msgbox % "WinGetActiveChromeTabTitle: " WinGetActiveChromeTabTitle
IP_Port := "127.0.0.1:9222"
IP_Port_Nr := RegExReplace(IP_Port, ".*:(\d*)", "$1")
if WinExist("ahk_exe Chrome.exe"){
WinGet, pid, PID, ahk_exe chrome.exe
for item in ComObjGet("winmgmts:").ExecQuery("SELECT * FROM Win32_Process WHERE ProcessId='" pid "'"){
if RegExMatch(item.CommandLine, "i)--remote-debugging-port=\K\d+", port){
break
}
}
if (Port=""){
MsgBox, 36, ,Chrome Needs to be started in debugging mode in order for Autohotkey to connect to it.`nIs it ok to restart Chrome in debugmode to enable a connection?
IfMsgBox, Yes
{
Message = Restarting Chrome in Debug Mode
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
While(WinExist("ahk_exe chrome.exe")) {
WinClose, ahk_exe chrome.exe
}
Process, WaitClose, chrome.exe
}
Else{
Msgbox, 4096, Error, Cannot connect to Chrome profile if it is Not running in debug mode. Script Terminating
ExitApp
; @todo: Make this error out to the script result screen
}
}
}
; yuriy's settings
; IniRead, ChromeFilepath, C:\Users\%A_username%\Documents\Autohotkey\Lib\ScriptSettings.ini, Selenium, %A_Computername%, %A_Space%
; Establish Variable with Filepath to be used throughout the script
if(ChromeFilepath = ""){
if(FileExist("C:\Program Files\Google\Chrome\Application\chrome.exe")){
ChromeFilepath = C:\Program Files\Google\Chrome\Application\chrome.exe
}
else if (FileExist("C:\Program Files (x86)\Google\Chrome\Application\chrome.exe")){
ChromeFilepath = C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
}
}
if(ChromeFilepath = ""){
Message = Failed to find chrome.exe in the usual locations.
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
MsgBox 0x30, Error!, Unable to find Chrome.exe in the usual locations. `nScript Exiting.
ExitApp
}
if(!winExist("ahk_exe chrome.exe")){
run, %ChromeFilepath% --remote-debugging-port=%IP_Port_Nr% %URL%
}
Driver := ComObjCreate("Selenium.ChromeDriver")
Driver.SetCapability("debuggerAddress", IP_Port)
try Driver.Start()
catch e {
ShowSeleniumErrorMsgbox()
} ; end of catch
if(ConnectActiveTab){
try TotalTabsFound := Driver.Windows.Count
loop, %TotalTabsFound% {
try SeleniumActiveTabTitle := Driver.Title
; Msgbox % "Title: " Title
if(InStr(WinGetActiveChromeTabTitle, SeleniumActiveTabTitle)){
; msgbox, window match found
break
}
try driver.SwitchToNextWindow ;Focuses Selenium on the newly opened/next window.
}
}
; Save current chrome version to ini file
return Driver
}
; -------------------------------/SChrome_Get-------------------------------

BIN
Tools/ExampleThumbnail.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 231 KiB

View File

@@ -0,0 +1,153 @@
; 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
if(InStr(A_ScriptFullPath, ".ahk"))
Menu, Tray, Icon, %A_scriptdir%\Lib\Update.ico
DetectHiddenWindows, ON
ScriptName = Freedomain Program Updater
ScriptVersion = 1.1
FullScriptName := ScriptName . " " ScriptVersion
; Notes/Extra Info/#Includes
;------------------------------------------------
#Include, %A_scriptdir%\Lib\SharedFunctions.ahk
; Msgbox % "A_ScriptDir: " A_ScriptDir
; VARIABLES
;------------------------------------------------
SettingsIniFileLocation := A_ScriptDir . "\Settings.ini"
ChangelogIniFilepath := A_ScriptDir . "\Lib\FreedomScriptsChangelogINI"
ScriptBackupFolder := A_ScriptDir . "\Lib\Backups"
FileCreateDir, %ScriptBackupFolder%
; FileCreateDir, %ScriptBackupFolder%
ScriptToUpdate = %1% ; script to update is passed through argument.
; Msgbox % "ScriptToUpdate: " ScriptToUpdate
if(ScriptToUpdate = ""){
OnMessage(0x44, "OnMsgBoxSelectProgram")
MsgBox 0x23, %FullScriptName%, Which Program would you like to download an update for?
OnMessage(0x44, "")
IfMsgBox Yes, {
ScriptToUpdate = VideoUploader
} Else IfMsgBox No, {
ScriptToUpdate = SocialMediaPoster
} Else IfMsgBox Cancel, {
ExitApp
}
}
if(!FileExist(SettingsIniFileLocation)){
MsgBox 0x30, , Failed to find Settings.ini file. `nExiting
ExitApp
}
ToolTip, Downloading Updates, 850, 0
; MAIN SCRIPT
;------------------------------------------------
; Check what the current update
; msgbox, here goes?
if(ScriptToUpdate = "VideoUploader"){
ScriptSettingsSection := "VideoUploader"
}
if(ScriptToUpdate = "SocialMediaPoster"){
ScriptSettingsSection := "SocialMediaPoster"
}
; Current Location of the calling script
IniRead, CallingScriptFilepath, %SettingsIniFileLocation%, %ScriptSettingsSection%, Filepath, %A_space%
if(CallingScriptFilepath = ""){
Message = Update Failed`n "CallingScriptFilepath" is blank.`nPlease Submit Error to Yuriy
MsgBox 0x10,, %Message%
return
}
Iniread, CallingScriptUpdateURL, %ChangelogIniFilepath%, %ScriptSettingsSection%, UpdateURL, %A_space%
if(CallingScriptFilepath = ""){
Message = Update Failed`n "ChangelogIniFilepath" is blank.`nPlease Submit Error to Yuriy
MsgBox 0x10,, %Message%
return
}
Iniread, LastPost, %SettingsIniFileLocation%, %ScriptSettingsSection%, LastPost, %A_space%
Iniread, ScriptVersion, %SettingsIniFileLocation%, %ScriptSettingsSection%, ScriptVersion, %A_space%
; Msgbox % "ScriptVersion: " ScriptVersion
; Msgbox % "CallingScriptFilepath: " CallingScriptFilepath
; Msgbox % "CallingScriptUpdateURL: " CallingScriptUpdateURL
; Msgbox % "LastPost: " LastPost
; Kill the scrip if it is currently open, shouldn't be necessary, but just in case
SplitPath, CallingScriptFilepath, ProcessName, OutDir, OutExtension, OutNameNoExt, OutDrive
; SplitPath, InputVar [, OutFileName, OutDir, OutExtension, OutNameNoExt, OutDrive]
Process, Exist, %ProcessName%
if(ErrorLevel){
Process, Close, %ProcessName%
}
; Msgbox % "CallingScriptFilepath: " CallingScriptFilepath
BackupLocation = %ScriptBackupFolder%\%OutNameNoExt%_%ScriptVersion%.%OutExtension%
FileMove, %CallingScriptFilepath%, %BackupLocation%, 1
if(ErrorLevel){
MsgBox 0x10, Failed To Delete, Failed to Delete:`n%ScriptFilepath%`n`nPlease delete it manually and re-run the updater and Select the Program You'd Like to Update.
ExitApp
}
ToolTip, Backup Made to \Backups\ Successfully. `nDownloading New Version, 850, 0
; Download latest file
UrlDownloadToFile, %CallingScriptUpdateURL%, %CallingScriptFilepath%
; IniWrite, Value, Filename, Section, Key
; Update the ini file with the update status
IniWrite, 0, %SettingsIniFileLocation%, %ScriptSettingsSection%, UpdateAvailable
; MsgBox
run, "%CallingScriptFilepath%" "LastPost"
; ExitApp
; MsgBox, done here!
ExitApp
; Functions
;------------------------------------------------
URLDownloadToVar(url){
hObject:=ComObjCreate("WinHttp.WinHttpRequest.5.1")
hObject.Open("GET",url)
hObject.Send()
return hObject.ResponseText
}
OnMsgBoxSelectProgram() {
DetectHiddenWindows, On
Process, Exist
If (WinExist("ahk_class #32770 ahk_pid " . ErrorLevel)) {
ControlSetText Button1, Video Uploader
ControlSetText Button2, Social Media
ControlSetText Button3, Cancel
}
}

Binary file not shown.

View File

@@ -0,0 +1,39 @@
; 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
;Menu, Tray, Icon, ..\Icons\ICONNAMEHERE
; Notes/Extra Info/#Includes
;------------------------------------------------
; VARIABLES
;------------------------------------------------
; MAIN SCRIPT
;------------------------------------------------
process, close, Freedomain Social Media Poster.exe
process, close, Freedomain Video Uploader.exe
ExitApp
; Functions
;------------------------------------------------

106
Tools/Script Updater.ahk Normal file
View File

@@ -0,0 +1,106 @@
; 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
Menu, Tray, Icon, Update.ico
DetectHiddenWindows, ON
ScriptName = Script Updater
ScriptVersion = 1.0
FullScriptName := ScriptName . " " ScriptVersion
;---Changelog------------------------------------------------------
; Fixed Locals not saving successful upload status to correct file
; Added Locals Upload status to Upload Results screen
;---/Changelog------------------------------------------------------
; Notes/Extra Info/#Includes
;------------------------------------------------
#Include, %A_scriptdir%\SharedFunctions.ahk
; VARIABLES
;------------------------------------------------
SettingsIniFileLocation := A_ScriptDir . "\Settings.ini"
ScriptToUpdate = %1%
ScriptToUpdate = VideoUploader
IniRead, DiscordErrorLoggingWebhookBotURL, %SettingsIniFileLocation%, SocialMediaPoster, DiscordErrorLoggingWebhookBotURL, %A_space%
SplitPath, A_scriptdir, OutFileName, ParentDirectory, OutExtension, OutNameNoExt, OutDrive
; MAIN SCRIPT
;------------------------------------------------
; Check what the current update
if(ScriptToUpdate = "VideoUploader"){
; Current Location of the calling script
IniRead, CallingScriptFilepath, %SettingsIniFileLocation%, General, VideoUploaderFilepath
Iniread, CallingScriptUpdateURL, %SettingsIniFilepath%, General, VideoUploaderURL
Iniread, CallingScriptChangelogURL, %SettingsIniFilepath%, General, VideoUploaderChangelogURL
Iniread, CallingScriptCurrentVersion, %SettingsIniFilepath%, General, ScriptVersion
; Iniread, CallingScriptVersion, %SettingsIniFilepath%, General, ScriptVersion
}
if(ScriptToUpdate = "SocialMediaPoster"){
; Current Location of the calling script
IniRead, CallingScriptFilepath, %SettingsIniFileLocation%, SocialMediaPoster, VideoUploaderFilepath
Iniread, CallingScriptUpdateURL, %SettingsIniFilepath%, SocialMediaPoster, VideoUploaderURL
Iniread, CallingScriptCurrentVersion, %SettingsIniFilepath%, SocialMediaPoster, ScriptVersion
}
UpdateChangelog := URLDownloadToVar(CallingScriptChangelogURL)
Msgbox % "UpdateChangelog: " UpdateChangelog
Msgbox % "ScriptToUpdate: " ScriptToUpdate
Msgbox % "CallingScriptFilepath: " CallingScriptFilepath
Msgbox % "CallingScriptUpdateURL: " CallingScriptUpdateURL
Msgbox % "CallingScriptChangelogURL: " CallingScriptChangelogURL
Msgbox % "CallingScriptVersion: " CallingScriptVersion
; Kill the Original Script in order to delete it
WinClose, %ScriptFilepath% ahk_class AutoHotkey
sleep, 500
WinClose, %ScriptFilepath% ahk_class AutoHotkey
; Delete the original file
FileDelete, %ScriptFilepath%
; Functions
;------------------------------------------------
URLDownloadToVar(url){
hObject:=ComObjCreate("WinHttp.WinHttpRequest.5.1")
hObject.Open("GET",url)
hObject.Send()
return hObject.ResponseText
}

BIN
Tools/Script Updater.exe Normal file

Binary file not shown.

View File

@@ -0,0 +1,50 @@
;---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
;Menu, Tray, Icon, ..\Icons\ICONNAMEHERE
;---Notes/Extra Info/#Includes------------------------------------------------------
#include %A_ScriptDir%/../Lib/Schrome.ahk ; used for chrome debugging mode connection
;---VARIABLES-----------------------------------------------------------------------
;---MAIN SCRIPT---------------------------------------------------------------------
driver:= ComObjCreate("Selenium.CHROMEDriver") ;Select and Create Chrome driver instance
driver.AddArgument("disable-infobars") ;Hides 'Chrome is being controlled by automated test software' message
driver.AddArgument("--start-maximized") ; Maximize Chrome Browser
driver.AddArgument("--disable-gpu")
;driver.AddArgument("--headless")
try driver.Get("https://freedomain.com/") ;Open selected URL
catch e {
Msgbox,4096,Error, Unable to connect to Chrome.`n`nPlease check the documentation for how to fix this.
ExitApp
}
try driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding
msgbox,4096,Success,If you installed Selenium correctly A chrome window should have opened up and navigated to freedomain.com.`nClick ok to close.
ExitApp
;---FUNCTIONS-----------------------------------------------------------------------