Making Web Log Updater in AppleScript Studio
By: Jesse Shanks
I have done some experimenting in the past with the "Dialog Director" scripting addition and "Dialog Studio" from macscripter.net. I have eagerly anticipated the release of AppleScript Studio to allow for more expanded scripting options. My first experiences with AppleScript Studio showed me something quickly that I later read on the Studio mailing list: Nicholas Riley said, "An issue with much of AppleScript Studio is that if you don't know what's going on with Cocoa, and want to do something complex, you can often get very confused, very quickly. I hope the documentation improves, so that AppleScript Studio can be accessible to a wider audience."
So, it was fairly easy to bring the same code that had worked before into AppleScript Studio behind the Cocoa interface.
This window allows for creation of three types of entries on the site. The "Update" button captures the title, url and selected text of a web page. Although, it isn't necessary, a sheet then comes down and allows for input of a "source." I will probably delete the sheet, but it does prompt to make sure a source is included. A category is selected in the table. Then the "Post" button send the assembled URL to Explorer, which then connects to the PHP script. Update: Upgraded the application to use "curl" in "do shell script" for uploading the posted data. Infinitely better.
If the "Diary Entry" button is checked, then the "source" and "url" are not necessary. This allows for a log entry that is, well, a "diary entry." To send a link to the "links" page of the site, the "Links" button can be clicked. This points to a different PHP script that sends the information into a different table, although it could be the same and use a parameter to choose the proper query to run. The "Clear" button responds to the escape key and clears all the fields.
I am still not completely happy with the interface, because I sometimes make mistakes in what I hit. So, more usage experiments will need to be done to see what causes problems. The main mistake I make is it hit the "post" button when I mean to submit a link.
Items to be upgraded:
Store the categories in a preferences file.
Add a window to allow uploading articles like this one to the web site.
File upload capability.
Storage of favorites in a drawer.
Editing of information that is stored in the database. Currently, I have to go to the browser and connect to the database to fix mistakes.
Another item to be upgraded is my own personal knowledge of Cocoa and Object-oriented programming. Hopefully, I have used my experience in AppleScript as a bridge into the Cocoa world and eventually my applications will become more Cocoa and less AppleScript.
January 8, 2002