Created
March 1, 2017 06:41
-
-
Save hoppfrosch/59e83971a00d6e65dcf659c2a8ba02e6 to your computer and use it in GitHub Desktop.
Update local german helpfile for AutoHotkey - *Author*: SAPlayer, Ragnar_F - http://ahkscript.org/boards/viewtopic.php?f=10&t=34
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Script to update local german help for AutoHotKey | |
# Authors: SAPlayer, Ragnar_F - see http://ahkscript.org/boards/viewtopic.php?f=10&t=34 | |
# | |
#SingleInstance ignore | |
#NoEnv | |
TmpDir := A_Temp | |
if(!A_IsAdmin){ | |
Run *RunAs "%A_ScriptFullPath%",, UseErrorLevel | |
if(ErrorLevel){ | |
MsgBox, 53, Administatorrechte benötigt, Du musst den Updater mit Administratorrechten starten, damit er richtig funktioniert! | |
IfMsgBox, Retry | |
Reload | |
else | |
ExitApp | |
} | |
return | |
} | |
Unz(sZip, sUnz){ ;http://www.autohotkey.com/board/topic/60706-native-zip-and-unzip-xpvista7-ahk-l/ | |
fso := ComObjCreate("Scripting.FileSystemObject") | |
If Not fso.FolderExists(sUnz) ;http://www.autohotkey.com/forum/viewtopic.php?p=402574 | |
fso.CreateFolder(sUnz) | |
psh := ComObjCreate("Shell.Application") | |
zippedItems := psh.Namespace( sZip ).items().count | |
psh.Namespace( sUnz ).CopyHere( psh.Namespace( sZip ).items, 4|16 ) | |
Loop { | |
sleep 50 | |
unzippedItems := psh.Namespace( sUnz ).items().count | |
IfEqual,zippedItems,%unzippedItems% | |
break | |
} | |
} | |
SplitPath, A_AhkPath,, AhkDir | |
ToolTip, Hilfe wird heruntergeladen... | |
UrlDownloadToFile, https://github.com/ahkde/docs/releases, %TmpDir%\latest.htm | |
FileRead, latest, %TmpDir%\latest.htm | |
if RegExMatch(latest, "/releases/download/(.*?)/", s) | |
ReleaseVersion := s1 | |
URLDownloadToFile, https://github.com/ahkde/docs/releases/download/%ReleaseVersion%/AutoHotkeyHelp_DE.zip, %TmpDir%\AutoHotkeyHelp_DE.zip | |
if(ErrorLevel OR !FileExist(TmpDir "\AutoHotkeyHelp_DE.zip")){ | |
MsgBox, 21, Fehler beim Download, Ein Fehler beim Download ist aufgetreten! %ErrorLevel% | |
IfMsgBox, Retry | |
Reload | |
else | |
ExitApp | |
} | |
ToolTip, Hilfe wird entpackt... | |
Unz(TmpDir "\AutoHotkeyHelp_DE.zip", TmpDir "\AHKHelpDE") | |
if(!FileExist(TmpDir "\AHKHelpDE\Autohotkey.chm")){ | |
MsgBox, 21, Fehler beim Entpacken, Ein Fehler beim Entpacken ist aufgetreten! | |
IfMsgBox, Retry | |
Reload | |
else | |
ExitApp | |
} | |
ToolTip, Hilfe wird verschoben... | |
FileMove, %TmpDir%\AHKHelpDE\Autohotkey.chm, % AhkDir "\Autohotkey_de.chm", 1 | |
ToolTip, Temporäre Dateien werden gelöscht... | |
FileDelete, %TmpDir%\AutoHotkeyHelp_DE.zip | |
FileDelete, %TmpDir%\latest.htm | |
FileRemoveDir, %TmpDir%\AHKHelpDE, 1 | |
ToolTip | |
MsgBox, Neue deutsche Hilfe kopiert! | |
ExitApp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment