Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;Copyright by BiZZ Keryear under CC by-sa 3.0 http://creativecommons.org/licenses/by-sa/3.0/
- ;BiZZ Keryear aka MrMegaPussyPlayer
- ;each copy must contain these three credits lines
- if A_AhkVersion < 1.1.16.05
- {
- msgbox ,16,! ! ! ! ! ! ! ! ! Error: Wrong Version of AHK ! ! ! ! ! ! ! ! !, You are using an outdated version of AHK!`n`n`nPlease grab the correct one:`t`tv1.1.16.05 (or later but before 2.x)`n`n`tfrom:`thttp://ahkscript.org/download/`n`nScript will exit after you click ok.
- ExitApp
- }
- else if A_AhkVersion => 2.
- {
- msgbox ,16,! ! ! ! ! ! ! ! ! Error: Wrong Version of AHK ! ! ! ! ! ! ! ! !, You are using a wrong version of AHK!`nThis script is not compatible with the experimental 2.x or later`n`nPlease grab the correct one:`t`tv1.1.16.05 (or later but before 2.x)`n`n`tfrom:`thttp://ahkscript.org/download/`n`nScript will exit after you click ok.
- ExitApp
- }
- defaultBasePath = %USERPROFILE%\AppData\Local\Frontier_Developments\Products\FORC-FDEV-D-1002
- defaultLogpath = %defaultBasePath%\Logs
- #SingleInstance force
- DetectHiddenWindows , On
- Menu, TRAY, Tip , Elite Dangerous System Data Grabber V1
- Menu, TRAY, NoStandard
- Menu, TRAY, Add , Exit Script , ExitSub
- Menu, TRAY, Add , Reload Script , ReloadSub
- Menu, TRAY, Add
- Menu, TRAY, Add , Test ED Settings, testini
- Menu, TRAY, Add
- Menu, TRAY, Add , Change Settings, SettingsGui
- Menu, TRAY, Add
- Menu, TRAY, Add , Grab System, GrabSystem
- Menu, TRAY, Default , Grab System
- IfNotExist datagrab.ini
- {
- gosub reset
- sleep 100
- gosub settingsgui
- /*
- to do:
- write errorhandler
- */
- }
- else
- {
- ;IniRead, OutputVar, Filename [, Section, Key, Default]
- IniRead, BasePath, datagrab.ini , PathSettings , BasePath
- IniRead, Logpath, datagrab.ini , PathSettings , Logpath
- }
- dummy:
- return
- ;-----------functions------------
- SettingsGui:
- Gui, 1:Add, Text, x36 y7 w786 h130 , ED System Data Grabber:`tCopies the current System the user is in to the clipboard.`n`t`t`t`tOnce the ini is written it will do so from the start `tas well as if choosen from the tray menu`t or if the tray icon is double clicked`n`n`t`t`t`tThis app is controled by its taskicon...`n`t`t`t`t`tClicking OK as well as choosing "Test ED Settings" will edit the ED settings.`n`t`t`t`t`t"Change Settings" will bring up this menu`n`t`t`t`t`tThe rest of Menu should be selfexplaining`n`nTo Do: implementing changeable hotkeys for more comfort. `t Writing Errorhandlers for more stability`nCopyright by BiZZ Keryear under CC by-sa 3.0 http://creativecommons.org/licenses/by-sa/3.0/
- Gui, 1:Add, Text, x6 y157 w90 h20 , Path to logs:
- Gui, 1:Add, Text, x106 y157 w690 h20 , %LogPath%
- Gui, 1:Add, Button, x806 y157 w60 h20 gChangeLog, Change
- Gui, 1:Add, Text, x6 y187 w690 h20 , Path to settings
- Gui, 1:Add, Text, x106 y187 w690 h20 , %BasePath%
- Gui, 1:Add, Button, x806 y187 w60 h20 gChangeSetting, Change
- Gui, 1:Add, Button, x290 y217 w100 h30 Default ,&OK
- Gui, 1:Add, Button, x510 y217 w100 h30 gResetd ,&Reset to default
- Gui, 1:Show, x323 y203 h252 w880, ED System Data Grabber V1.1 -- Settings:
- Return
- GrabSystem:
- gosub FindNewestLog
- gosub Parselog
- return
- WriteSettings:
- IniWrite, 1.0 , datagrab.ini, Version , Version
- ;IniWrite, Value, Filename, Section [, Key]
- IniWrite, %BasePath% , datagrab.ini, PathSettings , BasePath
- IniWrite, %Logpath%, datagrab.ini, PathSettings , Logpath
- return
- ExitSub:
- ExitApp
- return
- ReloadSub:
- reload
- return
- testini:
- AppConfig = %BasePath%\AppConfig.xml
- ifnotexist %AppConfig%
- {
- msgbox ,16,! ! ! ! ! ! ! ! ! Error: Path to ED Settings File Wrong ! ! ! ! ! ! ! ! !, Try to find the file AppConfig.xml from Elite Dangerous and change the path accordenly`n`nP.S.: The path to the logfiles might be wrong as well.
- gosub ChangeSetting
- }
- else
- {
- file := FileOpen(AppConfig, "r")
- line := file.Read()
- if file
- file.Close()
- NeedleRegEx := "mi)<Network\s*VerboseLogging=""([0|1])"""
- out := RegExMatch(line, NeedleRegEx, verboseone)
- if !out
- {
- NeedleRegExReplace := "mi)(<Network\s)"
- line := RegExReplace(line, NeedleRegExReplace , "<Network`n`t VerboseLogging=""1""")
- verboseone1 := 1
- }
- NeedleRegEx2 := "mi)</Network>\s*VerboseLogging=""([0|1])"""
- out2 := RegExMatch(line, NeedleRegEx2, verbosetwo)
- if !out2
- {
- NeedleRegExReplace := "mi)</Network>$"
- line := RegExReplace(line, NeedleRegExReplace , "</Network>`n`tVerboseLogging=""1""")
- verbosetwo1 := 1
- }
- if verboseone1 != 1
- {
- NeedleRegExReplace := "mi)<Network\s*VerboseLogging=""0"""
- line := RegExReplace(line, NeedleRegExReplace , "<Network`n`t VerboseLogging=""1""")
- }
- if verbosetwo1 != 1
- {
- NeedleRegExReplace := "mi)</Network>\s*VerboseLogging=""0"""
- line := RegExReplace(line, NeedleRegExReplace , "</Network>`n`tVerboseLogging=""1""")
- }
- if (verboseone1 = 0 OR verbosetwo1 = 0 OR !out OR !out2)
- {
- FileCopy, %AppConfig%, %BasePath%/AppConfig.xml.bak
- file := FileOpen(AppConfig, "w")
- if !IsObject(file)
- msgbox error, failed to change Elite Dangerous settings! If you see this error something is off
- else
- File.Write(line)
- if file
- file.Close()
- ifwinexist Elite Dangerous Launcher
- msgbox This app has dectected that Elite Dangerous is currently running.`n`nSince it made changes to the Elite Dangerous Setting file`nElite Dangerous needs to be restarted.`nAn copy of the previous version of the config file is made: AppConfig.xml.bak
- }
- }
- return
- ChangeLog:
- inputbox , nLogPath , Change Path to log files, Type or Paste in here the path to EliteDangerous log files:,,800,120,,,,,%LogPath%
- if Errorlevel
- Errorlevel =
- else
- {
- LogPath := nLogPath
- nLogPath =
- }
- gui , 1:destroy
- gosub SettingsGui
- return
- ChangeSetting:
- inputbox , nBasePath , Change Path to settings, Type or Paste in here the path to EliteDangerous settings file:,,800,120,,,,,%BasePath%
- if Errorlevel
- Errorlevel =
- else
- {
- BasePath := nBasePath
- nBasePath =
- }
- gui , 1:destroy
- gosub SettingsGui
- return
- resetd:
- gosub reset
- gui , 1:destroy
- gosub SettingsGui
- return
- reset:
- BasePath := defaultBasePath
- Logpath := defaultLogpath
- return
- ButtonOK:
- gui , 1:destroy
- gosub testini
- gosub WriteSettings
- return
- Parselog:
- target=%Logpath%\%LastFileName%
- file := FileOpen(target, "r")
- while !file.AtEOF ; This loop will run until it finds the end of the file
- {
- ;Read the next line of the script
- line := file.ReadLine()
- ;Check if the line starts with a timestamp
- NeedleRegEx := "^\{(\d{2}:\d{2}:\d{2})\} System:\d*\((.*?)\)"
- out := RegExMatch(line, NeedleRegEx, System)
- ;If the line started with a timestamp, do more stuff...
- if (out > 0)
- {
- LastSystem := System2
- LastTime := System1
- }
- }
- if file
- file.Close()
- clipboard := LastSystem
- return
- FindNewestLog:
- frun :=0
- Loop, %Logpath%\netLog.*.log
- {
- if frun = 0
- {
- LastFileDate:= A_LoopFileTimeModified
- LastFileName := A_LoopFileName
- frun:=1
- }
- diff := A_LoopFileTimeModified - LastFileDate
- if diff > 0
- {
- LastFileName := A_LoopFileName
- LastFileDate:= A_LoopFileTimeModified
- }
- }
- return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement