Compare commits
11 Commits
Author | SHA1 | Date |
---|---|---|
Yuriy | 959a81bf98 | 2 weeks ago |
Yuriy | ce9f8a9885 | 2 months ago |
Yuriy | 71c4093bd9 | 3 months ago |
Yuriy | ba33d479ac | 3 months ago |
Yuriy | da34b98324 | 3 months ago |
Yuriy | 9e76ace3c3 | 3 months ago |
Yuriy | fd0b620e23 | 3 months ago |
Yuriy | c7924f7cc7 | 3 months ago |
Yuriy | 8b43ddc8be | 3 months ago |
Yuriy | dbdefc5a95 | 3 months ago |
Yuriy | 613f9d222a | 3 months ago |
Before Width: | Height: | Size: 302 KiB After Width: | Height: | Size: 302 KiB |
@ -0,0 +1,164 @@
|
|||||||
|
;---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------------------------------------------------------
|
||||||
|
#Include, %A_ScriptDir%\Lib\Freedomain-Posters-Shared-Functions\WindowCredentialManager.ahk
|
||||||
|
|
||||||
|
;---VARIABLES-----------------------------------------------------------------------
|
||||||
|
ProgramName = Freedomain Video Uploader
|
||||||
|
ExeProgramName = %ProgramName%.exe
|
||||||
|
AHKFilepath = %A_ScriptDir%\%ProgramName%.ahk
|
||||||
|
Exefilepath = %A_ScriptDir%\%ProgramName%.exe
|
||||||
|
icopath = %A_ScriptDir%\Assets\Icon.ico
|
||||||
|
VersionIniFP = %A_ScriptDir%\Version.ini
|
||||||
|
|
||||||
|
; Generate a new errorlog text file each run
|
||||||
|
FormatTime, TodayDate , YYYYMMDDHH24MISS, yyyyMMdd_hhmmss
|
||||||
|
ErrorLogFilepath = %A_ScriptDir%\Lib\ErrorLogging\Compiler_%TodayDate%.txt
|
||||||
|
|
||||||
|
|
||||||
|
; Read Credential token from Windows Credential Manager using WindowCredentialManager.ahk
|
||||||
|
cred := CredRead("FDR-Gitea-Token")
|
||||||
|
GiteaToken := Cred.Password
|
||||||
|
|
||||||
|
; Info for Creating the Release with Gitea-CreateRelease.ps1
|
||||||
|
CreateReleasePS1Filepath = %A_ScriptDir%\Lib\Freedomain-Posters-Shared-Functions\Gitea-CreateRelease.ps1
|
||||||
|
CreateReleaseAPIURL = https://freedomain.dev/api/v1/repos/yuriy/video-uploader/releases?token=%GiteaToken%
|
||||||
|
|
||||||
|
; Info for Attaching exe file to release using Gitea-AttachAssetToRelease.ps1
|
||||||
|
AttachAssetToReleasePS1Filepath = %A_ScriptDir%\Lib\Freedomain-Posters-Shared-Functions\Gitea-AttachAssetToRelease.ps1
|
||||||
|
AttachAssetToReleaseAPIURL = https://freedomain.dev/api/v1/repos/yuriy/video-uploader/releases
|
||||||
|
|
||||||
|
;---\VARIABLES-----------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; Compile to .exe
|
||||||
|
; ------------------------------------------------
|
||||||
|
; Bump the version number in the version.ini file
|
||||||
|
IniRead, VersionNumber, %VersionIniFP%, Video-Uploader, Version, 0.0 ; , Filename, Section, Key [, Default]
|
||||||
|
VersionNumber += .01
|
||||||
|
VersionNumber := SubStr(VersionNumber, 1, 4)
|
||||||
|
IniWrite, %VersionNumber%, %VersionIniFP%,Video-Uploader, Version
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; Kill any active intances of the uploaders so the .exe file can be overwriten by the compilation
|
||||||
|
process, close, %ExeProgramName%
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
; check if file exists and if not, give user error and stop
|
||||||
|
if(!FileExist(AHKFilepath)){
|
||||||
|
msgbox, %AHKFilepath% does not exist`nExiting
|
||||||
|
ExitApp
|
||||||
|
}
|
||||||
|
|
||||||
|
; check if file exists and if not, give user error and stop
|
||||||
|
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%""
|
||||||
|
Command = "C:\Program Files\AutoHotkey\Compiler\Ahk2Exe.exe" /in "%AHKFilepath%" /out "%exefilepath%" /icon "%icopath%"
|
||||||
|
Results := RunCMD(Command)
|
||||||
|
LogToErrorLogFile(Results, ErrorLogFilepath)
|
||||||
|
|
||||||
|
if(!InStr(Results, "Successfully")){
|
||||||
|
Msgbox, Error, Compilation failed with the following error:`n`n%Results%
|
||||||
|
ExitApp
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; Create new Release on Gitea using Gitea-CreateRelease.ps1
|
||||||
|
; ------------------------------------------------
|
||||||
|
InputBox, ReleaseBody, Release Body, Please Input Text to be used in the Release Body
|
||||||
|
|
||||||
|
ReleaseName := VersionNumber
|
||||||
|
ReleaseTag := VersionNumber
|
||||||
|
|
||||||
|
; Strings with spaces in them need to be surrounted by a single quote and double quote, eg: "'spaced string'"
|
||||||
|
Command = Powershell "%CreateReleasePS1Filepath%" "%CreateReleaseAPIURL%" "%ReleaseName%" "%ReleaseTag%" "'%ReleaseBody%'"
|
||||||
|
|
||||||
|
Message = PowerShell Command to Create Release:`n%Command%
|
||||||
|
LogToErrorLogFile(Message, ErrorLogFilepath)
|
||||||
|
|
||||||
|
Results := RunCMD(Command)
|
||||||
|
Message = API Returned:`n%Results%
|
||||||
|
LogToErrorLogFile(Message, ErrorLogFilepath)
|
||||||
|
|
||||||
|
|
||||||
|
; Pull out the release ID Number, needed for attaching a file to the release
|
||||||
|
SplitText = @{id=
|
||||||
|
SplitText2 = `;
|
||||||
|
ReleaseID := StrSplit(Results, SplitText)[2]
|
||||||
|
ReleaseID := StrSplit(ReleaseID, SplitText2)[1]
|
||||||
|
|
||||||
|
if(ReleaseID = ""){
|
||||||
|
Message = Failed to Grab Release ID`nPlease See Errorlog for Details:`n%ErrorLogFilepath%
|
||||||
|
LogToErrorLogFile(Message, ErrorLogFilepath)
|
||||||
|
Msgbox, %Message%
|
||||||
|
Return
|
||||||
|
}
|
||||||
|
|
||||||
|
Message = ReleaseID: %ReleaseID%
|
||||||
|
LogToErrorLogFile(Message, ErrorLogFilepath)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; Attach .exe File to Release using Gitea-AttachAssetToRelease.ps1
|
||||||
|
; ------------------------------------------------
|
||||||
|
AttachAssetToReleaseAPIURL = %AttachAssetToReleaseAPIURL%/%ReleaseID%/assets
|
||||||
|
|
||||||
|
; Strings with spaces in them need to be surrounted by a single quote and double quote, eg: "'spaced string'"
|
||||||
|
Command = Powershell "%AttachAssetToReleasePS1Filepath%" "%AttachAssetToReleaseAPIURL%" "%GiteaToken%" "'%ExeProgramName%'" "'%Exefilepath%'"
|
||||||
|
LogToErrorLogFile(Command, ErrorLogFilepath)
|
||||||
|
|
||||||
|
Results := RunCMD(Command)
|
||||||
|
Message = API Returned: %Results%
|
||||||
|
LogToErrorLogFile(Message, ErrorLogFilepath)
|
||||||
|
|
||||||
|
|
||||||
|
ExitApp
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;---FUNCTIONS-----------------------------------------------------------------------
|
||||||
|
LogToErrorLogFile(Text, TextFileFilepath){
|
||||||
|
FileAppend, `n%Text%`n, %TextFileFilepath%
|
||||||
|
}
|
@ -1 +1 @@
|
|||||||
Subproject commit 62e8afebb89b3343c7ea48d5eedd94d9c84331eb
|
Subproject commit 95bda715cb2bf2d9dd062e37e61d2dd0a281fcc3
|
@ -1,3 +1,3 @@
|
|||||||
[Video-Uploader]
|
[Video-Uploader]
|
||||||
Version=3.41
|
Version=3.51
|
||||||
Name=Freedomain Video Uploader
|
Name=Freedomain Video Uploader
|
||||||
|
Loading…
Reference in New Issue