Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Aug 17, 2006, 06:22 AM   #1
m2uk
macrumors regular
 
Join Date: Jan 2004
Location: Finland
Applescript assistance ?

Hi. I am a non programmer who is "fighting" around a couple of limitations/issues with Quickeys to automate a rather repetitive task that my wife has given me (and no, it is not THAT ! : )

There are a couple of steps I need to undertake that are not very reliable with the "click in a location" features of Quickeys, perhaps in part to my inexperience with the program (but I have checked checked and checked and the behaviour is not always the same) but it results in data loss and stress.

I am NOT very experienced with AppleScript and the googling I have done hasn't yielded much that works.

(Assume there is an Apple Mail folder with 50 messages)

The steps I need to undertake are:

1. From Apple Mail select the message at the top of the view (each message is different and must be handled separately) (effectively "taking that asset")

2. Open the URL given in the message body of the message selected in step 1 (I have tried the Geturl statement but Quickeys claims that I have not defined a variable (!) yet Apple Script Editor doesn't mention this.

3. I can do the bits in the middle with Quickeys...

4. After the actions made with Quickeys have been done, I need to delete the message defined in step 1 (and this is where the problem has been as it doesn't always grab the right message to delete, perhaps due to new messages appearing in the view. Each message will have in the subject line a predictable subject line and a unique reference number if that helps.

And then with Quickeys I can loop back to the start.

Would anyone be kind enough to give me some tips Of a polite nature at least that will help me fight this problem and maybe get more into AppleScript.

Thanks in advance from Finland !
m2uk is offline   0 Reply With Quote
Old Aug 20, 2006, 04:51 PM   #2
rob finch
macrumors member
 
Join Date: Mar 2006
Location: England
Hi,

Each message has it's own unique ID. When you take the first message in the window, save it's ID in a variable, then delete the message using the ID as the reference.

An example would be :-

Code:
tell application "Mail"
	set this_mailbox to mailbox "Test"
	set this_message to the first message of this_mailbox
	set message_ID to the id of this_message
	set all_messages to every message in this_mailbox
	repeat with each_message in all_messages
		set each_message_ID to the id of each_message
		if each_message_ID is equal to message_ID then delete each_message
	end repeat
end tell
It's a bit crude, but it will work. You could try adding the message IDs to a delimited list, then deleting all messages with an ID in the list.

Hope this helps,

Rob.
rob finch is offline   0 Reply With Quote
Old Aug 23, 2006, 11:43 PM   #3
m2uk
Thread Starter
macrumors regular
 
Join Date: Jan 2004
Location: Finland
Thanks and sorry for the delay. I will go and get an Applescript book and try and understand what you've kindly wrote as I tried dropping it in Quickeys and it didn't do anything (but I suspect that is down to me being a dimwit !)

But it gives a few more clues.

Best wishes. !
m2uk is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
AppleScript: How do I save multiple Excel sheets to one pdf using Applescript sbtaylor1 Mac Programming 0 Oct 28, 2013 11:38 PM
AppleScript: How do I save multiple Excel sheets to one pdf using Applescript sbtaylor1 Mac Applications and Mac App Store 0 Oct 28, 2013 11:32 PM
Hello I need everyone's assistance. Dominicanyor Community Discussion 0 Dec 20, 2012 12:44 PM
iPad: I am in serious need of assistance!!! girlsdontpoop Jailbreaks and iOS Hacks 3 Sep 19, 2012 08:05 AM

Forum Jump

All times are GMT -5. The time now is 05:11 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC