I'm trying to create a script that interacts with the Blogger API on my Wordpress blog. I have AS Studio application for writing the post, then when you hit send it calls post.scpt with osascript. post.scpt is where my trouble is. Currently, I have 3 preferences files containing the username, password and post content. My code is as follows:
Code:
set f to alias "Macintosh HD:iBlogPrefs:iBloguser.txt"
set myusername to read f
set f to alias "Macintosh HD:iBlogPrefs:iBlogpass.txt"
set mypword to read f
set myappkey to "iblog"
set myblogid to "0"
set f2 to alias "Macintosh HD:iBlogPrefs:iBlogcontent.txt"
set mypost to read f2
tell application "http://mattholland.com/wordpress/xmlrpc.php"
return call xmlrpc {method name:"blogger.newPost", parameters:{myappkey, myblogid, myusername, mypword, mypost, true}}
end tell
Whenever I run this script I get this error:
Code:
http://mattholland.com/wordpress/xmlrpc.php got an error: parse error. not well formed
However, when I set the username, password and content inside the script, it works fine. Here's the code for that:
Code:
set myappkey to "myblogwidget"
set myblogid to "0"
set myusername to "kmancat"
set mypword to "spper"
set mytitle to "Post 1"
set mypost to "Post 1"
set mypublish to true
tell application "http://mattholland.com/wordpress/xmlrpc.php"
return call xmlrpc {method name:"blogger.newPost", parameters:{myappkey, myblogid, myusername, mypword, mypost, true}}
end tell
Any ideas on why I might get this error, or other ways to pass the script those variables?
.
Code:
set f to alias "Macintosh HD:iBlogPrefs:iBloguser.txt"
set myusername to read f
set f to alias "Macintosh HD:iBlogPrefs:iBlogpass.txt"
set mypword to read f
set myappkey to "iblog"
set myblogid to "0"
set f2 to alias "Macintosh HD:iBlogPrefs:iBlogcontent.txt"
set mypost to read f2
tell application "http://mattholland.com/wordpress/xmlrpc.php"
return call xmlrpc {method name:"blogger.newPost", parameters:{myappkey, myblogid, myusername, mypword, mypost, true}}
end tell
Whenever I run this script I get this error:
Code:
http://mattholland.com/wordpress/xmlrpc.php got an error: parse error. not well formed
However, when I set the username, password and content inside the script, it works fine. Here's the code for that:
Code:
set myappkey to "myblogwidget"
set myblogid to "0"
set myusername to "kmancat"
set mypword to "spper"
set mytitle to "Post 1"
set mypost to "Post 1"
set mypublish to true
tell application "http://mattholland.com/wordpress/xmlrpc.php"
return call xmlrpc {method name:"blogger.newPost", parameters:{myappkey, myblogid, myusername, mypword, mypost, true}}
end tell
Any ideas on why I might get this error, or other ways to pass the script those variables?
.