Address Book to Sales Force
Posted by clark in Address Book, Applescript, Automation, Python, SalesForce on 2010/02/06
Here’s an other little script I wrote for using SalesForce.com. We take the selected contacts in Address Book, open up a new contact entry in SalesForce and then fill in the data. Now I could have made this a bit more advanced, copying in all the emails, addresses, phone numbers and so forth that are possible. But I rarely use those. So I can handle copying and pasting those or just modifying the script if they become more common.
Once again Apple’s optional develop menu in Safari is invaluable. I used to do all this with plugins for FireFox but I now actually prefer analyzing web pages in Safari. All you have to do is find the form name and then the id of the field you want to fill in. You then use JavaScript in Safari to set the value like this:
Safari.do_JavaScript("document.forms['form_name']['field_id'].value = \"" + myvalue + "\"", in_=FEdoc)
I’ve used this technique a lot in various scripts. So long as there aren’t logic bugs on the page (i.e. using an identical id multiple times) this approach works fantastic and is a rapid way to fill in forms.
SalesForce to FedEx
Posted by clark in Applescript, Automation, Automator, Python, SalesForce on 2010/02/06
A lot of my scripts are designed to make shipping easier. I usually use FedEx for my shipping and have discussed in the past filling out the packing forms in Safari in an automated way. I don’t know about you, but this saves me a lot of time. I’ve been using SalesForce a lot of late and one thing I do frequently is ship samples to leads or to existing contacts. Since I don’t (yet) have a safe syncing between my leads and Address Book I wanted a way to use a Service to print a FedEx packing slip for the displayed contact or lead.
This script makes a few assumptions. First it assumes you are logged into FedEx. (If you have an open window in Safari somewhere that’s sufficient) It then assumes the front window is your SalesForce window. It does check to ensure you are in a detail. If you’re not then it doesn’t do anything.
Copy Email Address Only
Posted by clark in SalesForce, System on 2010/02/04
OK, I’d mentioned this one in the sidebar several months ago. But I hadn’t actually done it myself. Now that I’m running SalesForce I find myself copying and pasting email addresses a lot. However under Snow Leopard the default for copying an email address is to include the name followed by the email address in braces. SalesForce really doesn’t like that format though. So what we want is just the email address to copy.
It’s easy enough to do.
Script Storage
Posted by clark in Automation, Blog on 2010/02/02
I get a lot of Google searches which land on various scripts. Unfortunately the landing locations are often blog posts from months ago. Sometimes these are outdated or even non-functioning scripts. (Many were written before Snow Leopard) To try and let people know about the latest versions I’m putting up a Script page which will contain the latest versions of my various scripts. (See the tab near the top of the page)
I’m also using this as an excuse to clean up a lot of scripts. In many cases they use older Python classes that have been depreciated. In some cases they no longer work with Snow Leopard.
The first script I’ve added is my script to look up all addresses in my address book within a specified distance. I’ve modified it so it prompts with a dialog box for the address and only looks up addresses in my group “Clients” rather than all people. (I use this for when someone sends an email to me asking for nearby stores that stock our chocolate) I have this configured as a service using Automator. So it’s easy to access. It generates a nicely formatted list in either TextMate or Automator for pasting into a mail message.
Shell and Automator
I’ve been doing far too much “punditry” the past few weeks here. So I wanted to give a few tips.
To start let me give a great way to keep infrequently used shell scripts. If you are like me you have some shell commands you run only occasionally. For instance when I am trying to debug a network I often use nmap (installed via MacPorts). However because I do it so infrequently I have to remember the arguments to the command and then how I mapped the NAT. (Some networks use 10.0.0.x while others use 192.168.1.x and others 192.168.0.x) So I put the following as a service in Automator.
nmap -F 192.168.1.0-255 | mate
This makes it easy to find the machine I need to ssh into. (I make several automator actions for each network) I can also see, from a security point of view, what services are up (and what services shouldn’t be up).
iPad: Second Thoughts
Posted by clark in Commentary on 2010/01/29
I was pretty negative about the iPad the other day. I’ve been thinking about it more and I do think it would make an ideal second computer for some people. For instance my wife rarely does anything that demands more than what the iPad offers, and she’d love the form factor.
I think thought that what bothers most people is just that the iPad didn’t push forward the industry at all. There’s nothing I can point to and say, “that’s innovative.” Further I don’t think Jobs did a good job of explaining why this middle ground between the iPhone and MacBook is necessary.
Don’t get me wrong, as I can see it being nice for certain niches. I think the Kindle in particular will see stress. I can also see potentially getting one for my wife who rarely does anything but email and Facebook with the occasional short letter. She’d love that to use in bed, for instance. But how many families are there that want a second computer but don’t want the power of a laptop? I suspect there’s a lot fewer than Apple needs.
Underwhelmed
Posted by clark in Commentary on 2010/01/27
OK, I know everyone will be talking about the iPad. But most people I know are amazingly underwhelmed. This was like the lower baseline all rumors had in common. It’s basically just the iPhone: larger.
First, I was very disappointed that the iPhone wasn’t mentioned at all. Although that may just mean iPhone 4.0 isn’t nearly as ready as rumored. I suspect though that the lack of mention of multitasking for the iPad may mean no multitasking in 4.0.
Sending Data to Windows
Posted by clark in Applescript, Automation, System on 2010/01/22
For reasons I won’t go into I had to get some data imported into a popular Window app. Sadly the app doesn’t have good import abilities. Were I a com hacker I might have been able to do something on Windows. However I’m primarily a Mac guy and all my data was in an Excel spreadsheet. Enter the hack of Python, GUI scripting and appscript. I had my Windows program open in Parallels.
Here’s a nice little template I used for this. Some of it might have been handled better using cut and paste. But for reasons I won’t go into I wanted it to appear to the Windows app as if I were typing all the data from my Excel spreadsheet into the Windows app.
I suspect this may come in handy for a few of you who run OSX and Windows simultaneously and need to be able to have some level of scripting in Windows. What’s nice about Windows (and sometimes frustrating about Macs) is that you can do almost all things via the keyboard. This means utilizing Applescript/Appscript you can script a lot in Windows from the Mac.
Using Python to Cleanup Excel
Posted by clark in Productivity, Python, iWork on 2010/01/21
Often you get a spreadsheet with some data that needs heavily filtered. You could try Applescript but let’s be honest. For text processing Python is so much easier. So here’s a Python script I use a lot with Excel. It’s pretty flexible following my scripting rules. It’s designed to be more a template that I then modify when the need arises.
First the code and then the comments.
.jpg)
Giving Up Jailbreak?
Posted by clark in Commentary, iPhone on 2010/02/04
I un-jailbroke my iPhone. The battery was just starting to drain like crazy. I’m not sure what I’d installed that did this. I honestly don’t use that many jailbroken apps. I don’t theme my iPhone. But it was noticeable. When I went back to “stock” my battery life doubled. Shortly thereafter version 3.1.2 of the OS came out. I hear you can jailbreak 3.1.2 with redsnOw other than the 3GS. Unfortunately I have a 3GS. But while the jailbreak for the 3GS waits, this will give me a chance to see if I’d really miss the jailbreak.
There’s a lot I love about it. SBSettings in particular. But especially with 1Password, I love multitasking.
We’ll see. I think that if Apple gave us multitasking and AT&T gave us cheap tethering that I wouldn’t even think about jailbreaking…
No Comments