Scripting iBlog (not scriptable)

I am a newbie. That having been said…I am trying to script an application that does not have an available dictionary. The app is iBlog. I want to write a script that will activate the app and open up a new entry and insert text from a filemaker database. I have been able to figure out the FMP side of it but I am stuck with the iBlog side.

Is it possible to script keystokes? For example the keystroke in iBlog to moke a new entry is “apple-N”. Could I just make a script that opens iBlog then performs the keystroke? if so what would be the syntax for it?

Thanks

Greg

It’s a little complicated but doable:

--you said you can get the content from FMP so this is just dummy content:
set the_title to "the title"
set the_abstract to "the abstract"
set the_entry to "the entry"

--assumes that the new blog message always opens with the Entry Title field active
--to do this, open a new entry, make the entry title field active, then close the entry without saving
tell application "iBlog" to activate
tell application "System Events"
    tell process "iBlog"
        keystroke "n" using command down
        delay 1
        keystroke the_title
        delay 1
        keystroke tab
        delay 1
        keystroke the_abstract
        delay 1
        keystroke tab using control down
        delay 1
        keystroke the_entry
        delay 1
        keystroke tab using control down
        delay 1
        keystroke tab --sets it back to the title field
        delay 1
        keystroke return --save it
    end tell
end tell

Jon

Jon,
Thanks for your help. I tried to run the script you gave me but I got the following syntax error…

Expected end of line but found identifier.
“using” is highlighted in the line…

keystroke "n" using command down

I am not sure why I have the error. Any thoughts?

Greg

If you are running OS X 10.2.x, change ‘using’ to ‘with’.

– Rob

when I changed “using” to “with” I got the following error:

Expected “into”, variable name, class name, othre parameter name or property name but found apllication constant or consideration.

This was with the command down highlighted in the script.

Any other thougts?

Greg

PS i am using 10.2.8

What is the version number reported by this script?

tell application "System Events" to version
display dialog result

If it isn’t 1.2 or later, you need to install the beta version of System Events that was released to Jaguar users. It includes the ability to use UI scripting [d/l]. Make sure that after the installation, you go to the Universal Access pref pane and “Enable access for assistive devices”. It’s required for UI scripting.

Note: This won’t offer all of the UI scripting features that are available to Panther users and some of the terminology differs. This means that you won’t be able to use every UI script that you might encounter.

– Rob

Rob, The script returned Version 1.1.2.

I think I am going to upgrade to panther toady so that may fix the whole problem.

Greg

That should do it. Jaguar doesn’t include UI scripting by default and the only way to get it is to download and install the software mentioned previously. Panther, on the other hand, does include UI scripting. As far as I know, you’ll still need to visit the Universal Access pref pane and “Enable access for assistive devices” after installing Panther.

– Rob