I was using the same property names in both AppDelegate and OddNSods, but even now that I’ve changed the OddsNSods variable names (there’s only 2 that were the same), I’m still getting an empty return.
Called To…
on setPathToMMFolderOAS:temp
set p to 1
try
set {mailManagerDesktopFolderPathOAS} to temp as list
set pathtodesktopOAS to path to desktop
set p to 2
if mailManagerDesktopFolderPathOAS = "New SetUp" then
say "New set up" as text —< This activates on first pass
tell application "Finder"
try
set p to 3
# This defaults to desktop
set mailManagerDesktopFolderPathOAS to folder (pathtodesktopOAS & "Mail Manager Folder" as text) as alias as text
on error
try
do shell script "mkdir -p " & quoted form of (POSIX path of ((pathtodesktopOAS & "Mail Manager Folder") as text))
end try
set p to 4
set mailManagerDesktopFolderPathOAS to folder (pathtodesktopOAS & "Mail Manager Folder" as text) as alias as text
set p to 5
end try
end tell
else
tell application "Finder"
set p to 5
try
if not (exists (folder (mailManagerDesktopFolderPathOAS as text))) then
set p to 6
set theNote to "The 'Mail Manager Folder' folder appears to be missing, it may have been moved. " & return & return & "It should have been in this location..." & return & return & mailManagerDesktopFolderPathOAS & return & return & "Please locate it."
set theNotePrefix to ""
set p to 7
repeat
set p to 8
set pathToMM to (choose folder with prompt theNotePrefix & theNote)
set p to 9
tell application "System Events" to set folderName to name of pathToMM
set p to 10
if folderName = "Mail Manager Folder" then
set p to 11
set mailManagerDesktopFolderPathOAS to pathToMM as text
set p to 12
exit repeat
else
set p to 13
set theNotePrefix to "You have not selected a folder named 'Mail Manager Folder'." & return & return & "Instead, you chose a folder named '" & folderName & "'." & return & return
end if
end repeat
end if
on error errmsg number errNum
set p to 14
try
set theNote to "The 'Mail Manager Folder' folder appears to be missing, it may have been moved. " & return & return & "Please locate it." & return & return & "NOTE: If you cannot find the 'Mail Manager Folder' folder, just select any folder, " & return & "and you'll be offered the choice of creating a new one on the desktop."
set theNotePrefix to ""
set p to 15
repeat
set p to 16
set pathToMM to (choose folder with prompt theNotePrefix & theNote)
set p to 17
tell application "System Events" to set folderName to name of pathToMM
set p to 18
if folderName = "Mail Manager Folder" then
set p to 19
set mailManagerDesktopFolderPathOAS to pathToMM as text
set p to 20
exit repeat
else
set p to 21
tell application "System Events" to display dialog "It appears that there is a problem with finding a 'Mail Manager Folder' folder." & return & return & "Do you want to create a new 'Mail Manager Folder' folder on the desktop?" buttons {"Create new folder", "Try finding again, please"}
if the button returned of the result is "Create new folder" then
tell application "Finder"
try
do shell script "mkdir -p " & quoted form of (POSIX path of ((pathtodesktopOAS & "Mail Manager Folder") as text))
end try
try
set mailManagerDesktopFolderPathOAS to folder "Mail Manager Folder" as alias as text
exit repeat
end try
end tell
end if
set theNotePrefix to "You have not selected a 'Mail Manager Folder' folder." & return & return & "Instead, you chose a folder named '" & folderName & "'." & return & return
end if
end repeat
end try
end try
end tell
end if
on error errmsg
tell application "System Events" to display dialog "setPathToMMFolder error " & errmsg & " p = " & p as text giving up after 10
end try
# This displays the full path as text
tell application "System Events" to display dialog "OddsNSods " & mailManagerDesktopFolderPathOAS as text
# This returns nothing
return {mailManagerDesktopFolderPathOAS as text}
end setPathToMMFolderOAS: