Re: TextEdit rtfd problem
Re: TextEdit rtfd problem
- Subject: Re: TextEdit rtfd problem
- From: Shane Stanley <email@hidden>
- Date: Thu, 24 Sep 2015 15:48:18 +1000
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
|
_______________________________________________
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