How to Use External AppleScript Handler?

Hey guys,
Sorry for asking, but I just don't know how to use the external applescript handler.
I Dont even know how to insert picture in this post...
well, below is my script
My purpose is that to monitor a folder full of receipt, get amount of expense from receipt.pdf (using custom text match in hazel "$123"), and using an applescript to import the amount variable, delete the currency mark in amount variable, and run a moneywiz url-scheme to auto record an expense.
this script runs perfectly if i change the imported variable into set variable inside this script. but the problem is that, if i use the embedded script, the "on FindandReplace..." will not be recognised and complied. but due to my poor knowledge and experience in programing, I just don't understand how to use the "on hazelMathFile" handler so that I can run this external script perfectly in hazel.
Thanks a lot if anyone can help!
Sorry for asking, but I just don't know how to use the external applescript handler.
I Dont even know how to insert picture in this post...
well, below is my script
on findAndReplaceInText(theText, theSearchString, theReplacementString)
set text item delimiters to theSearchString
set theTextItems to every text item of theText
set text item delimiters to theReplacementString
set theText to theTextItems as string
set text item delimiters to ""
return theText
end findAndReplaceInText
on hazelMatchFile(inputAttributes)
return true
end hazelMatchFile
set Amount to inputAttributes
set Amount to findAndReplaceInText(Amount, "$", "") as number
set murl to "moneywiz://expense?amount=" & Amount & "&category=Subscription&tag=membership&account=HSBC"
tell application "Safari"
tell window 1
set current tab to (make new tab with properties {URL:murl})
end tell
end tell
My purpose is that to monitor a folder full of receipt, get amount of expense from receipt.pdf (using custom text match in hazel "$123"), and using an applescript to import the amount variable, delete the currency mark in amount variable, and run a moneywiz url-scheme to auto record an expense.
this script runs perfectly if i change the imported variable into set variable inside this script. but the problem is that, if i use the embedded script, the "on FindandReplace..." will not be recognised and complied. but due to my poor knowledge and experience in programing, I just don't understand how to use the "on hazelMathFile" handler so that I can run this external script perfectly in hazel.
Thanks a lot if anyone can help!