;;; | ;;; ACE apps (starting script) | #Include %A_AppData%\ACE\#aces.aha ;;; | ; #Include %A_AppData%\ACE ; declare/initiate global vars; parse arguments from command line #Include #aces.ahb ; ; AceID := A_ScriptName ; ACE apps use script's name for identity (has file extension type) AceName := bitName ; ACE apps name without extension type 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 ;;; ACEstart(){ 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() } RegRead, AcePath, HKEY_CURRENT_USER, Environment, AcePath ; redundant of #aces.ahb ; IniRead, SpaceID, %SpacePath%\%CharterMirrorName%, Place, ID, CLOUD ; redundant of #aces.ahb IniRead, FaceID, %FacePath%\%CharterMirrorName%, Place, ID, ME ; redundant of #aces.ahb IniRead, PlaceID, %PlacePath%\%CharterMirrorName%, Place, ID, HERE ; redundant of #aces.ahb IniRead, SpaceName, %SpacePath%\%CharterMirrorName%, Place, Name, Internet ; redundant of #aces.ahb IniRead, FaceName, %FacePath%\%CharterMirrorName%, Place, Name, device ; redundant of #aces.ahb IniRead, PlaceName, %PlacePath%\%CharterMirrorName%, Place, Name, location ; redundant of #aces.ahb ; FacePlace := (AcePlace<>0) ? "Place" : "Face" ; redundant of #aces.ahb ; BadFaces := GetCharter("Face") ; redundant of #aces.ahb BadPlaces := GetCharter("Place") ; redundant of #aces.ahb If (BadFaces <> "" or BadPlaces <> "") MsgBox, 64, Charter Plots, `tMissing folders!`n`n(%FaceID%) `n%BadFaces% `n`n[%PlaceID%] `n%BadPlaces%, 4 Return } Face_Place(Token) { ; ; ; F_P := (AcePlace<>0) ? "Place" : "Face" If (Token = "Path" or Token = "") Return %F_P%Path Else Return %F_P%Path . "\" . %F_P%%Token% } IniSetting(aFile, aSection, aKey) { ; Init.bit duplicates this as _initAceSetting ; ; values returned are CLOUD shared (i.e., common to member devices) ; If (aFile = "ace" or aFile = "space" or aFile = "face" or aFile = "place") aFile := %aFile%Path IniRead, aValue, %aFile%, %aSection%, %aKey% ; If (aValue = "") ; IniRead, aValue, %aFile%, %aSection%, %aOldKey% ; If (aValue = "" or aValue = "ERROR") ; aValue := aDefaultValue Return %aValue% } IniSet(aFile, aSection, aKey, aValue) { ; ; values returned are CLOUD shared (i.e., common to member devices) ; If (aFile = "ace" or aFile = "space" or aFile = "face" or aFile = "place") aFile := %aFile%Path IniWrite, %aValue%, %aFile%, %aSection%, %aKey% Return %ErrorLevel% } _DeviceProperty(SentPath, Section, Property) { ; SentPath is of any device; return device's name by matching a %Section%Path ; Section targets the type of path to match against (i.e., space or ace) ; Property determines which value to return (i.e., name or path) ; If (Section = "Place") CharterPath := PlacePath Else CharterPath := FacePath Loop 99 { IniRead, DeviceName, %CharterPath%\%CharterMirrorName%, Device, Device%A_Index% ; changed 112315, was [Place] IniRead, DevicePath, %CharterPath%\%CharterMirrorName%, %Section%, %DeviceName% If (Instr(SentPath, DevicePath, False, 1, 1) = 1) If (Property = "Name") Return DeviceName Else Return DevicePath If (Instr(DevicePath, SentPath, False, 1, 1) = 1) If (Property = "Name") ReturnVal := DeviceName Else ReturnVal := DevicePath } Return ReturnVal ; this is returned when all primary search/matches fail (i.e., second rate match) } _DeviceNode(SentPath, Section) { ; SentPath is any device; return NODE of SentPath after removing matched %Section%Path ; PathMatch := Device%Section%Path(SentPath) If (PathMatch <> "") { RightLen := StrLen(SentPath) - StrLen(PathMatch) StringRight, ReturnVal, SentPath, %RightLen% Return ReturnVal } } _TraceProperty(SentPath, Section, Property) { ; SentPath is any device so if of Space/Ace prepend applicable path ; Section ; Property ; PropertyMatch := Device%Section%%Property%(SentPath) If (Property = "Name") Return PropertyMatch If (PropertyMatch <> "") { RightLen := StrLen(SentPath) - StrLen(PropertyMatch) StringRight, ReturnVal, SentPath, %RightLen% Return %Section%Path . ReturnVal } } DeviceName(SentPath) { ; SentPath is any device; return NAME of device to which it belongs ; ReturnVal := _DeviceProperty(SentPath, "Place", "Name") If (ReturnVal = "") ReturnVal := _DeviceProperty(SentPath, "Face", "Name") If (ReturnVal = "") ReturnVal := _DeviceProperty(SentPath, "Space", "Name") If (ReturnVal = "") ReturnVal := _DeviceProperty(SentPath, "Ace", "Name") Return ReturnVal } DevicePlacePath(SentPath) { ; SentPath is any device; return a matching PLACE device path ; Return _DeviceProperty(SentPath, "Place", "Path") } DeviceFacePath(SentPath) { ; SentPath is any device; return a matching FACE device path ; Return _DeviceProperty(SentPath, "Face", "Path") } DeviceSpacePath(SentPath) { ; SentPath is any device; return a matching SPACE device path ; Return _DeviceProperty(SentPath, "Space", "Path") } DeviceAcePath(SentPath) { ; SentPath is any device; return a matching ACE (if none SPACE) device path ; ReturnVal := _DeviceProperty(SentPath, "Ace", "Path") If (ReturnVal <> "") Return ReturnVal Else Return _DeviceProperty(DeviceSpacePath(SentPath), "Ace", "Path") } DevicePlaceNode(SentPath) { ; SentPath is any device; return NODE of SentPath after removing matched PlacePath ; Return _DeviceNode(SentPath, "Place") } DeviceFaceNode(SentPath) { ; SentPath is any device; return NODE of SentPath after removing matched FacePath ; Return _DeviceNode(SentPath, "Face") } DeviceSpaceNode(SentPath) { ; SentPath is any device; return NODE of SentPath after removing matched SpacePath ; Return _DeviceNode(SentPath, "Space") } DeviceAceNode(SentPath) { ; SentPath is any device; return NODE of SentPath after removing matched AcePath ; Return _DeviceNode(SentPath, "Ace") } TracePath(SentPath) { ; SentPath is from anywhere so if of Space/Ace prepend applicable path ; ReturnVal := _TraceProperty(SentPath, "Place", "Path") If (ReturnVal = "") ReturnVal := _TraceProperty(SentPath, "Face", "Path") If (ReturnVal = "") ReturnVal := _TraceProperty(SentPath, "Space", "Path") If (ReturnVal = "") ReturnVal := _TraceProperty(SentPath, "Ace", "Path") Return ReturnVal } HerePath(SentPath) { IfExist, %SentPath% Return SentPath Else ReturnPath := TracePath(Detokenize(SentPath)) ; 052716 change: add Detokenize() IfExist, %ReturnPath% Return ReturnPath Else { SplitPath, SentPath, sFile, sPath, sExt, sName, sDrive SplitPath, PlacePath, pFile, pPath, pExt, pName, pDrive StringReplace, ReturnPath, SentPath, %sDrive%, %pDrive%, 1 ; IfExist, %ReturnPath% Return ReturnPath ; Else { ; next resolve ; } } } WhichEnum(){ MsgBox, 36, Establishment, Create a home of desktops? IfMsgBox, OK return HomeplaceEnum() MsgBox, 36, Establishment, Create a workplace of doors? IfMsgBox, OK Return WorkplaceEnum() Return SomeplaceEnum() } Assert(TheTest, TheMessage, TheDuration) { If (TheTest = 0) MsgBox, 64, Assert, %TheMessage%, %TheDuration% Return } ;;; ;;; Todos: HomePath (first with class of 'Homeplace') ;;; WorkPath (first with class of 'Workplace') 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) If (ErrorLevel = 1) { MsgBox, 64, ACE Install, Installation fails! You must select a Cloud storage folder. ExitApp } IfExist, %PlacePath% Goto Placement1 MsgBox, 35, ACE Install, This PLACE path does not exist`, create it?`n`n`t%PlacePath% IfMsgBox Yes { ; ; improvement needed HERE! ; FileCreateDir, %PlacePath% } IfMsgBox No Goto Placement1 ExitApp } 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, %A_AppData%\, `%AppData`%`\, 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, `%SystemDrive`%, %SystemDrive%, All StringReplace, ReturnValue, ReturnValue, `%SystemRoot`%, %A_WinDir%, All StringReplace, ReturnValue, ReturnValue, `%WinDir`%, %A_WinDir%, All StringReplace, ReturnValue, ReturnValue, `%UserProfile`%, %UserProfile%, All StringReplace, ReturnValue, ReturnValue, `%AppData`%, %A_AppData%, 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, `%PlaceID`%, %PlaceID%, All ; add 120817 StringReplace, ReturnValue, ReturnValue, `%PlaceName`%, %PlaceName%, All ; add 120817 StringReplace, ReturnValue, ReturnValue, `%FaceID`%, %FaceID%, All ; add 120817 StringReplace, ReturnValue, ReturnValue, `%FaceName`%, %FaceName%, All ; add 120817 ;;;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 ; disabled 090315 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 EnvGet, SystemDrive, SystemDrive } ScreenHeight() { SysGet, Mon, MonitorWorkArea SysGet, sw61, 61 ; 59 60 61 62 76 77 78 79 swHeight := MonBottom - MonTop swHeight := swHeight / 100 * 100 Return swHeight } ; ;SysGet, Mon1, Monitor, 1 ; future ;SysGet, Mon2, Monitor, 2 ; consideration ; ScreenWidth() { SysGet, Mon, MonitorWorkArea SysGet, sw61, 61 ; 59 60 61 62 76 77 78 79 swWidth := sw61 - MonLeft swWidth := swWidth / 100 * 100 Return swWidth }