; AppData_INI-test.au3 ; ; Dag Sandgren #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Res_Language=1053 #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #pragma compile(Compatibility, win7) #pragma compile(x64, False) #pragma compile(UPX, False) #pragma compile(ExecLevel, asInvoker) #pragma compile(FileDescription, AppData_INI-test) #pragma compile(ProductName, Test) #pragma compile(ProductVersion, 1.0) #pragma compile(FileVersion, 2.0.1.0, au3.3.14.2) ; The last parameter is optional. #pragma compile(LegalCopyright, © Dag Sandgren) #pragma compile(CompanyName, 'Draupnir Streckkodpartner AB, Täby') ;#include ;#include ;#include ;#include Opt("MustDeclareVars", 1) ;Opt("TrayIconDebug", 1) Opt("TrayOnEventMode", 1) Opt("TrayMenuMode", 1) ; Don't show the default tray context menu Dim $sEM_Datapath = @AppDataCommonDir&"\_TEST\" Dim $configfilename = "test.ini" ; Config file, matching ftp server Dim $config = $sEM_Datapath & $configfilename Dim $version = "2.0.1.0" Dim $phone = "" Dim $computer = "" MsgBox (64,"Nr 1","Phone="&$phone&@LF&"Computer="&$computer,5) If Not FileExists ($sEM_Datapath) Then DirCreate ($sEM_Datapath) EndIf If Not FileExists ($config) Then ; No inifile MakeEM_INIfile() EndIf ReadInifile() MsgBox (64,"Nr 2","Phone="&$phone&@LF&"Computer="&$computer,5) $phone = "00000000" Update_Inifile() ReadInifile() MsgBox (64,"Nr 3","Phone="&$phone&@LF&"Computer="&$computer,5) $phone = "11111111" Update_Inifile() ReadInifile() MsgBox (64,"Nr 4","Phone="&$phone&@LF&"Computer="&$computer,5) Exit ;------------------------------------------ Func MakeEM_INIfile() local $handle = FileOpen ($config, 2 ) ;Open inifile for writing If @error <> -1 Then FileWriteLine ( $handle, "[Location]") FileWriteLine ( $handle, "Phone=") FileWriteLine ( $handle, "") FileWriteLine ( $handle, "[Install]") FileWriteLine ( $handle, "FirstVersion=" & $version) EndIf FileClose ($handle) EndFunc ;===>MakeEM_INIfile Func Update_Inifile () ;[Location] Phone = "" $phone = IniRead($config, "Location", "Phone", "") If $phone == "" Then IniWrite ($config, "Location", "Phone", $phone) EndIf $computer = IniRead($config, "Location", "Computer", "") If $computer== "" Then $computer = @ComputerName&", User:"&@UserName&", "&@OSVersion&", Desktop: "&@DesktopWidth&"x"&@DesktopHeight IniWrite ($config, "Location", "Computer", $computer) EndIf EndFunc ;===>Update_Inifile Func ReadInifile() IniRead ($config, "Location", "Phone", "default") IniRead ($config, "Location", "Computer", "default") EndFunc ;===>ReadInifile