User Name
Password
AppleNova Forums » Programmer's Nook »

Applescript problem


Register Members List Calendar Search FAQ Posting Guidelines
Applescript problem
Thread Tools
pmazer
Member
 
Join Date: May 2005
Location: Atlanta, GA
Send a message via AIM to pmazer  
2005-12-07, 22:45

[PHP]set txt to ""
set filename to POSIX path of (path to desktop) & "email.txt"

tell application "Mail"
check for new mail
repeat with msg in messages in inbox
if id in msg is not equal to id in first message in inbox then
set txt to txt & "
###

"
end if
set txt to txt & "From: " & (sender in msg) & "
Subject: " & (subject in msg) & "

" & (content in msg)
end repeat
end tell

tell application "TextEdit"
set textfile to (make new document at beginning with properties {text:txt})
save textfile in filename
end tell[/PHP]

I'm working on an Applescript to output email to a text file, but I'm encountering a problem. Whenever this is run, instead of saving it to the Desktop, it saves it to the root directory as the file ":Users:usernameesktop:email.txt" instead of the file "email.txt" in my desktop. How do I fix this? Thanks!
  quote
drewprops
Space Pirate
 
Join Date: May 2004
Location: Atlanta
 
2005-12-08, 01:15

not being an Applescript guy I would experiment with writing out all of the variables to that text file just to find out all the values (like the variable 'filename' (shouldn't that file actually be called 'filepath'? Is that a reserved word?), then I would fiddle with the assignations of values to the variables to see what was printed on successive runs of the script... I would essentially be reverse engineering my own code to get my bearings. Ugly, eh?

Steve Jobs ate my cat's watermelon.
Captain Drew on Twitter
  quote
Posting Rules Navigation
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Post Reply

Forum Jump
Thread Tools
Similar Threads
Thread Thread Starter Forum Replies Last Post
iMac G5 shutdown during sleep problem w/open firmware kellte2 Genius Bar 7 2005-11-01 21:21
airport express problem problem problem moo Genius Bar 8 2005-10-08 19:12
Transmission Problem? ast3r3x AppleOutsider 18 2005-04-28 11:36
Question about IBook problem and Applecare mdeloria Genius Bar 6 2005-03-23 17:27
Serious problem, Help or advice needed. stevegong Genius Bar 20 2004-07-27 21:04


« Previous Thread | Next Thread »

All times are GMT -5. The time now is 02:25.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004 - 2024, AppleNova