;;; | ;;; all ACE apps boot inserting-->| #Include %A_AppData%\ACE\ACEs.inc ;;; | Global AcePath, SpacePath, FacePath, PlacePath ; Terms TermsFile Global AceID, SpaceID, FaceID, PlaceID ; Terms0 Term"TERM" Global AceName, SpaceName, FaceName, PlaceName ; Terms1...999 Global FaceAbout, PlaceAbout, UserProfile Global FaceApps, PlaceApps Global FaceBoard, PlaceBoard Global FaceGuide, PlaceGuide Global FaceMail, PlaceMail Global FaceNotes, PlaceNotes Global FaceTalk, PlaceTalk Global FaceText, PlaceText Global FaceTunes, PlaceTunes Global CharterFile := "desktop.ini" ; "ACE.ini" ; #NoEnv ; enable this for better performance ACEstart() AceFolder := SpacePath ; compatibility to v0.x CloudPath := SpacePath ; compatibility to v1.x CloudID := SpaceID ; compatibility to v1.x CloudName := SpaceName ; compatibility to v1.x MePath := FacePath ; compatibility to v1.x MeID := FaceID ; compatibility to v1.x MeName := FaceName ; compatibility to v1.x If (Diagnostic = "1"){ DeACE := Detokenize("") DeSPACE := Detokenize("") DeFACE := Detokenize("") DePLACE := Detokenize("") msgbox, 64, ACE DEUCE, Temporary diagnostic `n`n %DeACE%`n %DeSPACE%`n %DeFACE% `n %DePLACE%`n`n%PlacePath%\%PlaceAbout% `n%PlacePath%\%PlaceApps% `n%PlacePath%\%PlaceBoard% `n%PlacePath%\%PlaceGuide% `n%PlacePath%\%PlaceNotes% `n%PlacePath%\%PlaceTalk% `n%PlacePath%\%PlaceText% `n%PlacePath%\%PlaceTunes% , 3 } ;;; ;;; Remaining code MUST only be functions ;;; ; SpotIsPath() {} ; SpotIsFile() {} ; FaceIsValid() {} ; PlaceIsValid() {} ; SpotIsValid() {} FaceNode() { NodeLen := StrLen(FacePath) - StrLen(SpacePath) StringRight, ReturnVal, FacePath, %NodeLen% Return ReturnVal } PlaceNode() { NodeLen := StrLen(PlacePath) - StrLen(SpacePath) StringRight, ReturnVal, PlacePath, %NodeLen% Return ReturnVal } FacePathFix() { Return SpacePath . FaceNode() } PlacePathFix() { Return SpacePath . PlaceNode() } SpotPathFix(SentPath) { Return SpacePath . SpotNode(SentPath) } SpotNode(SentPath) { ; SentPath is from anywhere so return NODE of applicable space path ; If (InStr(SentPath, SpacePath, False, 1, 1) <> 1) NodeLen := StrLen(SentPath) - StrLen(SpotSpace(SentPath)) Else NodeLen := StrLen(SentPath) - StrLen(SpacePath) StringRight, ReturnVal, SentPath, %NodeLen% Return ReturnVal } SpotSpace(SentPath) { ; SentPath is from anywhere so return THE registered space path (if not found return blank) Loop 99 { IniRead, Device, %FacePath%\%CharterFile%, Space, Device%A_Index% IniRead, DeviceSpace, %FacePath%\%CharterFile%, Space, %Device% ; [, Default] If (Instr(SentPath, DeviceSpace, False, 1, 1) = 1) ReturnVal := DeviceSpace Device%A_Index% := Device } Return ReturnVal } AboutEnum(){ Return "About\:Apps:Board:Guide:Mail:Notes:Talk:Text:Tube:Tunes" } AnyplaceEnum(){ Return AboutEnum() . "|Listen\:Book:Music|Read\:Book:Magazine:News|Watch\:Movie:Picture:Video" } HomeplaceEnum(){ Return AboutEnum() . "|Documents|Games|Music|Pictures|Records|Shops|Videos" } WorkplaceEnum(){ Return AboutEnum() . "|Customer|Employee|Facility|Government|MANAGE|Product|Public|Vendor" } SomeplaceEnum(){ Return AboutEnum() . "" } WhichEnum(){ MsgBox, 36, Establish As, Create a home of desktops? IfMsgBox, OK return HomeplaceEnum() MsgBox, 36, Establish As, Create a workplace of doors? IfMsgBox, OK Return WorkplaceEnum() Return SomeplaceEnum() } Assert(TheTest, TheMessage, TheDuration) { If (TheTest = 0) MsgBox, 64, Assert, %TheMessage%, %TheDuration% Return } ACEstart(){ Global UserName, Terms, TermsFile Global AcePlace, PlaceEnum, PlaceClass EnvGet, UserName, USERNAME RegRead, AcePlace, HKEY_CURRENT_USER, Environment, AcePlace If (AcePlace < 0 or AcePlace > 9 or AcePlace = "") { AcePlace := 1 RegWrite, REG_SZ, HKEY_CURRENT_USER, Environment, AcePlace, %AcePlace% } RegRead, SpacePath, HKEY_CURRENT_USER, Environment, SpacePath ; AceFolder If (SpacePath = "") { AceStart1: SpacePath := "" SpacePath := Spacement() MsgBox, 36, ACE Install, CLOUD folder established. `n`nSpacePath = %SpacePath% `nFacePath = %FacePath% `nPlacePath = %PlacePath% `n`nContinue? IfMsgBox No GoTo AceStart1 RegWrite, REG_SZ, HKEY_CURRENT_USER, Environment, SpacePath, %SpacePath% } Else { SpacePath := Spacement() } RegRead, FacePath, HKEY_CURRENT_USER, Environment, FacePath ; AcePlace0 If (FacePath = "") { AceStart2: FacePath := "" FacePath := Facement() MsgBox, 36, ACE Install, Face folder established. `n`nSpacePath = %SpacePath% `nFacePath = %FacePath% `nPlacePath = %PlacePath% `n`nContinue? IfMsgBox No GoTo AceStart2 RegWrite, REG_SZ, HKEY_CURRENT_USER, Environment, FacePath, %FacePath% } Else { FacePath := Facement() } RegRead, PlacePath, HKEY_CURRENT_USER, Environment, PlacePath ; AcePlace%AcePlace% If (PlacePath = "") { AceStart3: PlacePath := "" PlacePath := Placement() MsgBox, 36, ACE Install, PLACE folder established. `n`nSpacePath = %SpacePath% `nFacePath = %FacePath% `nPlacePath = %PlacePath% `n`nContinue? IfMsgBox No GoTo AceStart3 RegWrite, REG_SZ, HKEY_CURRENT_USER, Environment, PlacePath, %PlacePath% } Else { PlacePath := Placement() } IniRead, SpaceID, %SpacePath%\%CharterFile%, Place, ID, CLOUD IniRead, FaceID, %FacePath%\%CharterFile%, Place, ID, ME IniRead, PlaceID, %PlacePath%\%CharterFile%, Place, ID, HERE IniRead, SpaceName, %SpacePath%\%CharterFile%, Place, Name, Internet IniRead, FaceName, %FacePath%\%CharterFile%, Place, Name, device IniRead, PlaceName, %PlacePath%\%CharterFile%, Place, Name, location AcePath := A_ScriptDir GetCharter("Face") GetCharter("Place") Return } GetCharter(Face_Place) { Global FacePath, PlacePath Terms := "ERROR" TermsPath := %Face_Place%Path TermsFile := TermsPath . "\" . CharterFile If (CharterFile = "desktop.ini") Section := "Place" Else Section := "Place" ; "Terms" IfExist, %TermsFile% { IniRead, Terms, %TermsFile%, %Section%, Terms } IniRead, PlaceClass, %TermsFile%, Place, Class, Someplace ClassEnum := %PlaceClass%Enum ; ; %Terms% should represent your PLACE basic folder structure ; ; BUT double check and update CharterFile if missing (use defaults) ; If (Terms = "ERROR" or Terms = "") { Assert(0, "Your " . Face_Place . " charter is incomplete. `nResetting to defaults...", 5) ; ; MUST add choice of PLACE here ; If (Face_Place = "FACE") Terms := AnyplaceEnum() Else Terms := WorkplaceEnum() IniWrite, %Terms%, %TermsFile%, %Section%, Terms } Else { IniRead, PlaceEnum, %TermsFile%, %Section%, Terms, %ClassEnum% } ; ; parse by PIPE to determine the ROOTS (of this PLACE) ; StringSplit, TermRoots, PlaceEnum, | Loop, %TermRoots0% { Root_Index := A_Index TermRoot := TermRoots%Root_Index% ; ; parse by COLON to determine NODES (of this ROOT) ; StringSplit, TermNodes, TermRoot, : Loop, %TermNodes0% { Node_Index := A_Index Term := TermNodes%Node_Index% StringSplit, NodeRoot, Term, \ IniRead, Term%NodeRoot1%, %TermsFile%, Terms, %NodeRoot1%, %Term% If (Node_Index = 1) { NodePrefix := Term%NodeRoot1% ; . "\" StringRight, LastPrefixChr, NodePrefix, 1 If (LastPrefixChr <> "\") NodePrefix := NodePrefix . "\" } If (Node_Index > 1) { ;;; Node%NodeRoot1% := NodePrefix . Term%Term% %Face_Place%%NodeRoot1% := NodePrefix . Term%Term% } Else { ;;; Node%NodeRoot1% := Term%NodeRoot1% %Face_Place%%NodeRoot1% := Term%NodeRoot1% } } } ;msgbox %FaceAbout% `n%FaceBoard% `n%FaceGuide% `n%FaceMail% `n%FaceNotes% `n%FaceMail% `n%FaceTalk% `n%FaceText% `n%FaceTunes% `n`n%PlaceAbout% `n%PlaceBoard% `n%PlaceGuide% `n%PlaceMail% `n%PlaceNotes% `n%PlaceMail% `n%PlaceTalk% `n%PlaceText% `n%PlaceTunes% Return } ; Todos: HomePath (first with class of 'Homeplace') ; WorkPath (first with class of 'Workplace') Spacement() { Global SpacePath, PlacePath, FacePath, AcePath, AcePlace IfExist, %SpacePath% Return SpacePath Drive1 = %HOMEDRIVE% Drive2 = %SystemDrive% EnvGet, Drive1, HomeDrive EnvGet, Drive2, SystemDrive MsgBox 36, ACE Install, A Cloud Ensemble `n`nACE is often shared by every user of a device. Locating it at `nthe root of a drive is simple to remember. `n`nDesignate Cloud storage at %Drive1%\ ? IfMsgBox Yes AceDrive := Drive1 If (AceDrive = "") { If (Drive1 <> Drive2) { MsgBox 36, ACE Install, Designate Cloud storage at %Drive2%\? IfMsgBox Yes AceDrive = %SYSTEMDRIVE% } } If (AceDrive <> "") { SpacePath = %AceDrive%\CLOUD } Else { MsgBox 36, ACE Install, Okay`, how about locating Cloud storage to the Public user? IfMsgBox Yes SpacePath = %PUBLIC%\CLOUD Else { AceDrive := ChooseDrive("Fixed", "Choose a CLOUD storage folder (this device)`n`nSelect a folder and OK `t- or -`tCANCEL to next drive", 1) StringRight, LastChar, AceDrive, 1 If (LastChar = "") { MsgBox, 64, ACE Install, Installation fails! You must select a Cloud storage folder. ExitApp } If (LastChar = "\") { LeftLen := StrLen(AceDrive) - 1 StringLeft, SpacePath, AceDrive, LeftLen } Else SpacePath := AceDrive } } ; Assert(FileExist(SpacePath), "SpacePath does not exist. `n%SpacePath%", 0) RegWrite, REG_SZ, HKEY_CURRENT_USER, Environment, AceFolder, %SpacePath% RegWrite, REG_SZ, HKEY_CURRENT_USER, Environment, SpacePath, %SpacePath% Return SpacePath } Facement() { Global SpacePath, PlacePath, FacePath, AcePath, AcePlace IfNotExist, %SpacePath% { MsgBox, 64, ACE Install, Cloud offline storage path does NOT exist. Cannot establish FACE path. Return } Facement1: IfExist, %FacePath% { RegWrite, REG_SZ, HKEY_CURRENT_USER, Environment, AcePlace0, %FacePath% RegWrite, REG_SZ, HKEY_CURRENT_USER, Environment, FacePath, %FacePath% Return FacePath } FileSelectFolder, FacePath, %SpacePath%, 3, CLOUD personal storage...`n`nSelect your FACE folder: IfExist, %FacePath% Goto Facement1 MsgBox, 35, ACE Install, Your FACE path does not exist`, create it? `n`n`t%FacePath% IfMsgBox Yes FileCreateDir, %FacePath% Goto Facement1 } Placement() { Global SpacePath, PlacePath, FacePath, AcePath, AcePlace IfNotExist, %SpacePath% { MsgBox, 64, ACE Install, Cloud offline storage path does NOT exist. Cannot establish PLACE path. Return } Placement1: IfExist, %PlacePath% { RegWrite, REG_SZ, HKEY_CURRENT_USER, Environment, AcePlace%AcePlace%, %PlacePath% RegWrite, REG_SZ, HKEY_CURRENT_USER, Environment, PlacePath, %PlacePath% Return PlacePath } FileSelectFolder, PlacePath, %SpacePath%, 3, CLOUD position storage... `n`nSelect your PLACE folder (e.g., WORK) IfExist, %PlacePath% Goto Placement1 MsgBox, 35, ACE Install, This PLACE path does not exist`, create it?`n`n`t%PlacePath% IfMsgBox Yes FileCreateDir, %PlacePath% Goto Placement1 } ChooseDrive(TypeWanted, PromptMsg, ReturnPath) { DriveGet, DriveList, list DriveListX := 1 Loop { StringMid, Drive, DriveList, %DriveListX%, 1 If (Drive = "") Return DriveLetter := Drive Drive := Drive . ":" DriveGet, DriveStatus, status, %Drive% DriveGet, DriveCap, capacity, %Drive% DriveGet, DriveType, type, %Drive% DriveGet, DriveStatus, status, %Drive% DriveGet, DriveLabel, label, %Drive% DriveGet, DriveFS, fs, %Drive% DriveGet, DriveSerial, serial, %Drive% DrivespaceFree, DriveFree, %Drive% If (DriveStatus <> "NotReady" and (TypeWanted = "" or TypeWanted = DriveType)) { If (PromptMsg <> "") FileSelectFolder, Folder, %Drive%, 3, %PromptMsg% `nDrive %DriveLetter%: `t%DriveFree% free `t`"%DriveLabel%`" `n %DriveStatus% `t%DriveCap% total `t is %DriveType% Else FileSelectFolder, Folder, %Drive%, 3, Drive %DriveLetter%: `t%DriveFree% free `t`"%DriveLabel%`" `n %DriveStatus% `t%DriveCap% total `t is %DriveType% If (Folder <> "") If (ReturnPath = "Y" or ReturnPath = "Yes" or ReturnPath = "YES" or ReturnPath = "1" or ReturnPath = "-1") Return Folder Else Return Drive } DriveListX := DriveListX + 1 } } Tokenize(SentValue){ TokenValues() ;; StringReplace, ReturnValue, SentValue, %A_WinDir%\, <>, All ;; StringReplace, ReturnValue, ReturnValue, %A_ProgramFiles%\, <>, All StringReplace, ReturnValue, SentValue, %A_WinDir%\, `%WinDir`%`\, All StringReplace, ReturnValue, ReturnValue, %A_ProgramFiles%\, `%ProgramFiles`%`\, All ;; StringReplace, ReturnValue, ReturnValue, %AcePath%\, , All ;; StringReplace, ReturnValue, ReturnValue, %FacePath%\, , All ;; StringReplace, ReturnValue, ReturnValue, %PlacePath%\, , All ;; StringReplace, ReturnValue, ReturnValue, %SpacePath%\, , All StringReplace, ReturnValue, ReturnValue, %AcePath%\, `%AcePath`%`\, All StringReplace, ReturnValue, ReturnValue, %FacePath%\, `%FacePath`%`\, All StringReplace, ReturnValue, ReturnValue, %PlacePath%\, `%PlacePath`%`\, All StringReplace, ReturnValue, ReturnValue, %SpacePath%\, `%SpacePath`%`\, All StringReplace, ReturnValue, ReturnValue, http://, , All StringReplace, ReturnValue, ReturnValue, http://www., , All Return % ReturnValue } Detokenize(SentValue){ TokenValues() StringReplace, ReturnValue, SentValue, <>\, %A_WinDir%\, All StringReplace, ReturnValue, ReturnValue, <>, %A_WinDir%\, All StringReplace, ReturnValue, ReturnValue, <>\, %A_ProgramFiles%\, All StringReplace, ReturnValue, ReturnValue, <>, %A_ProgramFiles%\, All StringReplace, ReturnValue, ReturnValue, <>, %A_WinDir%, All StringReplace, ReturnValue, ReturnValue, `%SystemRoot`%, %A_WinDir%, All StringReplace, ReturnValue, ReturnValue, `%WinDir`%, %A_WinDir%, All StringReplace, ReturnValue, ReturnValue, `%UserProfile`%, %UserProfile%, All StringReplace, ReturnValue, ReturnValue, \, %AcePath%\, All StringReplace, ReturnValue, ReturnValue, , %AcePath%\, All StringReplace, ReturnValue, ReturnValue, \, %FacePath%\, All StringReplace, ReturnValue, ReturnValue, , %FacePath%\, All StringReplace, ReturnValue, ReturnValue, \, %PlacePath%\, All StringReplace, ReturnValue, ReturnValue, , %PlacePath%\, All StringReplace, ReturnValue, ReturnValue, \, %SpacePath%\, All StringReplace, ReturnValue, ReturnValue, , %SpacePath%\, All StringReplace, ReturnValue, ReturnValue, `%AcePath`%\, %AcePath%\, All StringReplace, ReturnValue, ReturnValue, `%AcePath`%, %AcePath%\, All StringReplace, ReturnValue, ReturnValue, `%FacePath`%\, %FacePath%\, All StringReplace, ReturnValue, ReturnValue, `%FacePath`%, %FacePath%\, All StringReplace, ReturnValue, ReturnValue, `%PlacePath`%\, %PlacePath%\, All StringReplace, ReturnValue, ReturnValue, `%PlacePath`%, %PlacePath%\, All StringReplace, ReturnValue, ReturnValue, `%SpacePath`%\, %SpacePath%\, All StringReplace, ReturnValue, ReturnValue, `%SpacePath`%, %SpacePath%\, All StringReplace, ReturnValue, ReturnValue, `%FaceAbout`%, %FaceAbout%, All StringReplace, ReturnValue, ReturnValue, `%PlaceAbout`%, %PlaceAbout%, All StringReplace, ReturnValue, ReturnValue, `%FaceApps`%, %FaceApps%, All StringReplace, ReturnValue, ReturnValue, `%PlaceApps`%, %PlaceApps%, All StringReplace, ReturnValue, ReturnValue, `%FaceBoard`%, %FaceBoard%, All StringReplace, ReturnValue, ReturnValue, `%PlaceBoard`%, %PlacBoard%, All StringReplace, ReturnValue, ReturnValue, `%FaceGuide`%, %FaceGuide%, All StringReplace, ReturnValue, ReturnValue, `%PlaceGuide`%, %PlaceGuide%, All StringReplace, ReturnValue, ReturnValue, `%FaceMail`%, %FaceMail%, All StringReplace, ReturnValue, ReturnValue, `%PlaceMail`%, %PlaceMail%, All StringReplace, ReturnValue, ReturnValue, `%FaceNotes`%, %FaceNotes%, All StringReplace, ReturnValue, ReturnValue, `%PlaceNotes`%, %PlaceNotes%, All StringReplace, ReturnValue, ReturnValue, `%FaceTalk`%, %FaceTalk%, All StringReplace, ReturnValue, ReturnValue, `%PlaceTalk`%, %PlaceTalk%, All StringReplace, ReturnValue, ReturnValue, `%FaceText`%, %FaceText%, All StringReplace, ReturnValue, ReturnValue, `%PlaceText`%, %PlaceText%, All StringReplace, ReturnValue, ReturnValue, `%FaceTunes`%, %FaceTunes%, All StringReplace, ReturnValue, ReturnValue, `%PlaceTunes`%, %PlaceTunes%, All StringReplace, ReturnValue, ReturnValue, , http://, All StringReplace, ReturnValue, ReturnValue, , http://www., All Return % ReturnValue } TokenValues(){ RegRead, AcePlace, HKEY_CURRENT_USER, Environment, AcePlace RegRead, PlacePath, HKEY_CURRENT_USER, Environment, AcePlace%AcePlace% AcePath := A_ScriptDir RegRead, SpacePath, HKEY_CURRENT_USER, Environment, SpacePath ; AceFolder RegRead, FacePath, HKEY_CURRENT_USER, Environment, FacePath ; AcePlace0 RegRead, PlacePath, HKEY_CURRENT_USER, Environment, PlacePath ; AcePlace%AcePlace% ; RegRead, FaceAbout, HKEY_CURRENT_USER, Environment, FaceAbout ; RegRead, PlaceAbout, HKEY_CURRENT_USER, Environment, PlaceAbout ; RegRead, FaceApps, HKEY_CURRENT_USER, Environment, FaceApps ; RegRead, PlaceApps, HKEY_CURRENT_USER, Environment, PlaceApps ; RegRead, FaceBoard, HKEY_CURRENT_USER, Environment, FaceBoard ; RegRead, PlaceBoard, HKEY_CURRENT_USER, Environment, PlaceBoard ; RegRead, FaceGuide, HKEY_CURRENT_USER, Environment, FaceGuide ; RegRead, PlaceGuide, HKEY_CURRENT_USER, Environment, PlaceGuide ; RegRead, FaceMail, HKEY_CURRENT_USER, Environment, FaceMail ; RegRead, PlaceMail, HKEY_CURRENT_USER, Environment, PlaceMail ; RegRead, FaceNotes, HKEY_CURRENT_USER, Environment, FaceNotes ; RegRead, PlaceNotes, HKEY_CURRENT_USER, Environment, PlaceNotes ; RegRead, FaceTalk, HKEY_CURRENT_USER, Environment, FaceTalk ; RegRead, PlaceTalk, HKEY_CURRENT_USER, Environment, PlaceTalk ; RegRead, FaceText, HKEY_CURRENT_USER, Environment, FaceText ; RegRead, PlaceText, HKEY_CURRENT_USER, Environment, PlaceText ; RegRead, FaceTunes, HKEY_CURRENT_USER, Environment, FaceTunes ; RegRead, PlaceTunes, HKEY_CURRENT_USER, Environment, PlaceTunes EnvGet, UserProfile, UserProfile }