Forum Index -> VoiceMac -> VoiceMac & Applescript
Delete Thread
Page First 1 Last

Emanuele
May 29, 2012, 6:47:52 PM
Hello!

First, thank for this great and free app.

I created an Applescript to automate sending SMSs to my staff.

(Repeat cycle for all of my staff)

set StaffPhoneNumber to "tel://" & StaffPhoneNumber
set the clipboard to "Text to send"
sendSMS(StaffPhoneNumber) of me

(End repeat)

on sendSMS(phoneNumber)
tell application "VoiceMac" to open location phoneNumber
delay 0.1
tell application "System Events" to tell process "VoiceMac"
keystroke "s"
keystroke "v" using {command down}
keystroke return
end tell
delay 2.5
end sendSMS

It works, but I have a couple of problems:

1) The very first SMS, never get sent. The text is pasted correctly but the keystroke return, which sends the SMS, doesn't work.

2) I added a delay for every SMS, because if the Applescript sends a new SMS while VoiceMac is refreshing the status of its windows I get errors, wrong pasted text, SMSs which don't get sent, etc. With this delay it's not better, but not perfect, I still get errors sometimes.

Any advice?

I really appreciate the hard work you put in this program!

Regards,

Emanuele

Mr. Gecko
May 29, 2012, 8:23:47 PM
I would suggest downloading and modifying the code of VoiceMac. It was never meant for automation like this, however it is possible with code modification.

All you would have to do is edit the MGMController file where it listens for the sms://, tel:// and such urls and set special parameters such as ?message=text, have it call the MGMInbox directly.

Emanuele
May 30, 2012, 12:54:10 AM
Thanks for the suggestion. Unfortunately I'm an hobbyist programmer and I just started learning ObjC but I am at the very beginning. Anyway, I downloaded the code but I don't even know where to start....

Any further help would be appreciated a lot!

Emanuele

Mr. Gecko
May 30, 2012, 3:31:02 AM
Start out by viewing password practice's code. It's very basic, "does this string equal?", kinda of math... The first attempt would be figuring out how to compile other people's projects. Mine is kinda hard as I try to support OLD systems such as TIGER and even Apple has dropped Tiger support. Learn compiler error correction and such like that.

Objective-C isn't that hard of a language once you understand the syntax and if you have a basic programming understanding. My code is all in clear English, so following what things do isn't hard. That's what most *good* programmers do.

Emanuele
May 30, 2012, 8:22:36 PM
Great, and I am at the level that I can understand "Password practice". I was able to compile it on Xcode 4.2 + Lion. Thanks for sharing that.

Unfortunately I was not able to compile VoiceMac, I get too many errors on my system, but that's probably because I don' t have SDKs for earlier OSs. I am going to download them and retry.

You are obviously very talented and skilled as a programmer, not only as a code developer but also as a deviser of ideas. I noticed that VoiceMac is one of your most downloaded software. That's an indicator it's liked by the community. Why did you stop developing it, after evidently having put serious effort on it?

Best,

Emanuele

Mr. Gecko
May 30, 2012, 9:13:22 PM
You don't need the SDKs in order to compile it. Change the SDK field to be current OS. You'll need to do this in VoiceMac as well as VoiceBase. If it has PPC in the field for the archetectures, you'll want to change that to standard universal or to the current archetecture of the computer you are on.

I still have plans for it, the only reason I stopped developing it as fast as I was is because I got a job, and I also have family, church, school, and other projects. I write this stuff for me and decided to share it with other people by releasing it. I will continue to work on it, just do not know when.

Colleage is up the connor and I am working full time. So I have very little time to code as I get tired and want to rest a bit.

Hopefully that helps you.

Emanuele
June 1, 2012, 8:23:21 PM
Thanks and I was able to compile VoiceMac, even if I still get a couple of errors.

I also found in the MGMController file where it listens for the sms:// (line 325) , unfortunately it's too intricate for me to change anything there....any hint will be appreciated...

Great on your plans for VoiceMac, and I understand about multiple jobs and activities. Regarding being "tired", I get pumped and forget about it when I'm doing a project I'm really into it. It's a sensation that erases everything!

I hope you will be able to continue soon!

Emanuele

Mr. Gecko
June 3, 2012, 12:12:37 PM
Replace all lines within that if statement with below and read my comments as it'll tip you how to finish it.

if (currentContactsController==-1)
return;
MGMVoiceUser *contactsController = (MGMVoiceUser *)[contactsControllers objectAtIndex:currentContactsController];
if (![contactsController respondsToSelector:@selector(sms:)]) return;
NSString *phoneNumber = [data phoneFormatWithAreaCode:[contactsController areaCode]];
if ([query objectForKey:@"message"]!=nil) {
MGMInbox *inbox = [[contactsController instance] inbox];
//- (void)sendMessage:(NSString *)theMessage phoneNumbers:(NSArray *)thePhoneNumbers smsID:(NSString *)theID delegate:(id)theDelegate;
//Notes: Phone numbers is an array, therefore you have to wrap the phone number above like so... [NSArray arrayWithObject:phoneNumber]. SMS ID should be nil as we don't have one, and delegate should be self and you should at least implement the error reporting call backs so you can see what errors occur when sending an message. On the mesage, just use the query dictionary request for message. Uncomment above on 295 and 308.
} else {
[contactsController showContactsWindow];
[[contactsController phoneField] setStringValue:[phoneNumber readableNumber]];
[self sms:self];
}

Page First 1 Last
Name:
Email Address:
Message:
Image Verification:
verify
Refresh