Newbie needs direction

Hi all!
Could any of your kind people give me some direction? This will be my first script and I’m lost aready. Here’s what I need to pull off. (Really easy)

Outlook receives an email to a certain account. (info from a web form)
I want to save the message as simpletext to a certain folder on my desktop
I want to then open it in excel as tab delim file and save as a dbf

I’ve been tring and I can’t seem to get it right.

any help would be great.

Hi,

here’s a small script and droplet for Excel 2004 that I’ve written today to open a comma delimited MS Windows text file and to save it as a standard MS Excel file.

Have a look at the 2 commented lines. They should use ‘tab’ to import and ‘DBF4’ to save the file.

Hope this helps for step 3 of your script.
Rudi


on run
	set the_file to choose file
	set the_file to the_file as text
	convert_to_excel(the_file)
end run


on open the_files
	repeat with i from 1 to number of items of the_files
		set this_item to item i of the_files
		log this_item
		set this_item to this_item as text
		my convert_to_excel(this_item)
	end repeat
end open


on convert_to_excel(the_file)
	set new_file to my set_new_name(the_file)
	with timeout of 300 seconds
		tell application "Microsoft Excel"
			-- open text file filename the_file origin MSWindows start row 1 data type delimited text qualifier text qualifier double quote with tab without consecutive delimiter
			open text file filename the_file origin MSWindows start row 1 data type delimited text qualifier text qualifier double quote with comma without consecutive delimiter
			-- save workbook as workbook 1 filename new_file file format DBF4 file format
			save workbook as workbook 1 filename new_file file format workbook normal file format
			close workbook 1 without saving
		end tell
	end timeout
end convert_to_excel


on set_new_name(the_file)
	set search_string to ".txt"
	set replacement_string to ".xls"
	if the the_file contains the search_string then
		-- replace target string using delimiters
		set AppleScript's text item delimiters to the search_string
		set the text_item_list to every text item of the the_file
		set AppleScript's text item delimiters to the replacement_string
		set the new_item_name to the text_item_list as string
		set AppleScript's text item delimiters to ""
		set new_file to new_item_name
	end if
	return new_file
end set_new_name