Platforms to show: All Mac Windows Linux Cross-Platform
FAQ.How to check whether a folderitem is in the LoginItems?
Feedback.
Answer: The following code may help to check for a folderitem in the login items:
Example:
This will not work with pathes relative to the user's local folder.
You may better add a second check for the application name as there may already be another version of your application being registered.
Feedback.
Answer: The following code may help to check for a folderitem in the login items:
Example:
Function isFolderItemInLoginItems(item as folderitem) As boolean
dim c as integer
dim s as string
dim i as integer
dim u as CFURLMBS
dim path as string
u=NewCFURLMBSFile(item)
path=u.PosixFileSystemPath.str
c=CountOfLoginItemsMBS(false)
for i=1 to c
s=LoginItemPropertyAtIndexMBS(1,i,false)
if s=path then
Return true
end if
next
Exception e
Return false
End Function
// An example on how to use it:
dim f as FolderItem
f=ApplicationsFolderMBS(0).Child("iChat.app")
if isFolderItemInLoginItems(f) then
MsgBox "iChat is in the Login items."
else
MsgBox "iChat is not in the Login items."
end if
Notes: This will not work with pathes relative to the user's local folder.
You may better add a second check for the application name as there may already be another version of your application being registered.
Links
MBS Realbasic PDF Plugins - Förderverein St. Arnulf Nickenich