• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: TextEdit rtfd problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: TextEdit rtfd problem


  • Subject: Re: TextEdit rtfd problem
  • From: Brian Christmas <email@hidden>
  • Date: Thu, 24 Sep 2015 15:59:56 +1000

Thank you mutely Shane.

I’ll implement your suggestions immediately.

As it turns out, my earlier mistake was due to my leaving out one of the folders in the file path, that had a similar name to the file, and I just could not see it for looking. Bad blue on my part, so thanks for the help.

Regards

Santa


On 24 Sep 2015, at 3:48 pm, Shane Stanley <email@hidden> wrote:

On 24 Sep 2015, at 12:58 PM, Brian Christmas <email@hidden> wrote:

tell application "Finder" to set my dailyServerFolder to (my serverFolder & ":" & ("Yearly Email Storage " & my theYear as text) & ":" & (my theAddedMonth) & ":" & (my dailyName) as text)

Why is the Finder involved here? You're just concatenating some strings:

set my dailyServerFolder to my serverFolder & ":" & "Yearly Email Storage " & my theYear & ":" & my theAddedMonth & ":" & my dailyName

Don't litter your code with as text everywhere. Otherwise you just risk masking potential problems, and making it harder to trouble-shoot.

try
do shell script "mkdir -p " & quoted form of POSIX path of (my dailyServerFolder as text)
on error errmsg number errnum
if my runForOz then tell application "System Events" to display dialog "Mail Manager Loop Runner setupPrintCoverPage setting server folder " & errmsg & " error number " & errnum & " p = " & p & return & (my dailyServerFolder as text)
end try

You're already using ASObjC, so there's no need to use shell scripting for stuff like creating folders; all it does is slow things down. Use something like this instead:

set {theResult, theError} to current application's NSFileManager's defaultManager()'s createDirectoryAtPath:(POSIX path of my dailyServerFolder) withIntermediateDirectories:true attributes:(missing value) |error|:(reference)
if not (theResult as boolean) then
set errmsg to theError's localizedDescription() as text
if my runForOz then tell application "System Events" to display dialog "Mail Manager Loop Runner setupPrintCoverPage setting server folder " & errmsg & " p = " & p & return & my dailyServerFolder
end if

-- 
Shane Stanley <email@hidden>
<www.macosxautomation.com/applescript/apps/>
Do not post admin requests to the list. They will be ignored. AppleScript-Users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: Archives: http://lists.apple.com/archives/applescript-users This email sent to email@hidden
References: 
 >Re: TextEdit rtfd problem (From: Brian Christmas <email@hidden>)
 >Re: TextEdit rtfd problem (From: Shane Stanley <email@hidden>)

  • Prev by Date: Re: due dates, reminders, & AppleScript
  • Next by Date: Re: TextEdit rtfd problem
  • Previous by thread: Re: TextEdit rtfd problem
  • Next by thread: Re: due dates, reminders, & AppleScript
  • Index(es):
    • Date
    • Thread