[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 504
  • Last Modified:

'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

0
PeterRHawkes
Asked:
PeterRHawkes
  • 4
  • 4
1 Solution
 
caityCommented:
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

0
 
PeterRHawkesAuthor Commented:
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
0
 
caityCommented:
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

?

0
How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

 
PeterRHawkesAuthor Commented:
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
0
 
caityCommented:
I just use gmail.

Does this link have the answer?

http://www.macosxhints.com/article.php?story=20081019114709793

Maybe you need to set the mailbox for each message and then move it as well..,
0
 
PeterRHawkesAuthor Commented:
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

0
 
caityCommented:
You're welcome!
0
 
PeterRHawkesAuthor Commented:
Caity stuck with it and even researched a solution!
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now