Platforms to show: All Mac Windows Linux Cross-Platform
/MacCloud/Sandbox Safe LoginItems Helper App/Build
Required plugins for this example:
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacCloud/Sandbox Safe LoginItems Helper App/Build
This example is the version from Thu, 6th Apr 2016.
Project "Build.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
EventHandler Sub Open()
// find app
dim Folder as FolderItem = GetFolderItem("")
dim BuildHelper as FolderItem = Find(Folder, "Builds - Helper")
dim BuildMain as FolderItem = Find(Folder, "Builds - Main")
dim MacHelperFolder as FolderItem = find(BuildHelper, "Mac")
dim MacMainFolder as FolderItem = find(BuildMain, "Mac")
dim MainApp as FolderItem = MacMainFolder.Child("Main.app")
dim HelperApp as FolderItem = MacHelperFolder.Child("Helper.app")
dim ContentsFolder as FolderItem = MainApp.Child("Contents")
// add helper app to main app
dim LibraryFolder as FolderItem = ContentsFolder.Child("Library")
LibraryFolder.CreateAsFolder
dim LoginItemsFolder as FolderItem = LibraryFolder.Child("LoginItems")
LoginItemsFolder.CreateAsFolder
HelperApp.CopyFileTo LoginItemsFolder.Child("Helper.app")
// fix info.plist
dim HelperApp2 as FolderItem = LoginItemsFolder.Child("Helper.app")
dim ContentsFolder2 as FolderItem = HelperApp2.Child("Contents")
dim InfoFile as FolderItem = ContentsFolder2.Child("Info.plist")
dim b as BinaryStream = BinaryStream.Open(InfoFile, true)
dim s as string = b.Read(b.Length, encodings.UTF8)
if instr(s, "<key>LSUIElement</key>") = 0 then // not yet patched
s = ReplaceAll(s, "</dict>", "<key>LSUIElement</key><true/></dict>")
b.Position = 0
b.Write s
b.Close
end if
MsgBox "OK"
End EventHandler
Function Find(f as FolderItem, name as string) As FolderItem
dim c as integer = f.Count
for i as integer = 1 to c
dim g as FolderItem = f.TrueItem(i)
if g<>nil then
if instr(g.name,name)>0 then
Return g
end if
end if
next
End Function
End Class
Class Window1 Inherits Window
Control Label1 Inherits Label
ControlInstance Label1 Inherits Label
End Control
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&Ablage"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Bearbeiten"
MenuItem EditUndo = "&Rückgängig"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "&Ausschneiden"
MenuItem EditCopy = "&Kopieren"
MenuItem EditPaste = "&Einfügen"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "&Alles auswählen"
End MenuBar
End Project
See also:
The items on this page are in the following plugins: MBS MacCloud Plugin.