how to get 'path to me' in new Applescript Studio

G’day scripters

I’ve worked out a way to embed images in emails created with an Applescript Studio app, but need to reference a path to images loaded as resources.

Unfortunately ‘path to me’ no longer works, nor does ‘path to mainBundle’ or ‘path to main bundle’.

Can anyone point me in the right direction please

Regards

Santa

Hi,

try path to resource

G’day, & thanks Stefan, but that doesn’t work either.

Here’s what I ended up with…


set logo1 to ((current application's class "NSBundle")'s mainBundle())
		set LogoPath1 to (logo1's bundlePath()) as text
		set LogoPath to LogoPath1 & "/Contents/Resources/Logo.png" as text
		
		tell application "Mail"
			activate
			set newMessage to make new outgoing message with properties {address:the_mailto, subject:the_subject, attachment:LogoPath, content:the_content}
			tell newMessage
				set x to offset of TheBusinessName in the_content
				set xx to "This is a message from "
				set xxx to offset of xx in the_content
				set size of characters xxx thru (x + (count of TheBusinessName)) of content to 16
				set font of characters x thru (x + (count of TheBusinessName)) of content to "Helvetica Bold"
				set color of characters x thru (x + (count of TheBusinessName)) of content to {56342, 2442, 607}
				set x to offset of the DataYear in the_content
				set font of characters x thru (x + ((count of DataYear) as text)) of content to "Helvetica Bold"
				set color of characters x thru (x + ((count of DataYear) as text)) of content to {56342, 2442, 607}
				set x to 1
				set xx to count of the_content
				repeat
					if character x of the_content = "*" then
						set y to x + 1
						repeat
							if character y of the_content ≠ "*" then
								set color of characters x thru (y - 1) of content to {56342, 2442, 607}
								set x to y
								exit repeat
							else
								set y to y + 1
							end if
						end repeat
					end if
					set x to x + 1
					if x ≥ xx then exit repeat
				end repeat
				make new attachment with properties {file name:LogoPath} at before the first paragraph
				repeat with themailitem in MainRecipients
					if themailitem as text ≠ "" then make new to recipient at end of to recipients with properties ¬
						{address:themailitem}
				end repeat
				repeat with themailitem in CCRecipients
					if themailitem as text ≠ "" then make new cc recipient at end of cc recipients with properties ¬
						{address:themailitem}
				end repeat
				
				send
			end tell
		end tell
		my Writemessages("Daily sent.")
	end SendABloodyTally
	

As you’re talking obviously about AppleScriptObjC please post those questions into the AppleScriptObjC forum