Compare commits
15 Commits
b378de8106
...
4a1d2a5d9d
| Author | SHA1 | Date | |
|---|---|---|---|
| 4a1d2a5d9d | |||
| 8447b6009a | |||
| 62e8afebb8 | |||
| e654611bf3 | |||
| 6bf72336d0 | |||
| fd6be690da | |||
| a3d89a9892 | |||
| a5bc6225b6 | |||
| 4ac3c76641 | |||
| 96a8fb9566 | |||
| cf56ae8136 | |||
| 738e1af443 | |||
| f71def4542 | |||
| 20c2f44b0c | |||
| 997ee862ed |
@@ -117,7 +117,7 @@ SendTelegramMessage(token, chatID, text := "", ParseMode := "MarkdownV2")
|
|||||||
json_resp := whr.ResponseText
|
json_resp := whr.ResponseText
|
||||||
whr := ; free COM object
|
whr := ; free COM object
|
||||||
; Msgbox % "json_resp: " json_resp
|
; Msgbox % "json_resp: " json_resp
|
||||||
if(InStr(json_resp, "error_code"))
|
; if(InStr(json_resp, "error_code"))
|
||||||
Return json_resp
|
Return json_resp
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
BIN
Assets/Icon.png
Normal file
BIN
Assets/Icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 22 KiB |
BIN
Assets/Icon.xcf
Normal file
BIN
Assets/Icon.xcf
Normal file
Binary file not shown.
BIN
Assets/Share.png
Normal file
BIN
Assets/Share.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
@@ -128,6 +128,7 @@ DownloadLatestChromium(){
|
|||||||
IfMsgBox OK, {
|
IfMsgBox OK, {
|
||||||
|
|
||||||
} Else IfMsgBox Cancel, {
|
} Else IfMsgBox Cancel, {
|
||||||
|
ToolTip
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -229,7 +230,7 @@ DownloadLatestChromium(){
|
|||||||
; Check if the Copy-ChromeDriver-To-Program-Files.exe file exists
|
; Check if the Copy-ChromeDriver-To-Program-Files.exe file exists
|
||||||
|
|
||||||
; @todo, remove later. this is temporary to fix chromedriver-mover being broken and needing to be replaced
|
; @todo, remove later. this is temporary to fix chromedriver-mover being broken and needing to be replaced
|
||||||
FileDelete, %ChromeDriverMoverEXEFilepath%
|
; FileDelete, %ChromeDriverMoverEXEFilepath%
|
||||||
|
|
||||||
Message = Checking Chromedriver-Mover.exe exists
|
Message = Checking Chromedriver-Mover.exe exists
|
||||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
@@ -310,13 +311,16 @@ DownloadLatestChromium(){
|
|||||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
MsgBox 0x40,, %Message%
|
MsgBox 0x40,, %Message%
|
||||||
|
|
||||||
|
ChromeFilepath := ; clear out chromefilepath variable in case the path changed
|
||||||
|
|
||||||
ToolTip
|
ToolTip
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
CheckForChromeUpdates(ChromeFilepath := ""){
|
||||||
CheckForChromeUpdates(ChromeFilepath := ""){
|
|
||||||
if(ChromeFilepath = "")
|
if(ChromeFilepath = "")
|
||||||
ChromeFilepath := GetInstalledChromeFilepath()
|
ChromeFilepath := GetInstalledChromeFilepath()
|
||||||
|
|
||||||
@@ -330,12 +334,11 @@ DownloadLatestChromium(){
|
|||||||
else, Return 0
|
else, Return 0
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GetInstalledChromeFilepath(){
|
GetInstalledChromeFilepath(){
|
||||||
; ChromeFilepath is global variable
|
; ChromeFilepath is global variable
|
||||||
|
|
||||||
if(ChromeFilepath = ""){
|
if(ChromeFilepath = ""){
|
||||||
|
|
||||||
ChromePortableFilepath = %A_ScriptDir%\Lib\chrome-win64\chrome.exe
|
ChromePortableFilepath = %A_ScriptDir%\Lib\chrome-win64\chrome.exe
|
||||||
@@ -352,22 +355,14 @@ DownloadLatestChromium(){
|
|||||||
SaveOrPostProgress(Message:=Message,PostType:="ErrorLoggingTextFile,DiscordErrorLogging")
|
SaveOrPostProgress(Message:=Message,PostType:="ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
MsgBox 0x10, Chromium Portable not Found, Chromium Portable not found. `nPlease make sure it's located at one of the following paths and then try again.`n`n%ChromePortableFilepath% `nOR`n%ChromePortableFilepath2%
|
MsgBox 0x10, Chrome Not Found, Chrome for Testing not found.`nIf this is your first time running on this computer, please click the "Chrome Up-To-Date" button to download the latest chrome binaries.
|
||||||
|
|
||||||
|
|
||||||
; Leave this in for now, but i don't think we will be going to using the system Chrome in the future.
|
|
||||||
; if(FileExist("C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"))
|
|
||||||
; ChromeFilepath = C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
|
|
||||||
|
|
||||||
; if(FileExist("C:\Program Files\Google\Chrome\Application\chrome.exe"))
|
|
||||||
; ChromeFilepath = C:\Program Files\Google\Chrome\Application\chrome.exe
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ToolTip
|
ToolTip
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GetInstalledChromeVersion(){
|
GetInstalledChromeVersion(){
|
||||||
|
|
||||||
if(ChromeFilepath = ""){
|
if(ChromeFilepath = ""){
|
||||||
GetInstalledChromeFilepath()
|
GetInstalledChromeFilepath()
|
||||||
@@ -380,10 +375,10 @@ DownloadLatestChromium(){
|
|||||||
InstalledChromeVersion := StrReplace(InstalledChromeVersion, "`r") ; replace any newline characters that powershell returns
|
InstalledChromeVersion := StrReplace(InstalledChromeVersion, "`r") ; replace any newline characters that powershell returns
|
||||||
|
|
||||||
return InstalledChromeVersion
|
return InstalledChromeVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GetLatestChromeStableVersion(){
|
GetLatestChromeStableVersion(){
|
||||||
|
|
||||||
; https://github.com/GoogleChromeLabs/chrome-for-testing#json-api-endpoints
|
; https://github.com/GoogleChromeLabs/chrome-for-testing#json-api-endpoints
|
||||||
json_str := urldownloadtovar("https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions.json")
|
json_str := urldownloadtovar("https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions.json")
|
||||||
@@ -400,10 +395,10 @@ DownloadLatestChromium(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
return ChromeStableLatestVersion
|
return ChromeStableLatestVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GetDownloadURLOfChromeAndDriver(InstalledChromeVersion){
|
GetDownloadURLOfChromeAndDriver(InstalledChromeVersion){
|
||||||
; Will return the download URL of Chrome for Testing and Chrome Driver, seperated by a ||
|
; Will return the download URL of Chrome for Testing and Chrome Driver, seperated by a ||
|
||||||
|
|
||||||
; https://github.com/GoogleChromeLabs/chrome-for-testing#json-api-endpoints
|
; https://github.com/GoogleChromeLabs/chrome-for-testing#json-api-endpoints
|
||||||
@@ -450,4 +445,4 @@ DownloadLatestChromium(){
|
|||||||
|
|
||||||
URLS = %chromeDLURL64%||%chromedriverDLURL64%
|
URLS = %chromeDLURL64%||%chromedriverDLURL64%
|
||||||
return URLS
|
return URLS
|
||||||
}
|
}
|
||||||
@@ -605,21 +605,53 @@ GetDateOrdinalSuffix(D) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
; Calculate the aspect ratio of a video/image using the width + height
|
||||||
|
getAspectRatio(width, height) {
|
||||||
|
gcd := gcdFunc(width, height)
|
||||||
|
return round(width/gcd) ":" round(height/gcd)
|
||||||
|
}
|
||||||
|
|
||||||
|
; The gcdFunc() is a helper function that calculates the GCD (greatest common divisor) of two numbers using the Euclidean algorithm.
|
||||||
|
; Used for calculating aspect ratio of Videos
|
||||||
|
gcdFunc(a, b) {
|
||||||
|
while b
|
||||||
|
t := b, b := Mod(a, b), a := t
|
||||||
|
return a
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
; OnMsgbox - Custom Msgbox Screens
|
; OnMsgbox - Custom Msgbox Screens
|
||||||
;------------------------------------------------
|
;------------------------------------------------
|
||||||
|
|
||||||
ConfirmBeforeSubmitMsgboxFunc(){
|
ConfirmBeforeSubmitMsgboxFunc(){
|
||||||
|
/*
|
||||||
|
; Snippet to for check:
|
||||||
|
if (ConfirmBeforeSubmit && ConfirmBeforeSubmitMsgboxFunc() != true) {
|
||||||
|
Message = User Selected STOP button when asked for confirmation. Cancelling Rest of Site Upload.
|
||||||
|
SaveOrPostProgress(Message:=Message, PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
*/
|
||||||
OnMessage(0x44, "OnMsgBoxUserConfirmation")
|
OnMessage(0x44, "OnMsgBoxUserConfirmation")
|
||||||
MsgBox 0x21, User Confirmation, Please check that all data was input correctly and fix any mistakes and then click PROCEED to finalize the Upload.`n`nClick STOP to cancel the rest of this Upload and move on to the next website.
|
MsgBox 0x21, User Confirmation, Please check that all data was input correctly and fix any mistakes and then click PROCEED to finalize the Upload.`n`nClick STOP to cancel the rest of this Upload and move on to the next website.
|
||||||
OnMessage(0x44, "")
|
OnMessage(0x44, "")
|
||||||
IfMsgBox OK, {
|
IfMsgBox OK, {
|
||||||
|
return true
|
||||||
} Else IfMsgBox Cancel, {
|
} Else IfMsgBox Cancel, {
|
||||||
Message = User Selected STOP button when asked for confirmation. Cancelling Rest of Site Upload.
|
Message = User Selected STOP button when asked for confirmation. Cancelling Rest of Site Upload.
|
||||||
Return %Message%
|
Return %Message%
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
OnMsgBoxUpdateAvailable() {
|
OnMsgBoxUpdateAvailable() {
|
||||||
DetectHiddenWindows, On
|
DetectHiddenWindows, On
|
||||||
Process, Exist
|
Process, Exist
|
||||||
|
|||||||
47
Gitea-AttachAssetToRelease.ps1
Normal file
47
Gitea-AttachAssetToRelease.ps1
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
$apiurl=$args[0]
|
||||||
|
$apitoken=$args[1]
|
||||||
|
$filename=$args[2]
|
||||||
|
$filepath=$args[3]
|
||||||
|
|
||||||
|
|
||||||
|
Write-Host "apiurl: $apiurl"
|
||||||
|
Write-Host "apitoken: $apitoken"
|
||||||
|
Write-Host "filename: $filename"
|
||||||
|
Write-Host "filepath: $filepath"
|
||||||
|
|
||||||
|
|
||||||
|
# Load the required .NET assemblies
|
||||||
|
Add-Type -AssemblyName System.Net.Http
|
||||||
|
|
||||||
|
# Create Object and Load the required .NET assemblies
|
||||||
|
$httpClient = New-Object System.Net.Http.HttpClient
|
||||||
|
|
||||||
|
# $url = 'https://git.zinchuk.xyz/api/v1/repos/yuriy/TestRepo/releases/22/assets'
|
||||||
|
# $fileName = 'TestFile58.exe'
|
||||||
|
# $token = '2cf4a54d941'
|
||||||
|
|
||||||
|
$headers = @{
|
||||||
|
'accept' = 'application/json'
|
||||||
|
'Content-Type' = 'multipart/form-data'
|
||||||
|
}
|
||||||
|
|
||||||
|
# $filePath = "C:\Users\yuriy\Syncthing\Git\TestREpo\test.exe"
|
||||||
|
$fileBytes = [System.IO.File]::ReadAllBytes($filePath)
|
||||||
|
$fileStream = [System.IO.MemoryStream]::new($fileBytes)
|
||||||
|
|
||||||
|
$httpClient = [System.Net.Http.HttpClient]::new()
|
||||||
|
$httpClient.DefaultRequestHeaders.Add('Authorization', "Bearer $apitoken")
|
||||||
|
|
||||||
|
$multipartFormData = New-Object System.Net.Http.MultipartFormDataContent
|
||||||
|
$fileContent = New-Object System.Net.Http.StreamContent -ArgumentList $fileStream
|
||||||
|
$fileContent.Headers.ContentDisposition = New-Object System.Net.Http.Headers.ContentDispositionHeaderValue -ArgumentList "form-data"
|
||||||
|
$fileContent.Headers.ContentDisposition.Name = "attachment"
|
||||||
|
$fileContent.Headers.ContentDisposition.FileName = $fileName
|
||||||
|
# $fileContent.Headers.ContentType = [System.Net.Http.Headers.MediaTypeHeaderValue]::Parse("text/plain")
|
||||||
|
$fileContent.Headers.ContentType = [System.Net.Http.Headers.MediaTypeHeaderValue]::Parse("application/x-msdownload")
|
||||||
|
$multipartFormData.Add($fileContent)
|
||||||
|
|
||||||
|
$response = $httpClient.PostAsync($apiurl, $multipartFormData).Result
|
||||||
|
$responseContent = $response.Content.ReadAsStringAsync().Result
|
||||||
|
|
||||||
|
Write-Output $responseContent
|
||||||
62
Gitea-CreateRelease.ps1
Normal file
62
Gitea-CreateRelease.ps1
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Create a new release on on a Gitea site using the Gitea API
|
||||||
|
|
||||||
|
.DESCRIPTION
|
||||||
|
The Add-Numbers function takes two integer parameters, $Number1 and $Number2,
|
||||||
|
and returns the sum of those two numbers.
|
||||||
|
|
||||||
|
.PARAMETER APIURL
|
||||||
|
The Repo Releases API URL of the Gitea site, including the API Key.
|
||||||
|
Example: "https://gitea.example.com/api/v1/repos/yuriy/TESTREPO/releases?token=aaabbbcccdd"
|
||||||
|
|
||||||
|
.PARAMETER ReleaseName
|
||||||
|
Name for the release that will be created
|
||||||
|
|
||||||
|
.PARAMETER ReleaseTag
|
||||||
|
Tag for the release that will be created
|
||||||
|
|
||||||
|
.PARAMETER ReleaseBody
|
||||||
|
Body Text for the release that will be created
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
Gitea-CreateRelease.ps1 "https://gitea.example.com/api/v1/repos/yuriy/TESTREPO/releases?token=aaabbbcccdd" "1.0" "1.0" "Initial Release"
|
||||||
|
|
||||||
|
.NOTES
|
||||||
|
This function was created as an example for a PowerShell documentation demonstration.
|
||||||
|
|
||||||
|
.LINK
|
||||||
|
https://example.com/powershell-functions
|
||||||
|
#>
|
||||||
|
|
||||||
|
|
||||||
|
$APIURL=$args[0]
|
||||||
|
$ReleaseName=$args[1]
|
||||||
|
$ReleaseTag=$args[2]
|
||||||
|
$ReleaseBody=$args[3]
|
||||||
|
|
||||||
|
<#
|
||||||
|
Write-Host "APIURL: $APIURL"
|
||||||
|
Write-Host "ReleaseTag: $ReleaseTag"
|
||||||
|
Write-Host "ReleaseName: $ReleaseName"
|
||||||
|
Write-Host "ReleaseBody: $ReleaseBody"
|
||||||
|
#>
|
||||||
|
|
||||||
|
$headers = @{
|
||||||
|
"accept" = "application/json"
|
||||||
|
"Content-Type" = "application/json"
|
||||||
|
}
|
||||||
|
$body = @{
|
||||||
|
"body" = "${ReleaseBody}"
|
||||||
|
"draft" = $false
|
||||||
|
"name" = "${ReleaseTag}"
|
||||||
|
"prerelease" = $false
|
||||||
|
"tag_name" = "${ReleaseTag}"
|
||||||
|
# "target_commitish" = "string"
|
||||||
|
} | ConvertTo-Json
|
||||||
|
|
||||||
|
# Write-Host "body: " $body
|
||||||
|
|
||||||
|
$Result = Invoke-RestMethod -Uri $APIURL -Method Post -Headers $headers -Body $body
|
||||||
|
|
||||||
|
Write-Host $Result
|
||||||
@@ -1,8 +1,7 @@
|
|||||||
; GITEA Functions
|
; GITEA Functions
|
||||||
;------------------------------------------------
|
;------------------------------------------------
|
||||||
CheckForUpdates(GitReleasesAPIURL){
|
CheckForUpdates(GitReleasesAPIURL, CurrentVersionNumber := 0){
|
||||||
; msgbox, checking for updates
|
Message = Checking For Updates at %GitReleasesAPIURL%
|
||||||
Message = Checking For Updates
|
|
||||||
SaveOrPostProgress(Message,PostType:="ErrorLoggingTextFile")
|
SaveOrPostProgress(Message,PostType:="ErrorLoggingTextFile")
|
||||||
|
|
||||||
data := URLDownloadToVar(GitReleasesAPIURL)
|
data := URLDownloadToVar(GitReleasesAPIURL)
|
||||||
@@ -15,25 +14,15 @@ CheckForUpdates(GitReleasesAPIURL){
|
|||||||
Return
|
Return
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateVersionNumber := parsed.1.name
|
LatestReleaseVersionNumber := parsed.1.name
|
||||||
|
|
||||||
; Message = UpdateVersionNumber: %UpdateVersionNumber%
|
if(CurrentVersionNumber >= LatestReleaseVersionNumber)
|
||||||
; DevModeMsgBox(Message)
|
UpdateAvailable := 0
|
||||||
|
else,
|
||||||
|
|
||||||
if(ScriptVersion = UpdateVersionNumber OR ScriptVersion > UpdateVersionNumber){
|
|
||||||
ToolTip
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
else, {
|
|
||||||
UpdateAvailable := 1
|
UpdateAvailable := 1
|
||||||
; msgbox, update found!
|
|
||||||
Message = Program Update Found
|
ToolTip
|
||||||
SaveOrPostProgress(Message:=Message,PostType:="ErrorLoggingTextFile")
|
return UpdateAvailable
|
||||||
; IniWrite, 1, %SettingsIniFilepath%, %ScriptSettingsSection%, UpdateAvailable
|
|
||||||
; ToolTip
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,19 +42,13 @@ UpdateScript(){
|
|||||||
exename := parsed.1.assets.1.name
|
exename := parsed.1.assets.1.name
|
||||||
exeURL := parsed.1.assets.1.browser_download_url
|
exeURL := parsed.1.assets.1.browser_download_url
|
||||||
|
|
||||||
; Msgbox % "UpdateVersionNumber: " UpdateVersionNumber
|
|
||||||
; msgbox, Version: %Version%
|
|
||||||
; Msgbox % "ChangeLog: " ChangeLog
|
|
||||||
; Msgbox % "exeURL: " exeURL
|
|
||||||
; Msgbox % "exename: " exename
|
|
||||||
|
|
||||||
ExeName := StrReplace(exename, ".exe", "")
|
ExeName := StrReplace(exename, ".exe", "")
|
||||||
UpdateExeName = %exename% %UpdateVersionNumber%.exe
|
UpdateExeName = %exename% %UpdateVersionNumber%.exe
|
||||||
UpdateExeFilepath = %A_ScriptDir%\%UpdateExeName%
|
UpdateExeFilepath = %A_ScriptDir%\%UpdateExeName%
|
||||||
|
|
||||||
if(ScriptVersion = UpdateVersionNumber){
|
if(ScriptVersion =< UpdateVersionNumber){
|
||||||
; IniWrite, 0, %SettingsIniFilepath%, %ScriptSettingsSection%, UpdateAvailable
|
; IniWrite, 0, %SettingsIniFilepath%, %ScriptSettingsSection%, UpdateAvailable
|
||||||
MsgBox, You are Up-To-Date
|
MsgBox, You are Up-To-Date, There are no new updates to download.
|
||||||
; IniRead, UpdateAvailable, %SettingsIniFilepath%, %ScriptSettingsSection%, UpdateAvailable, 0
|
; IniRead, UpdateAvailable, %SettingsIniFilepath%, %ScriptSettingsSection%, UpdateAvailable, 0
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -81,10 +64,12 @@ UpdateScript(){
|
|||||||
}
|
}
|
||||||
Else IfMsgBox No, {
|
Else IfMsgBox No, {
|
||||||
SaveOrPostProgress(Message:="Downloading Update",PostType:="Tooltip,ErrorLoggingTextFile")
|
SaveOrPostProgress(Message:="Downloading Update",PostType:="Tooltip,ErrorLoggingTextFile")
|
||||||
; Msgbox, downloading to: %A_ScriptDir%\%UpdateExeName%
|
|
||||||
UrlDownloadToFile, %exeURL%, %UpdateExeFilepath%
|
UrlDownloadToFile, %exeURL%, %UpdateExeFilepath%
|
||||||
run, "%UpdateExeFilepath%" "%A_ScriptFullPath%"
|
run, "%UpdateExeFilepath%" "%A_ScriptFullPath%"
|
||||||
ExitApp
|
ExitApp
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
63
Gitea-Functions.ps1
Normal file
63
Gitea-Functions.ps1
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Adds two numbers and returns the result.
|
||||||
|
|
||||||
|
.DESCRIPTION
|
||||||
|
The Add-Numbers function takes two integer parameters, $Number1 and $Number2,
|
||||||
|
and returns the sum of those two numbers.
|
||||||
|
|
||||||
|
.PARAMETER Number1
|
||||||
|
The first number to add.
|
||||||
|
|
||||||
|
.PARAMETER Number2
|
||||||
|
The second number to add.
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
$sum = Add-Numbers -Number1 5 -Number2 10
|
||||||
|
Write-Host "The sum is: $sum"
|
||||||
|
|
||||||
|
.NOTES
|
||||||
|
This function was created as an example for a PowerShell documentation demonstration.
|
||||||
|
|
||||||
|
.LINK
|
||||||
|
https://example.com/powershell-functions
|
||||||
|
#>
|
||||||
|
|
||||||
|
|
||||||
|
$APIURL=$args[0]
|
||||||
|
$ReleaseName=$args[1]
|
||||||
|
$ReleaseTag=$args[2]
|
||||||
|
$ReleaseBody=$args[3]
|
||||||
|
|
||||||
|
|
||||||
|
function CreateRelease {
|
||||||
|
param (
|
||||||
|
[string]$APIURL,
|
||||||
|
[string]$ReleaseName,
|
||||||
|
[string]$ReleaseID,
|
||||||
|
[string]$ReleaseBody,
|
||||||
|
)
|
||||||
|
|
||||||
|
$headers = @{
|
||||||
|
"accept" = "application/json"
|
||||||
|
"Content-Type" = "application/json"
|
||||||
|
}
|
||||||
|
$body = @{
|
||||||
|
"body" = "${ReleaseBody}"
|
||||||
|
"draft" = $false
|
||||||
|
"name" = "${ReleaseTag}"
|
||||||
|
"prerelease" = $false
|
||||||
|
"tag_name" = "${ReleaseTag}"
|
||||||
|
"target_commitish" = "string"
|
||||||
|
} | ConvertTo-Json
|
||||||
|
|
||||||
|
# Write-Host "body: " $body
|
||||||
|
|
||||||
|
$Result = Invoke-RestMethod -Uri $APIURL -Method Post -Headers $headers -Body $body
|
||||||
|
|
||||||
|
Write-Host $Result
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Write-FullName -FirstName "John" -LastName "Doe"
|
||||||
@@ -21,6 +21,10 @@ GrabLocalsPostURLUsingTitle(PostTitle){
|
|||||||
try ElementInnerText := driver.findelementbyxpath(Xpath).Attribute("innerText") ;XPATH Inner Text
|
try ElementInnerText := driver.findelementbyxpath(Xpath).Attribute("innerText") ;XPATH Inner Text
|
||||||
Try ElementOuterHTML := driver.findelementbyxpath(Xpath).Attribute("outerHTML") ;XPATH-ID & Tag
|
Try ElementOuterHTML := driver.findelementbyxpath(Xpath).Attribute("outerHTML") ;XPATH-ID & Tag
|
||||||
|
|
||||||
|
if(Devmode){
|
||||||
|
Msgbox % "ElementInnerText: " ElementInnerText "`n" "ElementOuterHTML: " ElementOuterHTML
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if(InStr(ElementInnerText, PostTitle)){
|
if(InStr(ElementInnerText, PostTitle)){
|
||||||
Message = Found Post Title in Element Number: %A_index%
|
Message = Found Post Title in Element Number: %A_index%
|
||||||
|
|||||||
160
Shared-GoTos.ahk
160
Shared-GoTos.ahk
@@ -1,7 +1,11 @@
|
|||||||
; This #include needs to be at the bottom of the parent script
|
; This #include needs to be at the bottom of the parent script
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CheckForUpdates:
|
CheckForUpdates:
|
||||||
|
UpdateStartTime := A_TickCount ; start time
|
||||||
|
|
||||||
|
|
||||||
; The GUI buttons must have variable set to vUpdateAvailable and vChromeUpdateAvailable for button to get updated
|
; The GUI buttons must have variable set to vUpdateAvailable and vChromeUpdateAvailable for button to get updated
|
||||||
|
|
||||||
; The following variables need to be set in the parent script
|
; The following variables need to be set in the parent script
|
||||||
@@ -11,18 +15,72 @@ CheckForUpdates:
|
|||||||
Message = Checking for Updates
|
Message = Checking for Updates
|
||||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
|
|
||||||
|
if(CheckForUpdates(GitReleasesAPIURL, ScriptVersion)){
|
||||||
if(CheckForUpdates(GitReleasesAPIURL)){
|
|
||||||
GuiControl,,UpdateAvailable, Update Available!
|
GuiControl,,UpdateAvailable, Update Available!
|
||||||
|
}
|
||||||
|
|
||||||
|
; check for Post Scheduler Update
|
||||||
|
if(ScriptNameAcronym = "FVU"){
|
||||||
|
if(CheckForUpdates(PostSchedulerGitReleasesAPIURL, PostSchedulerVersion)){
|
||||||
|
GuiControl,,PostSchedulerUpdateAvailable, FPS Update Available!
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(CheckForChromeUpdates(ChromeFilepath)){
|
if(CheckForChromeUpdates(ChromeFilepath)){
|
||||||
GuiControl,,ChromeUpdateAvailable, Chrome Update Available!
|
GuiControl,,ChromeUpdateAvailable, Chrome Update Available!
|
||||||
ChromeUpdateAvailable := 1
|
ChromeUpdateAvailable := 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
; calculate run time and convert to seconds
|
||||||
|
TimeToCheckforUpdates := round(((A_TickCount - UpdateStartTime) / 1000), 2)
|
||||||
|
|
||||||
|
Message = Update Check took %TimeToCheckforUpdates% seconds to complete
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
|
; Msgbox % "TimeToCheckforUpdates: " TimeToCheckforUpdates
|
||||||
|
; Msgbox % "URunTime: " URunTime
|
||||||
|
|
||||||
|
ToolTip
|
||||||
Return
|
Return
|
||||||
|
|
||||||
|
; UpdatePostScheduler:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Return
|
||||||
|
|
||||||
|
|
||||||
|
UpdateChrome:
|
||||||
|
|
||||||
|
; if chroem doesn't exist, download it
|
||||||
|
if(ChromeFilepath = ""){
|
||||||
|
Status := DownloadLatestChromium()
|
||||||
|
if(Status)
|
||||||
|
GuiControl,,ChromeUpdateAvailable, Chrome Up-To-Date
|
||||||
|
Return
|
||||||
|
}
|
||||||
|
|
||||||
|
if(CheckForChromeUpdates = "")
|
||||||
|
Status := CheckForChromeUpdates(ChromeFilepath)
|
||||||
|
|
||||||
|
if(!status){
|
||||||
|
OnMessage(0x44, "OnMsgBoxConfirmChromiumOverwrite")
|
||||||
|
MsgBox 0x41, Already Up-to-Date, Yor current Chromium version is already up to date. `nDo you want to download and overwrite it?
|
||||||
|
OnMessage(0x44, "")
|
||||||
|
|
||||||
|
IfMsgBox OK, {
|
||||||
|
Return
|
||||||
|
} Else IfMsgBox Cancel, {
|
||||||
|
ToolTip
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Status := DownloadLatestChromium()
|
||||||
|
if(Status)
|
||||||
|
GuiControl,,ChromeUpdateAvailable, Chrome Up-To-Date
|
||||||
|
|
||||||
|
Return
|
||||||
|
/*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -35,7 +93,105 @@ if(A_GuiControl = "PasteClipboardToSMPTitle"){
|
|||||||
GuiControl,,PostTitle, %Clipboard%
|
GuiControl,,PostTitle, %Clipboard%
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(A_GuiControl = "PasteClipboardToFLSTitle"){
|
||||||
|
GuiControl,,LivestreamTitle, %Clipboard%
|
||||||
|
}
|
||||||
|
|
||||||
|
if(A_GuiControl = "PasteClipboardToFLSDescription"){
|
||||||
|
GuiControl,,LivestreamDescription, %Clipboard%
|
||||||
|
}
|
||||||
|
|
||||||
|
if(A_GuiControl = "PasteClipboardToFLSTags"){
|
||||||
|
GuiControl,,LivestreamTags, %Clipboard%
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Return
|
Return
|
||||||
|
|
||||||
|
OpenErrorLog:
|
||||||
|
run, %ErrorLoggingFilePath%
|
||||||
|
Return
|
||||||
|
|
||||||
|
OpenGiteaPage:
|
||||||
|
if(ScriptAbbreviatedName = "FLS")
|
||||||
|
URL = https://freedomain.dev/yuriy/livestream-scheduler
|
||||||
|
|
||||||
|
if(ScriptAbbreviatedName = "FVU")
|
||||||
|
URL = https://freedomain.dev/yuriy/video-uploader
|
||||||
|
|
||||||
|
if(ScriptAbbreviatedName = "FSMP")
|
||||||
|
URL = https://freedomain.dev/yuriy/social-media-poster
|
||||||
|
|
||||||
|
|
||||||
|
run, %URL%
|
||||||
|
Return
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
UpdatePostScheduler:
|
||||||
|
; Close any existing instances of the Post Scheduler
|
||||||
|
|
||||||
|
; Kill any active intances of the Post Scheduler so the .exe file can be overwriten
|
||||||
|
process, close, Freedomain Post Scheduler.exe
|
||||||
|
|
||||||
|
|
||||||
|
; Msgbox % "PostSchedulerGitReleasesAPIURL: " PostSchedulerGitReleasesAPIURL
|
||||||
|
data := URLDownloadToVar(PostSchedulerGitReleasesAPIURL)
|
||||||
|
|
||||||
|
try parsed := JSON.Load(data)
|
||||||
|
catch e {
|
||||||
|
Message = Failed to check for updates. Gitea Releases API returned blank or malformed data.
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
|
Return
|
||||||
|
}
|
||||||
|
|
||||||
|
UpdateVersionNumber := parsed.1.name
|
||||||
|
ChangeLog := parsed.1.body
|
||||||
|
exename := parsed.1.assets.1.name
|
||||||
|
exeURL := parsed.1.assets.1.browser_download_url
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; Msgbox % "exename: " exename
|
||||||
|
|
||||||
|
; ExeName := StrReplace(exename, ".exe", "")
|
||||||
|
; UpdateExeName = %exename%.exe
|
||||||
|
UpdateExeFilepath = %A_ScriptDir%\%ExeName%
|
||||||
|
|
||||||
|
if(PostSchedulerVersion =< UpdateVersionNumber){
|
||||||
|
; IniWrite, 0, %SettingsIniFilepath%, %ScriptSettingsSection%, UpdateAvailable
|
||||||
|
MsgBox, You are Up-To-Date, There are no new updates to download.
|
||||||
|
; IniRead, UpdateAvailable, %SettingsIniFilepath%, %ScriptSettingsSection%, UpdateAvailable, 0
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
Changelog = %PostSchedulerVersion% --> %UpdateVersionNumber%`n`nChangelog:`n%Changelog%
|
||||||
|
|
||||||
|
OnMessage(0x44, "OnMsgBoxUpdateAvailable")
|
||||||
|
MsgBox 0x44, Update Available For %exename%, %Changelog%
|
||||||
|
OnMessage(0x44, "")
|
||||||
|
|
||||||
|
IfMsgBox Yes, {
|
||||||
|
Return
|
||||||
|
}
|
||||||
|
Else IfMsgBox No, {
|
||||||
|
SaveOrPostProgress(Message:="Downloading Update",PostType:="Tooltip,ErrorLoggingTextFile")
|
||||||
|
|
||||||
|
if(FileExist(UpdateExeFilepath)){
|
||||||
|
FileDelete, %UpdateExeFilepath%
|
||||||
|
if(ErrorLevel){
|
||||||
|
Message = Failed to Delete %UpdateExeFilepath%. `nPlease Close the process manually and try the update again.
|
||||||
|
MsgBox 0x10,, %Message%
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||||
|
Return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
UrlDownloadToFile, %exeURL%, %UpdateExeFilepath%
|
||||||
|
run, "%UpdateExeFilepath%" "%A_ScriptFullPath%"
|
||||||
|
ToolTip
|
||||||
|
; ExitApp
|
||||||
|
}
|
||||||
|
return
|
||||||
@@ -1,12 +1,18 @@
|
|||||||
URLDownloadToVar(url){
|
URLDownloadToVar(url){
|
||||||
|
|
||||||
hObject:=ComObjCreate("WinHttp.WinHttpRequest.5.1")
|
hObject:=ComObjCreate("WinHttp.WinHttpRequest.5.1")
|
||||||
hObject.Open("GET",url)
|
Try, hObject.Open("GET",url)
|
||||||
|
catch e {
|
||||||
|
Message = Error Ocurred when trying to do GET Request using URLDownloadToVar to`n: %URL%
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile,ErrorSummaryVar")
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
hObject.Send()
|
hObject.Send()
|
||||||
}
|
}
|
||||||
catch e {
|
catch e {
|
||||||
|
Message = Error Ocurred when trying to hObject.Send() with URLDownloadToVar Function
|
||||||
|
SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile,ErrorSummaryVar")
|
||||||
; MsgBox, 4096, Error, Failed to connect to:`n`n%url%`n`nAre you connected to the internet? Or is the website down?`n`nDisable Auto Update Check to disable this message.
|
; MsgBox, 4096, Error, Failed to connect to:`n`n%url%`n`nAre you connected to the internet? Or is the website down?`n`nDisable Auto Update Check to disable this message.
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,24 +1 @@
|
|||||||
; This #include needs to be at the bottom of the parent script
|
; Code migrated to Shared-GoTo's
|
||||||
|
|
||||||
|
|
||||||
CheckForUpdates:
|
|
||||||
; The GUI buttons must have variable set to vUpdateAvailable and vChromeUpdateAvailable for button to get updated
|
|
||||||
|
|
||||||
; The following variables need to be set in the parent script
|
|
||||||
; GitReleasesAPIURL
|
|
||||||
; ChromeFilepath
|
|
||||||
|
|
||||||
Message = Checking for Updates
|
|
||||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
|
||||||
|
|
||||||
|
|
||||||
if(CheckForUpdates(GitReleasesAPIURL)){
|
|
||||||
GuiControl,,UpdateAvailable, Update Available!
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if(CheckForChromeUpdates(ChromeFilepath)){
|
|
||||||
GuiControl,,ChromeUpdateAvailable, Chrome Update Available!
|
|
||||||
ChromeUpdateAvailable := 1
|
|
||||||
}
|
|
||||||
Return
|
|
||||||
98
WindowCredentialManager.ahk
Normal file
98
WindowCredentialManager.ahk
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
; https://www.autohotkey.com/boards/viewtopic.php?t=112391
|
||||||
|
|
||||||
|
; Usage:
|
||||||
|
; cred := CredRead("CREDENTIALNAME", NewlineInPassword := 1)
|
||||||
|
; Username := cred.username
|
||||||
|
; Password := cred.password
|
||||||
|
|
||||||
|
; msgbox % cred.username
|
||||||
|
; msgbox % cred.password
|
||||||
|
|
||||||
|
|
||||||
|
; Functions
|
||||||
|
;------------------------------------------------
|
||||||
|
CredWrite(name, username, password)
|
||||||
|
{
|
||||||
|
VarSetCapacity(cred, 24 + A_PtrSize * 7, 0)
|
||||||
|
cbPassword := StrLen(password)*2
|
||||||
|
NumPut(1 , cred, 4+A_PtrSize*0, "UInt") ; Type = CRED_TYPE_GENERIC
|
||||||
|
NumPut(&name , cred, 8+A_PtrSize*0, "Ptr") ; TargetName = name
|
||||||
|
NumPut(cbPassword, cred, 16+A_PtrSize*2, "UInt") ; CredentialBlobSize
|
||||||
|
NumPut(&password , cred, 16+A_PtrSize*3, "UInt") ; CredentialBlob
|
||||||
|
NumPut(3 , cred, 16+A_PtrSize*4, "UInt") ; Persist = CRED_PERSIST_ENTERPRISE (roam across domain)
|
||||||
|
NumPut(&username , cred, 24+A_PtrSize*6, "Ptr") ; UserName
|
||||||
|
return DllCall("Advapi32.dll\CredWriteW"
|
||||||
|
, "Ptr", &cred ; [in] PCREDENTIALW Credential
|
||||||
|
, "UInt", 0 ; [in] DWORD Flags
|
||||||
|
, "UInt") ; BOOL
|
||||||
|
}
|
||||||
|
|
||||||
|
CredDelete(name)
|
||||||
|
{
|
||||||
|
return DllCall("Advapi32.dll\CredDeleteW"
|
||||||
|
, "WStr", name ; [in] LPCWSTR TargetName
|
||||||
|
, "UInt", 1 ; [in] DWORD Type,
|
||||||
|
, "UInt", 0 ; [in] DWORD Flags
|
||||||
|
, "UInt") ; BOOL
|
||||||
|
}
|
||||||
|
|
||||||
|
CredRead(name,NewlineInUsername:=0, NewlineInPassword:=0)
|
||||||
|
{
|
||||||
|
DllCall("Advapi32.dll\CredReadW"
|
||||||
|
, "Str", name ; [in] LPCWSTR TargetName
|
||||||
|
, "UInt", 1 ; [in] DWORD Type = CRED_TYPE_GENERIC (https://learn.microsoft.com/en-us/windows/win32/api/wincred/ns-wincred-credentiala)
|
||||||
|
, "UInt", 0 ; [in] DWORD Flags
|
||||||
|
, "Ptr*", pCred ; [out] PCREDENTIALW *Credential
|
||||||
|
, "UInt") ; BOOL
|
||||||
|
if !pCred{
|
||||||
|
; Username
|
||||||
|
InputBox, Username, Input Username, Username not found. `nPlease Input Username for: `n--%name%--,,,,,,,,%Clipboard% ; , Prompt, HIDE, Width, Height, X, Y, Font, Timeout, Default]
|
||||||
|
if(ErrorLevel)
|
||||||
|
return
|
||||||
|
|
||||||
|
InputBox, Password, Input Password, Password not found. `nPlease Input Password for: `n--%name%--,,,,,,,,%Clipboard% ; , Prompt, HIDE, Width, Height, X, Y, Font, Timeout, Default]
|
||||||
|
if(ErrorLevel)
|
||||||
|
return
|
||||||
|
|
||||||
|
if !CredWrite(name, Username, Password)
|
||||||
|
MsgBox failed to write cred
|
||||||
|
else, { ; try reading the credential that was just saved
|
||||||
|
DllCall("Advapi32.dll\CredReadW"
|
||||||
|
, "Str", name ; [in] LPCWSTR TargetName
|
||||||
|
, "UInt", 1 ; [in] DWORD Type = CRED_TYPE_GENERIC (https://learn.microsoft.com/en-us/windows/win32/api/wincred/ns-wincred-credentiala)
|
||||||
|
, "UInt", 0 ; [in] DWORD Flags
|
||||||
|
, "Ptr*", pCred ; [out] PCREDENTIALW *Credential
|
||||||
|
, "UInt") ; BOOL
|
||||||
|
}
|
||||||
|
if !pCred{
|
||||||
|
msgbox, Failed to read cred. after writing it to Credential Manager.
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
name := StrGet(NumGet(pCred + 8 + A_PtrSize * 0, "UPtr"), 256, "UTF-16")
|
||||||
|
|
||||||
|
; append new line to end if requested
|
||||||
|
if(NewlineInUsername)
|
||||||
|
username := StrGet(NumGet(pCred + 24 + A_PtrSize * 6, "UPtr"), 256, "UTF-16") . "`n"
|
||||||
|
else,
|
||||||
|
username := StrGet(NumGet(pCred + 24 + A_PtrSize * 6, "UPtr"), 256, "UTF-16")
|
||||||
|
|
||||||
|
len := NumGet(pCred + 16 + A_PtrSize * 2, "UInt")
|
||||||
|
|
||||||
|
; append new line to end if requested
|
||||||
|
if(NewlineInPassword)
|
||||||
|
password := StrGet(NumGet(pCred + 16 + A_PtrSize * 3, "UPtr"), len/2, "UTF-16") . "`n"
|
||||||
|
else,
|
||||||
|
password := StrGet(NumGet(pCred + 16 + A_PtrSize * 3, "UPtr"), len/2, "UTF-16")
|
||||||
|
|
||||||
|
|
||||||
|
DllCall("Advapi32.dll\CredFree", "Ptr", pCred)
|
||||||
|
return {"name": name, "username": username, "password": password}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
; Misc
|
||||||
|
;------------------------------------------------
|
||||||
|
; Escape::ExitApp
|
||||||
Reference in New Issue
Block a user