Quick Start - AppleScript examples

Examples and stuff

Moderator: Zach

Quick Start - AppleScript examples

Postby Zach » Mon Mar 10, 2008 9:09 pm

Some things you can do with BPE2 from AppleScript...
Zach
Developer
 
Posts: 513
Joined: Thu Apr 07, 2005 12:25 pm

CALLS

Postby Zach » Mon Mar 10, 2008 9:18 pm

CALLS

call properties (A few examples. See the AppleScript dictionary for all properties.)
Code: Select all
get every call whose state is not ended
get every call whose direction is incoming and duration is 0
get the device used of the last call
get the state of the last call whose device used is my device "Motorola E815"


update call notes
Code: Select all
set the notes of the last call to "Call back later"


create a call (when importing from external data)
Code: Select all
make new call with properties {direction:incoming, duration:20, caller value:"555-1212"}


dial a call (the one-line method)
Code: Select all
dial "123456" using device "K750i"


dial a call (the long way)
Code: Select all
set theCall to make new call with properties {receiver value:"123456",state:starting, direction:outgoing}
dial theCall using device "K750i"
Zach
Developer
 
Posts: 513
Joined: Thu Apr 07, 2005 12:25 pm

MESSAGES

Postby Zach » Mon Mar 10, 2008 9:21 pm

MESSAGES

message properties (A few examples. See the AppleScript dictionary for all properties.)
Code: Select all
get the messages of message folder "Inbox"
get the storage device of the message folder "Motorola E815"
get the display value of the sender of the first message of message folder "abc"
get the recipients of theMessage


create a message
Code: Select all
tell message folder "Inbox" to make new message at the end of the messages ?
    with properties { content:"imported message", state:read, sender value:"12345678" }


send a message (the one-line method)
Code: Select all
send message "My message text" to "Somebody <555-1212>" using the first device


send a message (the long way)
Code: Select all
set theMessage to make new message with properties { content:"announcement..." }
set the recipient value of theMessage to "somebody <555-1212>"
tell theMessage
   make new contact at end of recipients with properties {phone number:"123456"}
   send message using my device "Nokia E65"
end tell


send all draft messages
Code: Select all
repeat with theMessage in the messages of message folder "Drafts"
    send message theMessage using my device "Sony Ericsson T610"
end repeat
Last edited by Zach on Mon Mar 10, 2008 9:24 pm, edited 1 time in total.
Zach
Developer
 
Posts: 513
Joined: Thu Apr 07, 2005 12:25 pm

MESSAGE FOLDERS

Postby Zach » Mon Mar 10, 2008 9:22 pm

MESSAGE FOLDERS

get a folder
Code: Select all
get the message folder "Inbox"
get the message folder "Replies" of the message folder "Deliveries"
get the last message folder of the message folder "On My Computer"


create a folder
Code: Select all
make new message folder with properties {name:"My new folder"}
make new message folder at the end of the message folders ?
    of the message folder "On My Computer" ?
    with properties {name:"Another new folder"}


move a folder
Code: Select all
set the parent folder of message folder "a" to message folder "b"
move the message folder "Family" to the message folder "Archive"
move message folder "September" to the end of the message folders of message folder "Reports"


delete a folder
Code: Select all
set myFolder to message folder "My old folder"
tell the parent of myFolder to delete myFolder


empty trash
Code: Select all
delete the messages of message folder "Trash"
Zach
Developer
 
Posts: 513
Joined: Thu Apr 07, 2005 12:25 pm

Postby Zach » Mon Mar 10, 2008 9:23 pm

DEVICES

Code: Select all
get the name of the device used of the last call


Code: Select all
get the bluetooth address of the first device whose available is true


Code: Select all
tell device "Nokia E61"
    if available and not connected then set autoconnect to true
end tell


Code: Select all
tell device "Motorola E815"
    if connected and not charging and the battery level is less than 10 then disconnect
end tell



EXPORT

Code: Select all
export every call whose duration is greater than 0 using plugin "RTF File Exporter"
Zach
Developer
 
Posts: 513
Joined: Thu Apr 07, 2005 12:25 pm


Return to AppleScript Resources

Who is online

Users browsing this forum: No registered users and 0 guests