Skip to content

Commit

Permalink
Zip AHK release files (#7)
Browse files Browse the repository at this point in the history
* ZIP ahk files
* FileInstall for exe files
* Swap back to last active window after done
* BlockInput if ran as admin
  • Loading branch information
jaredcat authored Nov 1, 2022
1 parent 1ffff90 commit 77ce07a
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 17 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ jobs:
with:
in: AFB
build_dir: build
- name: Easy Zip Files
uses: vimtor/action-zip@v1
with:
files: AFB.ahk plugins/
dest: build/AFB.zip

- name: Release
uses: softprops/action-gh-release@v1
Expand All @@ -32,6 +37,6 @@ jobs:
files: |
build/AFB_64-bit.exe
build/AFB_32-bit.exe
AFB.ahk
build/AFB.zip
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
38 changes: 24 additions & 14 deletions AFB.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,40 @@ ONE_MIN := 1000 * 60
THREE_MINS := 3 * ONE_MIN
FIVE_MINS := 5 * ONE_MIN
SIXTEEN_MINS := 15 * ONE_MIN
DATA_DIR := A_ScriptDir . "\data"
RECONNECT_BUTTON_IMG := DATA_DIR . "\reconnect-button.png"
RECONNECT_TEXT_IMG := DATA_DIR . "\reconnect-text.png"
RECONNECT_IMG_SEARCH_ARRAY := [RECONNECT_BUTTON_IMG, RECONNECT_TEXT_IMG]

/*
globals
*/
IsRunning := false
DirCreate(DATA_DIR)
FileInstall(RECONNECT_BUTTON_IMG, RECONNECT_BUTTON_IMG, 1)
FileInstall(RECONNECT_TEXT_IMG, RECONNECT_TEXT_IMG, 1)

#MaxThreadsPerHotkey 2
F1:: {
global IsRunning := !IsRunning
While (IsRunning) {
if WinExist("Roblox") {
WinActivate ; defaults to WinExist
WinGetPos(&winX, &winY, &winWidth, &winHeight) ; defaults to WinExist
lastID := WinGetID("A")
robloxID := WinExist("Roblox")
if (robloxID) {
; BEGIN WORK
BlockInput(True)

WinActivate(robloxID)
WinGetPos(&winX, &winY, &winWidth, &winHeight, robloxID)

Reconnect(winWidth, winHeight)

BreakAFK()

WinActivate(lastID)
BlockInput(False)
; END OF WORK

antiKickInterval := GetIntervalMins()
sleep(antiKickInterval)
} else {
Expand All @@ -48,17 +64,11 @@ BreakAFK() {
*/
Reconnect(winWidth, winHeight) {
try {
searchImage := "plugins/roblox/reconnect-button.png"
if (ImageSearch(&foundX, &foundY, 0, 0, winWidth, winHeight, searchImage)) {
ClickImageMidPoint(searchImage, foundX, foundY)
return 1
}

; try with smaller image, this seems to be less reliable
searchImage := "plugins/roblox/reconnect-text.png"
if (ImageSearch(&foundX, &foundY, 0, 0, winWidth, winHeight, searchImage)) {
ClickImageMidPoint(searchImage, foundX, foundY)
return 1
for (searchImage in RECONNECT_IMG_SEARCH_ARRAY) {
if (ImageSearch(&foundX, &foundY, 0, 0, winWidth, winHeight, searchImage)) {
ClickImageMidPoint(searchImage, foundX, foundY)
return 1
}
}
} catch as exc {
MsgBox "Something went wrong when trying to check for reconnect button:`n" exc.Message
Expand Down
File renamed without changes.
5 changes: 3 additions & 2 deletions readme.md → README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ AutoHotkey scripts to specifically to help you when you're *Away From (Ro)Blox*

1. [Download latest release](/releases/latest)
2. Double-click to run
1. Optionally run as Administrator for input-blocking
3. Press `F1` to activate

## How to use (.ahk file)

1. **Install [AutoHotkey v2](https://www.autohotkey.com/download/ahk-v2.exe)** Beta or higher
2. [Download latest release](/releases/latest)
3. Double-click to run
1. Optionally run as Administrator for input-blocking
4. Press `F1` to activate

## TODO
Expand All @@ -24,11 +26,10 @@ AutoHotkey scripts to specifically to help you when you're *Away From (Ro)Blox*
* Eventually remove custom `ahk2exe` github action, once its been updated to support AHK v2 (watch [GitHub-Action-Ahk2Exe](https://github.com/nekocodeX/GitHub-Action-Ahk2Exe) repo)
* Modularity
* Support multiple games with unique AFK conditions and loops
* Swap back to last active window after executing anti-kick
* Startup config
* Options to select which modules/game actions to load
* Option for what the "AFK break action" is (default: space key)

## Contributing

See [contributing.md](contributing.md)
See [CONTRIBUTING.md](CONTRIBUTING.md)
File renamed without changes
File renamed without changes

0 comments on commit 77ce07a

Please sign in to comment.