end of line error

this script wont compile, i receive the error message:"expected end of line
class name found " in line 5;
any help is welcome

property username : “the-username”
property userpass : “the-password”
on run{}
tell application “TextWrangler”
set d to selected document
set ptitle to name of d
set ptext to text of d

     (*  Use this if you use projects as categories *) 
     -- set pcategory to name of selected project 

     set  n  to  my  Blogger_newPost ( my  WP_AssemblePost ( ptitle , ptext , "General")) 
      set  pnotes  to  ((("Post number: " & n  as  string ) & return  & "Posted on: " & ( current date ) as  string ) & return  & notes  of  d ) 
      set  notes  of  d  to  pnotes 
 end  tell 

end run

on WP_AssemblePost ( postTitle , postText , postCategory )
set x to “”
if postTitle is not “” then set x to x & “” & postTitle & “”
if postCategory is not “” then set x to x & “” & postCategory & “”

  set  x  to  x  & postText 
 return  x 

end WP_AssemblePost

on Blogger_getPosts ()

 --  returns an array 

 tell  application  "path-to-xmlrpc-interface" 

      return  call xmlrpc  { method name :"blogger.getRecentPosts", parameters :{"", "", username , userpass , 10}} 

  end  tell 

end Blogger_getPosts

on Blogger_newPost ( postText )

 --  returns index of post 

 tell  application  "path-to-xmlrpc-interface" 

      return  call xmlrpc  { method name :"blogger.newPost", parameters :{"", "none", username , userpass , postText , true }} 

  end  tell 

end Blogger_newPost

on Blogger_editPost ( postNumber , postText )

  tell  application  "path-to-xmlrpc-interface" 

      return  call xmlrpc  { method name :"blogger.editPost", parameters :{"", ( postNumber  as  string ), username , userpass , postText , true }} 

  end  tell 

end Blogger_editPost

Hi lizhard,
the debugger is right: you have to close tour if tags

Hope it helps
Farid

same error: expected end of line class name found
the error is in line 5

I see “document” in the TextWrangler dictionary, but “selected” is not a property of documents. You are selecting in the Finder, not in TextWrangler.

i have changed “selected document” to “document window”
and work; thanks novascotian


property username : "the-username"
property userpass : "the-password"
on run {}
	tell application "TextWrangler"
		set d to document window
		set ptitle to name of d
		set ptext to text of d
		
		(*  Use this if you use projects as categories *)
		-- set pcategory to name of selected project 
		
		set n to my Blogger_newPost(my WP_AssemblePost(ptitle, ptext, "General"))
		set pnotes to ((("Post number: " & n as string) & return & "Posted on: " & (current date) as string) & return & notes of d)
		set notes of d to pnotes
	end tell
end run

on WP_AssemblePost(postTitle, postText, postCategory)
	set x to ""
	if postTitle is not "" then set x to x & "<title>" & postTitle & "</title>"
	if postCategory is not "" then set x to x & "<category>" & postCategory & "</category>"
	
	set x to x & postText
	return x
end WP_AssemblePost


on Blogger_getPosts()
	
	--  returns an array 
	
	tell application "path-to-wordpress/xmlrpc.php"
		
		return call xmlrpc {method name:"blogger.getRecentPosts", parameters:{"", "", username, userpass, 10}}
		
	end tell
end Blogger_getPosts


on Blogger_newPost(postText)
	
	--  returns index of post 
	
	tell application "path-to-wordpress/xmlrpc.php"
		
		return call xmlrpc {method name:"blogger.newPost", parameters:{"", "none", username, userpass, postText, true}}
		
	end tell
end Blogger_newPost


on Blogger_editPost(postNumber, postText)
	
	tell application "path-to-wordpress/xmlrpc.php"
		
		return call xmlrpc {method name:"blogger.editPost", parameters:{"", (postNumber as string), username, userpass, postText, true}}
		
	end tell
end Blogger_editPost

to work with TextWrangler change:


set d to document window

with:


set d to window index 1