Smile script won't compile

here is what i came up with
but some thing is wrong

property searchFor : "mike"
property replaceWith : "Charles"
set file_ to alias "Macintosh HD:car19c01.app"
tell application "Smile" to open file_
set oldContents to (contents of file_)
set AppleScript's text item delimiters to searchFor
set oldContents to oldContents's text items
set AppleScript's text item delimiters to replaceWith
set newContents to "" & oldContents
set AppleScript's text item delimiters to {""}
set contents of file_ to newContents
check syntax file_

please give some suggestion
i also want to tell this script to run “file_” after content is changed and then close it with saving NO

thanks

Your major issue is likely to be the fact that only one line of this script is targeted to Smile:

tell application "Smile" to open file_ 

Nothing else in the script is sent to Smile. In order to target multiple commands to the application you need to include them in a tell application/end tell block.

Additionally, you cannot “set oldContents to (contents of file_)” since file_ is a file reference. Conceptually, if this is a compiled app the ‘contents’ of a file would include the compiled code. Instead I think you’re trying to get the source code, in which case you should get Smile to open the file, then use Smile’s reference to that script.

Putting this all together you get something like:

property searchFor : "mike"
property replaceWith : "Charles"
set file_ to alias "Macintosh HD:car19c01.app"
tell application "Smile"
    set scriptFile to open file_
    set oldContents to (text of scriptFile)
    set AppleScript's text item delimiters to searchFor
    set oldContents to oldContents's text items
    set AppleScript's text item delimiters to replaceWith
    set newContents to "" & oldContents
    set AppleScript's text item delimiters to {""}
    set text of scriptFile to newContents
    check syntax scriptFile
end tell

thanks camlote for doing correction in my script
now is it possible to tell smile to run that newly edited script (car19c01.app)

thanks once again