Link to home
Start Free TrialLog in
Avatar of PeterRHawkes
PeterRHawkesFlag for United Kingdom of Great Britain and Northern Ireland

asked on

'Type Integer Error' when moving mail to IMAP folder

I am using a MobileMe account (IMAP) and have folders on the account called Inbox Items and Sent Items to which I wish to move email from my Inbox and Sent. Using the code below I get an error from the line;

move eachMessage to mailbox "Inbox Items"

that reads;

error "Cant make \"Inbox Items\" into type integer." number -1700 from "Inbox Items" to integer

Why?!?!

Peter R Hawkes
tell application "System Events"
	activate
	set myAnswer1 to the button returned of (display dialog "Pick a Location" buttons {"Inbox Items", "Sent Items", "Cancel"} default button 1)
end tell

set imap_account to "MobileMe"

if myAnswer1 is "Inbox Items" then tell application "Mail"
	set s to selection
	tell imap_account
		repeat with eachMessage in s
			move eachMessage to mailbox "Inbox Items"
		end repeat
	end tell
end tell
if myAnswer1 is "Sent Items" then tell application "Mail"
	set s to selection
	repeat with eachMessage in s
		move eachMessage to mailbox "Sent Items"
	end repeat
end tell
if myAnswer1 is "Cancel" then tell application "Mail"
end tell
tell application "Mail"
	activate
end tell

Open in new window

Avatar of caity
caity

would this accomplish the same thing?
display dialog "Pick a Location" buttons {"Inbox Items", "Sent Items", "Cancel"} default button 1
set the button_pressed to the button returned of the result
set imap_account to "MobileMe"

if the button_pressed is "Inbox Items" or the button_pressed is "Sent Items" then
	tell application "Mail"
		set s to selection
		tell imap_account
			repeat with eachMessage in s
				move eachMessage to mailbox button_pressed
			end repeat
		end tell
	end tell
end if

Open in new window

Avatar of PeterRHawkes

ASKER

Thank you for your suggestion but the line

move eachMessage to mailbox button_pressed

gets the same error message

Cant make "Inbox Items" into type integer.

Any thoughts?

Peter R Hawkes
I don't use mail but maybe try instead of

move eachMessage to mailbox button_pressed

use

set mailbox of eachMessage to mailbox button_pressed

?

Same error I am afraid!

Cant make "Inbox Items" into type integer.

Out of interest (I am new to the Mac and still missing Outlook!) what do you use for your email?

PRH
ASKER CERTIFIED SOLUTION
Avatar of caity
caity

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you for the link! It worked as below;
tell application "Mail"
	set theSelectedMessages to selection
	repeat with theMessage in theSelectedMessages
		set theMailbox to "Inbox Items"
		tell application "Mail"
			move the theMessage to mailbox theMailbox of account "MobileMe"
		end tell
	end repeat
end tell

Open in new window

You're welcome!
Caity stuck with it and even researched a solution!