An apple script that saves mail attachments no longer works in lion
In my mail rules, I have been using an apple script, which, if the sender belongs to a certain group, saves any attached files to a special folder I have for attachments from that group. After installing Lion, It performs other parts of my rule (plays a sound, for instance and moves the mesage to a special mailbox, for another), but it FAILS now to save the attachment using the script below. I hope someone knows of a workaround. If not, I hope apple will fix this soon. Here's the script--
using terms from application "Mail"
on perform mail action with messages theMessages for rule theRule
tell application "Mail"
repeat with oneMessage in theMessages
set {mail attachment:theAttachments} to oneMessage
repeat with oneAttachment in mail attachments of oneMessage
save oneAttachment in ("i828:Users:i8:Desktop:Poker Player:PPlayattach2") & (name of oneAttachment)
end repeat
end repeat
end tell
end perform mail action with messages
end using terms from
This worked brilliantly!
Thanks
David
Similar Messages
-
Advanced "Save as PDF" script that saves 2 PDF presets with 2 different Names
HI Everyone,
I am looking to improve a save as pdf workflow and was hoping to get some direction. Here is the background...
I routinely have to save numerous files as 2 separate PDFs with different settings (a high res printable version and a low res email version). Each file has to be renamed as follows...
Original filename = MikesPDF.ai
High Res PDF Filename = MikesPDF_HR.pdf
Low Res PDF Filename = MikesPDF_LR.pdf
I was able to alter the default "SaveAsPDF" script to save the files to my desired settings and to add the suffix to the name. So with these scripts here is how the workflow operates...
1. Open all files I wish to save as pdfs
2. Select script to save files as high res pdfs
3. Illustrator asks me to choose a destination.
4. Illustrator adds the appropriate suffix and saves each file as a pdf to my desired setting. ("Save As" not "Save a Copy").
5. Now all of the open windows are the new pdfs, not the original ai files.
6. Now I have to close each window. For some reason Illustrator asks me if I want to save each document when I tell it to close window, even though the file was just saved. I tell it to not save and everything seems to be fine.
7. Reopen all the files I just saved as high res pdfs.
8. Repeat the entire process except I run the script specifically designed for the low res pdfs.
What I would like to do is to combine these two processes so that there will be one script that saves both pdfs. From what I understand, the script can't support "Save A Copy" so the workflow would go as follows...
1. Open all files I wish to save as pdfs
2. Select single script to save files as both high res and low res pdfs
3. Illustrator asks me to choose a destination.
4. Illustrator saves each file as a High Res PDF and adds the the "_HR" suffix.
5. Illustrator then re-saves the open windows as a Low Res PDF and replaces the "_HR" suffix with "_LR".
Here is the code for the High Res script, The Low Res script is pretty much the same except for a different preset name and different suffix. Any pointer that anyone could give me would be most appreciated. I am pretty much a noob to this stuff so please keep that in mind.
Thanks!
Mike
---------------------------CODE----------------------------
/** Saves every document open in Illustrator
as a PDF file in a user specified folder.
// Main Code [Execution of script begins here]
try {
// uncomment to suppress Illustrator warning dialogs
// app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;
if (app.documents.length > 0 ) {
// Get the folder to save the files into
var destFolder = null;
destFolder = Folder.selectDialog( 'Select folder for PDF files.', '~' );
if (destFolder != null) {
var options, i, sourceDoc, targetFile;
// Get the PDF options to be used
options = this.getOptions();
// You can tune these by changing the code in the getOptions() function.
for ( i = 0; i < app.documents.length; i++ ) {
sourceDoc = app.documents[i]; // returns the document object
// Get the file to save the document as pdf into
targetFile = this.getTargetFile(sourceDoc.name, '.pdf', destFolder);
// Save as pdf
sourceDoc.saveAs( targetFile, options );
alert( 'Documents saved as PDF' );
else{
throw new Error('There are no document open!');
catch(e) {
alert( e.message, "Script Alert", true);
/** Returns the options to be used for the generated files. --------------------CHANGE PDF PRESET BELOW, var NamePreset = ----------------
@return PDFSaveOptions object
function getOptions()
{var NamePreset = 'Proof High Res PDF';
// Create the required options object
var options = new PDFSaveOptions();
options.pDFPreset="High Res PDF";
// See PDFSaveOptions in the JavaScript Reference for available options
// Set the options you want below:
// For example, uncomment to set the compatibility of the generated pdf to Acrobat 7 (PDF 1.6)
// options.compatibility = PDFCompatibility.ACROBAT7;
// For example, uncomment to view the pdfs in Acrobat after conversion
// options.viewAfterSaving = true;
return options;
/** Returns the file to save or export the document into.----------------CHANGE FILE SUFFIX ON LINE BELOW, var newName = ------------------
@param docName the name of the document
@param ext the extension the file extension to be applied
@param destFolder the output folder
@return File object
function getTargetFile(docName, ext, destFolder) {
var newName = "_HR";
// if name has no dot (and hence no extension),
// just append the extension
if (docName.indexOf('.') < 0) {
newName = docName + ext;
} else {
var dot = docName.lastIndexOf('.');
newName = docName.substring(0, dot)+newName;
newName += ext;
// Create the file object to save to
var myFile = new File( destFolder + '/' + newName );
// Preflight access rights
if (myFile.open("w")) {
myFile.close();
else {
throw new Error('Access is denied');
return myFile;Thank you for the reply Bob!
Am I correct in assuming that these few lines of code replace all of the lines that I posted above?
Also, When populating the PDFSaveOptions lines, would the end result look like this? FYI, LowRes preset name = "Proof Low Res PDF - CMYK". HighRes preset name = "Proof High Res PDF"
#target illustrator
#targetengine "main"
for (x=0;x<app.documents.length;x++)
var workingDoc = app.documents[x];
var workingDocFile = workingDoc.fullName;
// populate these with your settings
var lowResOpts = new PDFSaveOptions(Proof Low Res PDF - CMYK);
var highResOpts = new PDFSaveOptions(Proof High Res PDF);
var lowResFile = new File(workingDocFile.toString().replace(".ai","_LR.pdf"));
workingDoc.saveAs(lowResFile,lowResOpts);
var highResFile = new File(workingDocFile.toString().replace(".ai","_HR.pdf"));
workingDoc.saveAs(highResFile,highResOpts);
workingDoc.close(SaveOptions.DONOTSAVECHANGES); -
In using Mail and moving between my Yahoo emails i keep getting cut off telling me that my present password no longer works. But i have been getting my work done and suddelnly my password no loner is acceptalbe even upon re-entering it many times.This is more than annoying since i transfer files between various Yahoo accounts for my filing purposes. Help me stop this abuse. Please.
Ah yes school boy error there out of frustration and discontent..
My issue is with music/apps/films etc not downloading from iTunes / App Store.
They initially fail and message is displayed stating unable to download / purchase at this time, yet if I retry it says I've already purchased (?) or alternatively I go to the purchased section and there they are waiting with the cloud symbol..
However some items get frozen in the download window and cannot be retried or deleted. Message appears stating to tap to retry, but even if you stole every bath and sink in the uk you'd still not have enough taps.
I post here as the iTunes guys are useless in there 'help' and have only advised posting here or phoning apple, at my expense, to explain a problem that could be rectified by forwarding my original email to a techie. However the tech team apparently don't have an email address as they're from ye olde Middle Ages..!
Anyways I digress.
So I tried sync to pc, but instead of showing the file as ready to listen/use/view, the iCloud symbol shows and I'm back to square one as the item is unable to download..
At frustration station waiting for a train from pain...
All my software is up to date, and had all worked fine prior to the last big iOS update that resulted in all the changes in display and dismay.
Answers in a postcard :-)
Much love -
What does it mean that MobileMe Mail is no longer available in iCloud, when you switch? What happens to all one's previous mail? How is/ is all ones mail transfered?
You may be able to re download past purchases, read here > Downloading past purchases from the App Store, iBookstore, and iTunes Store
If you delete purchases, they are no longer stored in iCloud. -
Mail App no longer working after 2.0 upgrade
I upgraded to 2.0 on my IPhone Edge and now my mail application no longer works AT ALL. If I try to open it, it simply shows me a blank mail screen, waits for a few seconds and then returns to the home screen. Strangely enough, I have been able to send email photos using the camera application.
Email is the most important application for me on the iPhone! Has anyone encountered this problem? Is there a fix available?I recently stopped by the apple store and have fixed my mail app! The problem as described to me was caused by a installing apps. Turns out that apps can mess with Mail setting in some way and perhaps due to a bad setting or a bad combination of settings my mail application stopped working. The way I fixed it was to do a restore to New Iphone which, unfortunately, wipes everything! But after syncing back up including re-installing all of my apps, mail works again! Of course, I lost all of my notes, various settings, and lots of other stuff. Turns out that a simple restore, since it backs up your phone beforehand (backing up bad settings at the same time) is not the silver bullet but a full restore to new iphone probably often is. Hope this helps others.
-
Apple TV sleep mode remote shortcut no longer works with newest software update. Why? Is there an alternative other than nav to settings menu? Reset remote shortcut dead as well. :(
Hold Menu + Play/Pause to reboot the box from the main menu.
-
Script that enables mail users and kicks out two csv files
I am working on a script that will mainly be used as a scheduled task to enabled mailuser by calling the update-recipient command.
But before it calls that command it will get for various issues that can cause errors.
Missing PrimarySMTP
Display name having a space at front or back.
The external email address being blank.
I have IF statements setup to check for those and then call a function that will save into an array the issue for that user.
Here is the script
<#
.SYNOPSIS
Enable-MailUsers Synced Mail Users in the Exchange environment
THIS CODE IS MADE AVAILABLE AS IS, WITHOUT WARRANTY OF ANY KIND. THE ENTIRE
RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS CODE REMAINS WITH THE USER.
Version .9, 30 June 2014
.DESCRIPTION
This script mail-enables Synced Mail Users and creates a CSV report of mail users that were enabled.
The following is shown:
* Report Generation Time
.PARAMETER SendMail
Send Mail after completion. Set to $True to enable. If enabled, -MailFrom, -MailTo, -MailServer are mandatory
.PARAMETER MailFrom
Email address to send from. Passed directly to Send-MailMessage as -From
.PARAMETER MailTo
Email address to send to. Passed directly to Send-MailMessage as -To
.PARAMETER MailServer
SMTP Mail server to attempt to send through. Passed directly to Send-MailMessage as -SmtpServer
.PARAMETER ScheduleAs
Attempt to schedule the command just executed for 10PM nightly. Specify the username here, schtasks (under the hood) will ask for a password later.
.EXAMPLE
Generate the HTML report
.\Enable-MailUsers.ps1 -SendMail -MailFrom [email protected] -MailTo [email protected] -MailServer ex1.contoso.com -ScheduleAs SvcAccount
#>
param(
[parameter(Position=0,Mandatory=$false,ValueFromPipeline=$false,HelpMessage='Send Mail ($True/$False)')][bool]$SendMail=$false,
[parameter(Position=1,Mandatory=$false,ValueFromPipeline=$false,HelpMessage='Mail From')][string]$MailFrom,
[parameter(Position=2,Mandatory=$false,ValueFromPipeline=$false,HelpMessage='Mail To')]$MailTo,
[parameter(Position=3,Mandatory=$false,ValueFromPipeline=$false,HelpMessage='Mail Server')][string]$MailServer,
[parameter(Position=4,Mandatory=$false,ValueFromPipeline=$false,HelpMessage='Schedule as user')][string]$ScheduleAs
# Sub Function to neatly update progress
function _UpProg1
param($PercentComplete,$Status,$Stage)
$TotalStages=5
Write-Progress -id 1 -activity "Mail enabled Objects" -status $Status -percentComplete (($PercentComplete/$TotalStages)+(1/$TotalStages*$Stage*100))
#Sub Function create ErrObject output
function _ErrObject{
Param($name,
$errStatus
If(!$err){
Write-Host "error detected"
$script:err = $True
$ErrObject = New-Object -TypeName PSObject
$Errobject | Add-Member -Name 'Name' -MemberType Noteproperty -Value $Name
$Errobject | Add-Member -Name 'Comment' -MemberType Noteproperty -Value $errStatus
$script:ErrOutput += $ErrObject
# 1. Initial Startup
# 1.0 Check Powershell Version
if ((Get-Host).Version.Major -eq 1)
throw "Powershell Version 1 not supported";
# 1.1 Check Exchange Management Shell, attempt to load
if (!(Get-Command Get-ExchangeServer -ErrorAction SilentlyContinue))
if (Test-Path "D:\Exchsrvr\bin\RemoteExchange.ps1")
. 'D:\Exchsrvr\bin\RemoteExchange.ps1'
Connect-ExchangeServer -auto
} elseif (Test-Path "D:\Exchsrvr\bin\Exchange.ps1") {
Add-PSSnapIn Microsoft.Exchange.Management.PowerShell.Admin
.'D:\Exchsrvr\bin\Exchange.ps1'
} else {
throw "Exchange Management Shell cannot be loaded"
# 1.2 Check if -SendMail parameter set and if so check -MailFrom, -MailTo and -MailServer are set
if ($SendMail)
if (!$MailFrom -or !$MailTo -or !$MailServer)
throw "If -SendMail specified, you must also specify -MailFrom, -MailTo and -MailServer"
# 1.3 Check Exchange Management Shell Version
if ((Get-PSSnapin -Name Microsoft.Exchange.Management.PowerShell.Admin -ErrorAction SilentlyContinue))
$E2010 = $false;
if (Get-ExchangeServer | Where {$_.AdminDisplayVersion.Major -gt 14})
Write-Warning "Exchange 2010 or higher detected. You'll get better results if you run this script from an Exchange 2010/2013 management shell"
}else{
$E2010 = $true
$localserver = get-exchangeserver $Env:computername
$localversion = $localserver.admindisplayversion.major
if ($localversion -eq 15) { $E2013 = $true }
#Get date
$filedate = get-date -uformat "%m-%d-%Y"
$filedate = $filedate.ToString().Replace("0", "")
#Get the valid users that are not mail-enabled
_UpProg1 1 "Getting User List" 1
#$Users = Get-mailuser -ResultSize unlimited -OrganizationalUnit "R0018.COLLABORATION.ECS.HP.COM/Accounts/AbbVienet/Users" | ?{$_.legacyexchangeDN -eq ""}
$i = 0
$output = @()
$errOutput = @()
$err = $False
#2 Process users
ForEach ($User in $Users){
$i++
_UpProg1 ($i/$Users.Count*100) "Updating Recipients" 2
If ($user.ExternalEmailAddress -eq $null){
_ErrObject $user.Name, "Missing External Email Address"
ElseIf($user.DisplayName -NotLike "* "){
_ErrObject $user.Name, "DisplayName contains a trailing space"
ElseIf($user.DisplayName -NotLike "_*"){
_ErrObject $user.Name, "DisplayName contains a Leading space"
ElseIf($user.PrimarySmtpAddress -eq $null){
_ErrObject $user.Name, "Missing Primary SMTP address"
Else{
#Disable EmailAddressPolicy on these users
Set-Mailuser $User.Name -EmailAddressPolicyEnabled $false
#pass to Update-recipient
Update-Recipient $User.Name
$LEDN = Get-MailUser $User.Name | Select {$_.LegacyExchangeDN}
If ($LEDN -ne ""){
$object = New-Object -TypeName PSObject
$X500 = "x500:" + $LEDN.'$_.LegacyExchangeDN'
$object | Add-Member -Name 'Name' -MemberType Noteproperty -Value $User.Name
$object | Add-Member -Name 'x500' -MemberType Noteproperty -Value $X500
$output += $object
#Creating CSVFile Output
_UpProg1 99 "Outputting CSV file 3" 3
$CSVFile = "c:\scripts\Mail-enable\Mailenabled_$((Get-Date).ToString('MM-dd-yyyy_hh-mm-ss')).csv"
If($err){
$ErrCSVFile = "c:\scripts\Mail-enable\ProblemUsers_$((Get-Date).ToString('MM-dd-yyyy_hh-mm-ss')).csv"
$errOutput | Select-Object Name, Comment | ConvertTo-CSV -NoTypeInformation > $ErrCSVFIle
$Output | ConvertTo-Csv -NoTypeInformation > $CSVFile
if ($SendMail)
_UpProg1 95 "Sending mail message.." 4
If($err){
Send-MailMessage -Attachments $CSVFile,$ErrCSVFile -To $MailTo -From $MailFrom -Subject "Enable Mail Users Script" -BodyAsHtml $Output -SmtpServer $MailServer
Else{
Send-MailMessage -Attachments $CSVFile -To $MailTo -From $MailFrom -Subject "Enable Mail Users Script" -BodyAsHtml $Output -SmtpServer $MailServer
if ($ScheduleAs)
_UpProg1 99 "Attempting to Schedule Task.." 4
$dir=(split-path -parent $myinvocation.mycommand.definition)
$params=""
if ($SendMail)
$params+=' -SendMail:$true'
$params+=" -MailFrom:$MailFrom -MailTo:$MailTo -MailServer:$MailServer"
$task = "powershell -c \""pushd $dir; $($myinvocation.mycommand.definition) $params\"""
Write-Output "Attempting to schedule task as $($ScheduleAs)..."
Write-Output "Task to schedule: $($task)"
schtasks /Create /RU $ScheduleAs /RP /SC DAILY /ST 22:00 /TN "Enable Mail Users" /TR $task
The Problem is that when I look at the $errOutput I see things but when I pipe the $erroutput to convertTo-CSV I get this within the CSV file. I think its because I an calling a function to do the updating. But not sure.
Jeff CHi Jeff,
Any updates? If you have any other questions, please feel free to let me know.
A little clarification to the script:
function _ErrObject{
Param($name,
$errStatus
If(!$err){
Write-Host "error detected"
$script:err = $True
$ErrObject = New-Object -TypeName PSObject
$Errobject | Add-Member -Name 'Name' -MemberType Noteproperty -Value $Name
$Errobject | Add-Member -Name 'Comment' -MemberType Noteproperty -Value $errStatus
$script:ErrOutput += $ErrObject
$errOutput = @()
_ErrObject Name, "Missing External Email Address"
$errOutput
_ErrObject Name "Missing External Email Address"
$errOutput
If you have any feedback on our support, please click here.
Best Regards,
Anna Wang
TechNet Community Support -
Apple Script Solution to Mail problem
I'm very new to Mail, but was wondering if anyone with some script experience could tell me if an Apple Script could help with this problem: http://discussions.apple.com/thread.jspa?threadID=742249&tstart=0
I appreciate any help in advance!Answered elsewhere
-
Mail attachments don't work iphone
I have three users who updated their phones to 7.0.4. After doing so, half of the email attachments don't show up in emails. Instead, they get a "this message has no content." It happens with different email senders and different attachment file types (pdf and xls). One user specifically noted that it happened after updating to 7.0.4. Two of those users are on iPhone 4S's and another is on a variation of 5.
Any ideas as to what is causing this or how to fix it?
side note: mail attachments on those same problem emails work on the user's Outlook clients as well as Android phones (when tested).Use Plain Text instead of RTF for message composition and place any attachments below all message text including a signature if one is used.
The Send Windows Friendly Attachments option is designed for only one thing and that is removing the Apple resource fork from an attached file which is invisible from fellow Mac users. -
Can anybody fix this apple script for me so all the responses work
iv been working on a jarvis wake up script and iv continued to add on commands to if theResponce parts of the script but now most of them wont work and i get a syntax if i dont have like 8 end if's at the end of the script could somebody please overview it, fix the script and resubmit it to me in the comments. will be so grateful if somebody fixes this pleasee.!!!!
set theHours to hours of the (current date)
if theHours > 18 then
say "good evening sir"
else if theHours > 12 then
say "good afternoon sir"
else if theHours > 6 then
say "good Morning sir"
else if theHours > 0 then
say "get out of bed sir!"
end if
say "It is " & getTimeInHoursAndMinutes() using "Tom"
on getTimeInHoursAndMinutes()
set timeStr to time string of (current date)
set Pos to offset of ":" in timeStr
set theHour to characters 1 thru (Pos - 1) of timeStr as string
set timeStr to characters (Pos + 1) through end of timeStr as string
-- Get the "minute"
set Pos to offset of ":" in timeStr
set theMin to characters 1 thru (Pos - 1) of timeStr as string
set timeStr to characters (Pos + 1) through end of timeStr as string
--Get "AM or PM"
set Pos to offset of " " in timeStr
set theSfx to characters (Pos + 1) through end of timeStr as string
return (theHour & ":" & theMin & " " & theSfx) as string
end getTimeInHoursAndMinutes
set CityCode to 1098081
set t_format to "C"
set v_format to "S"
set a_format to "Y"
set IURL to "http://weather.yahooapis.com/forecastrss?w=" & CityCode
set file_content to (do shell script "curl " & IURL)
--looking for the line with actual condition
set theText to text ((offset of "yweather:condition" in file_content) + 1) thru -1 of file_content
set sub_1 to text ((offset of "\"" in theText) + 1) thru -1 of theText
set actual_condition to text 1 thru ((offset of "\"" in sub_1) - 1) of sub_1
set sub_1a to text ((offset of "temp=" in sub_1)) thru -1 of sub_1
set sub_1b to text ((offset of "\"" in sub_1a) + 1) thru -1 of sub_1a
set actual_temp to text 1 thru ((offset of "\"" in sub_1b) - 1) of sub_1b
if t_format is equal to "C" then
set actual_temp to (5 / 9) * (actual_temp - 32) as integer
end if
set theText to text ((offset of "yweather:forecast" in file_content) + 1) thru -1 of file_content
set sub_2 to text ((offset of "\"" in theText) + 1) thru -1 of theText
set today_min_temp to word 9 of sub_2
set today_max_temp to word 12 of sub_2
if t_format is equal to "C" then
set today_min_temp to (5 / 9) * (today_min_temp - 32) as integer
set today_max_temp to (5 / 9) * (today_max_temp - 32) as integer
end if
set sub_3 to text ((offset of "text" in sub_2) + 1) thru -1 of sub_2
set sub_4 to text ((offset of "\"" in sub_3) + 1) thru -1 of sub_3
set today_forecast to text 1 thru ((offset of "\"" in sub_4) - 1) of sub_4
set sub_5 to text ((offset of "yweather:forecast" in sub_4) + 1) thru -1 of sub_4
set sub_6 to text ((offset of "\"" in sub_5) + 1) thru -1 of sub_5
set tomorrow_min_temp to word 9 of sub_6
set tomorrow_max_temp to word 12 of sub_6
if t_format is equal to "C" then
set tomorrow_min_temp to (5 / 9) * (tomorrow_min_temp - 32) as integer
set tomorrow_max_temp to (5 / 9) * (tomorrow_max_temp - 32) as integer
end if
set sub_7 to text ((offset of "text" in sub_6) + 1) thru -1 of sub_6
set sub_8 to text ((offset of "\"" in sub_7) + 1) thru -1 of sub_7
set tomorrow_forecast to text 1 thru ((offset of "\"" in sub_8) - 1) of sub_8
if a_format is equal to "Y" then
say "The current conditions in Perth are " & actual_condition & " ,and the current temperture is " & actual_temp & " degrees"
end if
if v_format is equal to "L" then
say "Today it will be : " & today_forecast & ". Temperature: between " & today_min_temp & " and " & today_max_temp & " degrees .
Tomorrow we are expecting it to be: " & tomorrow_forecast & ". Temperature: between " & today_min_temp & " and " & today_max_temp & " degrees " using "Tom"
else
say "Today it will be : " & today_forecast & ", between " & today_min_temp & " , and " & today_max_temp & " degrees .
Tomorrow we are expecting it to be: " & tomorrow_forecast & ", between " & tomorrow_min_temp & " ,and " & tomorrow_max_temp & " degrees " using "Tom"
say "will that be all sir?"
tell application "SpeechRecognitionServer" to set theResponse to listen for {"get my mail ", "yes", "notes", "repeat", "Music", "Sleep in"}
if theResponse is "Sleep in" then
delay 6
say "Time to get up sir,or you will be late"
tell application "SpeechRecognitionServer" to set theResponse2 to listen for {"Ok pat im getting up"}
if theResponse2 is "Ok pat im getting up" then
set volume 35
tell application "iTunes"
set the sound volume to 0
play user playlist "Wake up"
repeat 10 times
if sound volume is less than 40 then
set sound volume to (sound volume + 10)
delay 2
end if
end repeat
end tell
if theResponse is "Music" then
set volume 20
tell application "iTunes"
set the sound volume to 0
play user playlist "Wake up"
repeat 10 times
if sound volume is less than 60 then
set sound volume to (sound volume + 10)
delay 2
end if
end repeat
end tell
if theResponse is "yes" then
delay 1
set theOptions to {"very good, sir, have a nice day"}
set theChoice to some item of theOptions
say theChoice displaying theChoice with waiting until completion
end if
if theResponse is "get my mail " then
tell application "Mail" to launch
end if
if theResponse is "notes" then
tell application "Stickies" to launch
end if
if theResponse is "repeat" then
set CityCode to 1098081
set t_format to "C"
set v_format to "S"
set a_format to "Y"
set IURL to "http://weather.yahooapis.com/forecastrss?w=" & CityCode
set file_content to (do shell script "curl " & IURL)
--looking for the line with actual condition
set theText to text ((offset of "yweather:condition" in file_content) + 1) thru -1 of file_content
set sub_1 to text ((offset of "\"" in theText) + 1) thru -1 of theText
set actual_condition to text 1 thru ((offset of "\"" in sub_1) - 1) of sub_1
set sub_1a to text ((offset of "temp=" in sub_1)) thru -1 of sub_1
set sub_1b to text ((offset of "\"" in sub_1a) + 1) thru -1 of sub_1a
set actual_temp to text 1 thru ((offset of "\"" in sub_1b) - 1) of sub_1b
if t_format is equal to "C" then
set actual_temp to (5 / 9) * (actual_temp - 32) as integer
end if
set theText to text ((offset of "yweather:forecast" in file_content) + 1) thru -1 of file_content
set sub_2 to text ((offset of "\"" in theText) + 1) thru -1 of theText
set today_min_temp to word 9 of sub_2
set today_max_temp to word 12 of sub_2
if t_format is equal to "C" then
set today_min_temp to (5 / 9) * (today_min_temp - 32) as integer
set today_max_temp to (5 / 9) * (today_max_temp - 32) as integer
end if
set sub_3 to text ((offset of "text" in sub_2) + 1) thru -1 of sub_2
set sub_4 to text ((offset of "\"" in sub_3) + 1) thru -1 of sub_3
set today_forecast to text 1 thru ((offset of "\"" in sub_4) - 1) of sub_4
set sub_5 to text ((offset of "yweather:forecast" in sub_4) + 1) thru -1 of sub_4
set sub_6 to text ((offset of "\"" in sub_5) + 1) thru -1 of sub_5
set tomorrow_min_temp to word 9 of sub_6
set tomorrow_max_temp to word 12 of sub_6
if t_format is equal to "C" then
set tomorrow_min_temp to (5 / 9) * (tomorrow_min_temp - 32) as integer
set tomorrow_max_temp to (5 / 9) * (tomorrow_max_temp - 32) as integer
end if
set sub_7 to text ((offset of "text" in sub_6) + 1) thru -1 of sub_6
set sub_8 to text ((offset of "\"" in sub_7) + 1) thru -1 of sub_7
set tomorrow_forecast to text 1 thru ((offset of "\"" in sub_8) - 1) of sub_8
if a_format is equal to "Y" then
say "The current conditions in Perth are " & actual_condition & " ,and the current temperture is " & actual_temp & " degrees"
end if
if v_format is equal to "L" then
say "Today it will be : " & today_forecast & ". Temperature: between " & today_min_temp & " and " & today_max_temp & " degrees .
Tomorrow we are expecting it to be: " & tomorrow_forecast & ". Temperature: between " & today_min_temp & " and " & today_max_temp & " degrees " using "Tom"
else
say "will that be all sir?"
tell application "SpeechRecognitionServer" to set theResponse3 to listen for {"get my mail ", "yes", "notes", "Music"}
if theResponse3 is "Music" then
set volume 20
tell application "iTunes"
set the sound volume to 0
play user playlist "Wake up"
repeat 10 times
if sound volume is less than 60 then
set sound volume to (sound volume + 10)
delay 2
end if
end repeat
end tell
else
if theResponse3 is "get my mail " then
tell application "Mail" to launch
end if
if theResponse3 is "yes" then
delay 1
set theOptions to {"very good, sir, have a nice day"}
set theChoice to some item of theOptionsWhat you do in this situation, is split the file into parts.
Start with:
set theHours to hours of the (current date)
if theHours > 18 then
say "good evening sir"
else if theHours > 12 then
say "good afternoon sir"
else if theHours > 6 then
say "good Morning sir"
else if theHours > 0 then
say "get out of bed sir!"
end if
Add in a few lines of code to this file and see what happens.
add the on run, this would be clearer. It is the default on unit to run.
on run
set theHours to hours of the (current date)
if theHours > 18 then
say "good evening sir"
else if theHours > 12 then
say "good afternoon sir"
else if theHours > 6 then
say "good Morning sir"
else if theHours > 0 then
say "get out of bed sir!"
end if
end run
Now, it is time for debugging.
It is easier to diagnose problems with debug information. I suggest adding log statements to your script to see what is going on. Here is an example.
Author: rccharles
For testing, run in the Script Editor.
1) Click on the Event Log tab to see the output from the log statement
2) Click on Run
on run
-- Write a message into the event log.
log " --- Starting on " & ((current date) as string) & " --- "
-- debug lines
set desktopPath to (path to desktop) as string
log "desktopPath = " & desktopPath
end run -
Made big mistake of downloading Mavericks today.
Been struggling with all the FUBARd messes it caused, ALL DAY.
Google basic buttons don't work--can't log out or other basic functions.
Website use is impaired.
It took almost 3 hours to do a basic online order on one of them--at this rate, I'll be out of business soon, and it's seriously impairing Christmas preparations!
Google Voice/Video are screwed up, had to RE-download their voice/video plugin all over again--again.
Voice/video quality is REALLY poor.
Lag times in so many things are bad.
Thought this would download WITH the better writing/bookkeeping programs--NOT!
Mac Maps is piddle compaired with GoogleMaps.
The Email program on the desktop is REALLY hard to use, has few useful functions. It's MAYbe good if one only has ONE email; using it with severeal various email accounts is a serious liability in many ways--like filing, sorting, marking, etc.; no clear way to move email files to an external drive to save, to unload the HD.
HOW can Safari and Mavericks be fixed?
IF not, HOW can I REMOVE Mavericks and get back to Mountain Lion--which was not too great, but certainly more functional than Mavericks!
I NEED my web-based emails to work--NOW...NOT when Mac finally gets around to fixing things sometime later.
I NEED online ordering to work--NOW--not later when Mac finally gets around to fixing things.
PLEASE someone--any help out there? I couldn't even find but a rare hint that Safari 7.0 even exists--much less that anyone admits it's got problems, nor fixes for it.
What to do? Throw the whole unit out? Wipe and reboot? Dumb it back to OS 10? HOW? WHAT?
[freaking out here...]Zak Adelman, LexSchellings,
It's a shiney new computer. Came loaded with Mountain Lion.
Too busy learning to use the blessed thing, to download anything....except...
The only pluggin that had to be loaded, was Google Voice-Video pluggin, while Lion was still it's OS. [AND been using the Safari that came already in it.] Had to do that a couple times--nothing new there--that plug-in had to be re-loaded when using a PC, too--THAT happened even before Google slammed everyone into coerced use of it's Google+.
[I understood from others, that Firefox won't work in Mac units--or I woulda put that in it to see if that solved anything]
This unit seemed a bit sluggish from the git-go, out-of-the-box.
I figured that was probly the local DSL here---rural DSL is...um...our DSL's not something to brag about, but it's the best we can do...
The difference between speed of loading pages, etc. on the new Mac, was --not-- toooo terribly different--though yes, slower on Mac....and chalked it up to my inexperience with Mac.
Been trying to get things up and running for a bit over a month now.
NOT doing very well at it--just barely getting by; rapidly falling behind what needs done [work].
Google worked just --OK-- when OS was Lion, as did the Google voice/video--slower, and voice-video was kinda scratchy or glitchy, but worked enough to --get by--.
Loading Mavericks, ruined that.
VOIP calls via Google talk have bad echio, static, cut-outs; video calling was pixilated or not working; WAS cued to re-load it's Voice-Video plug-in....which seemed to help a bit, though not very well; it only helped the Voice-Video some, not all--figured that was probably Google issues, less than Mac's, since Google has been increasingly dysfunctional as they have twisted it to be a social media-dominant thing.
[[now seeking an email venue that does what Gmail was good at, including the Voice-video calling, that has no intention of turning itself inside out to be "social"]]
Can't sign out of Gmail or Google+, nor use buttons in upper right corner with the drop-down menu.
NO buttons in upper right corner cluster on Gmail work, except the name+ button to toggle over to Google+---which I don't need! [yeah--THAT's a Google problem!]
Can only switch to HTML version by catching that button as the account signs in--if one fails to be fast enough with their fingers, it goes to Google+; can't get to email unless type in mail.google.com.
Managed to catch that button today, and clicked to use HTML "permanently" until these issues get solved.
ALSO:
Have fairly new [about 1 year?] HP bluetooth printer-scanner.
BUT, after Mavericks loaded: it HAS the unit listed, HAS drivers for it, HP unit IS listed as default printer, everything --seems-- "go",
.....except Mac keeps posting it's out of ink, and/or, not hooked up, and/or not turned on--even when it is on.
It's SUPPOSED to be blue-toothing that printer/scanner.
It did it for Lion, before loading Mavericks, even though it was troublesome to get it to work, it at least HAD printed one document when Lion was the OS.
Thank you...Downloaded EtreCheck:
BTW: Trying to copy/paste data from that check list, to this post, was achaic:
had to use Edit, select all, then use edit again to get it pasted--the mouse buttons weren't allowed to copy-paste using right-click functions [is this a relic limited-function "thing" with Mac?, or is it because I wanted to keep using this new wirless, non-Mac mouse?].
Advice?
See below...
Hardware Information: Mac mini (Late 2012) Mac mini - model: Macmini6,1
1 2.5 GHz Intel Core i5 CPU: 2 cores; 8 GB RAM
Additional:
Monitor used = Visio flat screen. [not Mac]
Keyboard = Logitech solar wireless [not Mac]
Mouse = Logitech wireless
Video Information: Intel HD Graphics 4000 - VRAM: 1024 MB
Audio Plug-ins:
BluetoothAudioPlugIn: Version: 1.0 - SDK 10.9
AirPlay: Version: 1.9 - SDK 10.9
AppleAVBAudio: Version: 2.0.0 - SDK 10.9
iSightAudio: Version: 7.7.3 - SDK 10.9
System Software:
OS X 10.9 (13A603) - Uptime: 2 days 19:33:25
Disk Information:
APPLE HDD ST500LM012 disk0 : (500.11 GB)
EFI (disk0s1) <not mounted>: 209.7 MB
Macintosh HD (disk0s2) /: 499.25 GB (456.94 GB free)
Recovery HD (disk0s3) <not mounted>: 650 MB
USB Information:
MediaTek Inc MT1806
Logitech Logitech USB Headset
Logitech USB Receiver
Apple Inc. BRCM20702 Hub
Apple Inc. Bluetooth USB Host Controller
Apple, Inc. IR Receiver
FireWire Information:
Thunderbolt Information:
Apple Inc. thunderbolt_bus
Kernel Extensions:
Problem System Launch Daemons:
Problem System Launch Agents:
Launch Daemons:
[loaded] com.adobe.fpsaud.plist
[loaded] com.google.keystone.daemon.plist
Launch Agents:
[loaded] com.google.keystone.agent.plist
[loaded] com.hp.devicemonitor.plist
[loaded] com.hp.messagecenter.launcher.plist
User Launch Agents:
User Login Items:
iTunesHelper
SpeechSynthesisServer
3rd Party Preference Panes:
Flash Player
Internet Plug-ins::
FlashPlayer-10.6: Version: 11.9.900.170 - SDK 10.6
QuickTime Plugin: Version: 7.7.3
Flash Player: Version: 11.9.900.170 - SDK 10.6
Default Browser: Version: 537 - SDK 10.9
o1dbrowserplugin: Version: 4.9.1.16010
====== npgtpo3dautoplugin: Version: 0.1.44.29 - SDK 10.5 ===[this was in red]=====
googletalkbrowserplugin: Version: 4.9.1.16010
Bad Fonts:
None
Old applications:
HP Device Monitor: Version: 2.7.0 - SDK 10.5
/Library/Printers/hp/hpio/HP Device Monitor.app
Time Machine:
=== Time Machine not configured! ===[this was in red]===
Top Processes by CPU:
6% WindowServer
4% Safari
4% SafariDAVClient
2% EtreCheck
0% com.apple.iCloudHelper
Top Processes by Memory:
303 MB Mail
270 MB Safari ======[this is version 7.0 ]======
262 MB mds_stores
147 MB softwareupdated
147 MB com.apple.IconServicesAgent
Virtual Memory Statistics:
1.77 GB Free RAM
2.85 GB Active RAM
2.36 GB Inactive RAM
1017 MB Wired RAM
4.64 GB Page-ins
111 MB Page-outs -
I've done a force quit on the app and have rebooted the ipad. I've followed Apple's suggestions for checking the settings. Still neither of my mail accounts can send or receive.
Mail stopped working while we are relying on a hotel's wifi. Safari works fine and Mail on my wife's ipad works.
I'm stumped. Any ideas?iOS: Unable to send or receive email
http://support.apple.com/kb/TS3899
Can’t Send Emails on iPad – Troubleshooting Steps
http://ipadhelp.com/ipad-help/ipad-cant-send-emails-troubleshooting-steps/
Setting up and troubleshooting Mail
http://www.apple.com/support/ipad/assistant/mail/
Server does not allow relaying email error, fix
http://appletoolbox.com/2012/01/server-does-not-allow-relaying-email-error-fix/
Why Does My iPad Say "Cannot Connect to Server"?
http://www.ehow.co.uk/info_8693415_ipad-say-cannot-connect-server.html
iPad Mail
http://www.apple.com/support/ipad/mail/
Try this first - Reset the iPad by holding down on the Sleep and Home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons. (This is equivalent to rebooting your computer.)
Or this - Delete the account in Mail and then set it up again. Settings->Mail, Contacts, Calendars -> Accounts Tap on the Account, then on the red button that says Remove Account.
Cheers, Tom -
Mail rules no longer work.
Having trouble with Mail rules that I have used in the past - they no longer work. Any ideas? Running 10.4.10
Yes, the same thing has happened to me.
But I'd like to avoid having to set up the the rules again (if I trashing the com.apple.mail.plist. I have a lot of rules, and it would take some time to set them up again. Does anyone know of other options? -
Mail Accounts Shortcut no longer working in Lion
In Snow Leopard I heavily relied on some custom shortcuts for switching between my different email accounts when sending mail as outlined in this site: http://hints.macworld.com/article.php?story=20081120093222315 . Then I upgraded to Lion and much to my chagrin, these shortcuts are no longer working. I have tried everything to get them to work: resetting passwords to defaults, repairing permissions, deleting my universal access and keyboard .plist files. What I have noticed is that it may be a problem with the "<>" characters used by mail in this field. When I create a shortcut in System Preferences I will type "SV <[email protected]>" and exit System Preferences. When I go back in it says ">SV <[email protected]>". No matter how many times I go in and try to fix this it doesn't work. If anyone else is having this problem or if anyone has any suggestions, Please Help!
This is difficult to sort out without hands on access to the webapp. I think Firefox should still allows your webapp to detect the Shift+F9, or at least it does in this simple example:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<title>Test Shift+F9</title>
</head>
<body>
<p>Try Shift+F9<br><input type="text" name="textinput" size="25" value="sample value"></p>
<script type="text/javascript">
function keys(key){
if (!key) {
key = window.event;
key.which = key.keyCode;
if (key.which == 120){ // F9 key
if (key.shiftKey){
alert("Shift+F9 pressed!");
} else {
alert("F9 pressed without Shift!");
return false;
document.onkeyup = keys;
document.body.focus();
</script>
</body>
</html>
It's possible that a change in Firefox 19 is interfering with the function triggered by the Shift+F9 keyboard shortcut. Is there another way to run it to see whether that might be the case? -
Mail search using e-mail addresses not longer works after 10.6 update?
I just updated to 10.6 from 10.5. I have also added all the software updates.
The search function no longer works for e-mail addresses. I used to right-click on an address, copy and paste in search. Now, when I do that, it lists like this : NAME <[email protected]> (sample info) instead of just the e-mail address. In this new form, the search function no longer functions. Is there a way to revert to the old way mail copies e-mail address?
I do not want to have to delet ethe name & out of each paste.
input greatly appreciated!Perfect! Works like a charm.
For others looking for the fix.
In 10.6, it seems someone at Apple decided that Copy Address should really mean Copy Name And Address And Add Angle Brackets Around The Address, because that's exactly what happens when you use Copy Address in Snow Leopard's Mail app. Instead of getting [email protected] on the clipboard, you get Sue Sample <[email protected]>.
Besides now having an incorrect name on the Copy Address contextual menu item (thought admittedly, the alternative is a bit lengthy), this behavior is incredibly irritating if you want only the email address on the clipboard. Thankfully, some engineer somewhere deep within Apple included a hidden preference to change this behavior -- and the fine folks at Mac Daddy World (the Ecamm Network blog site) dug deep and discovered this preference.
To revert to the 10.5-style behavior in Mail, first quit Mail then enter this command in Terminal:
defaults write com.apple.mail AddressesIncludeNameOnPasteboard -bool NO
Maybe you are looking for
-
My iTunes is up to date and i have print screens to show you what I'm on about if it's unclear: http://i40.tinypic.com/mku9lw.jpg http://i41.tinypic.com/25h1gs1.jpg The genius said he'd not come accross this before but i'm pretty sure everything is u
-
This copy of Windows is not genuine Build 7601
Some time ago, malware damaged my windows 7 professional by making it not genuine(I keep getting those annoying pop-ups). I've discussed this subject in length on the windows support forumn, but still haven't fixed the problem. My PC came ins
-
InfoPath and SDP not allowed: Use Form or document to solve requirements?
Dear all I work in a company which has supplied SharePoint 2007 with limited user rights on operational level: No use of SharePoint Designer, InfoPath, VisualStudio. But we can customize SharePoint sites with administrator rights. My department inten
-
Automatic upload of attachments in Bid
Hi Gurus we need a solution where we want to upload e.g. drawings to our bid inv automatic, did anyone of you ever created a solution like this or did you have an idee how to do this. did we have a BADI cover the attachments? we already have a progra
-
Is it possible to connect iphone5 bluetooth with other phone brands
is it possible to connect iphone5 bluetooth with other phone brands