[AppleScript] Mailen random foto

Pagina: 1
Acties:

  • NEn
  • Registratie: April 2003
  • Laatst online: 02-02 12:50

NEn

Zekersteweten

Topicstarter
Het probleem is als volgt, ik wil een scriptje bouwen om iedere keer als het aangeroepen wordt een willekeurige foto uit een vooraf bepaalde map te mailen naar een e-mail adres. Wat het nut hier van is gaat een beetje ver om hier uit te leggen, maar een alternatief is voor mijn geval niet bruikbaar.

Het volgende script heb ik tot nu toe bij elkaar gezocht:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
tell application "Finder"
    set random_file to some file of folder "fotos"
end tell
tell application "Mail"
    set theNewMessage to make new outgoing message with properties {subject:"Onderwerp", content:"Tekst", visible:true}
    tell theNewMessage
        make new to recipient at end of to recipients with properties {address:"naam@domein.nl"}
        tell content of theNewMessage
            make new attachment with properties {file name:random_file} at after last paragraph
        end tell
        send
    end tell
end tell


Het probleem dat ik heb is dat het script de volgende foutmelding geeft:
code:
1
2
Result:
error "Can’t make «class docf» \"CrazyMonkey.jpg\" of «class cfol» \"fotos\" of «class cfol» \"Desktop\" of «class cdis» \"bernard\" of application \"Finder\" into the expected type." number -1700 from «class docf» "CrazyMonkey.jpg" of «class cfol» "fotos" of «class cfol» "Desktop" of «class cdis» "bernard"


Ik heb het idee dat het type dat random_file krijgt van de finder app niet overeenkomt met het type bij het attachment. Heeft iemand enig idee hoe ik dit kan oplossen? Internet afspeuren naar die foutcode levert niet echt zinnige zaken op..

BVD!

-- Maar dat is natuurlijk puur persoonlijk --