Coder Social home page Coder Social logo

auto-update.ahk-ahk-v2-easily-update-ahk-apps-remotely's Introduction

Auto_Update.ahk AHKv2_Self-Updating-Application-Lib

AHKv2 Self Updating Application Library This library is off the back of my github.ahk update, and dive into ahkv2. credit to Json Native.ahk creator https://www.autohotkey.com/boards/viewtopic.php?t=100602

repo: https://github.com/samfisherirl/Auto-Update.ahk-AHKv2_Self-Updating-Application-Lib

This solution does the following:

  • Takes configuration for an app ( public releases) that needs remote updates, ill use "github.ahk" as an example.
  • Connect to Github's API, returns release Tag (version), release download url, and release updates
  • stores version data in a local json log file
  • Everytime the function calls are made in the example, the json file is imported and github API redownloads the latest version data
  • If version doesn't match local version, a download prompt is offered (customizable)
  • if Zip, Rar, 7z file, 7zip command line utility invokes extraction of the release and overwrites the existing application path set by the user
  • if Exe, a simple move file operation happens
  • Version data is stored for future use

keep in mind this works but may have an error or two upon various use cases and if reported, I will fix asap.

Try, Catch need to be implemented as a code feature (I dont self-referentially update for you so make sure to check the github for updates ;) !Important for now, releases must be in the zip's main directory. I dont have a function to handle zips with the main app in a folder.

myApp := defineApp("samfisherirl", "Github.ahk")
; this example refers to my repo http://github.com/samfisherirl/github.ahk

path_of_app := A_ScriptDir "\github.ahk"
; set where my application is stored on the local computer

myApp.setPath(path_of_app)

myApp.connectGithubAPI()

update := myApp.checkforUpdate()

if (update) {
    ;update stores all json data, you can see some details below. Look at "defineApp" class for more details
    msg := update["repo"] . " version number " . update["version"] . " needs an update. Release notes include:`n" . update["releaseNotes"]
    Msgbox(msg)

    myApp.update()
    ;gets file from repo, if zip/7zip, extract
    ;then overwrite existing app
    ;updates log
}
else {
    msgbox("You're up to date!")
}

full code does not include native.ahk and github.ahk, both needed. find the full code here:

auto-update.ahk-ahk-v2-easily-update-ahk-apps-remotely's People

Contributors

samfisherirl avatar

Stargazers

poa00 avatar OvercastBTC avatar Antonio Mancera Ubaldo Jr. avatar  avatar

Watchers

 avatar

Forkers

poa00

auto-update.ahk-ahk-v2-easily-update-ahk-apps-remotely's Issues

Error

Hi. I'm trying this with my script, but am getting the following error, even just attempting to run the example script:

Error: (126) The specified module could not be found.

---- D:\merge\working\current\64bit\Native.ahk
148: {
149: If !(module := DllCall('LoadLibrary', 'str', path, 'ptr'))

โ–ถ 150: Throw OSError(A_LastError)
151: module_load_addr := DllCall('GetProcAddress', 'ptr', module, 'astr', 'ahk2_module_load', 'cdecl ptr') || DllCall('GetProcAddress', 'ptr', module, 'ptr', 1, 'cdecl ptr')
152: If !module_load_addr

The current thread will exit.

Call stack:
D:\merge\working\current\64bit\Native.ahk (150) : [Native.LoadModule] Throw OSError(A_LastError)
D:\merge\working\current\64bit\github.ahk (67) : [JSON.__New] Native.LoadModule('.' (A_PtrSize * 8) 'bit\ahk-json.dll', ['JSON'])
D:\merge\working\current\64bit\github.ahk (65) : [] JSON

Auto-execute

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.