To get the result as a string or in a dialog box

Hi Guys,

I got the below script from net. Its works fine. Its shows the replacement count in the result window. How to get this result as a string or in the dialog box

set the_file to choose file default location (path to desktop)
set the clipboard to (read the_file)
set theClipboard to the clipboard
set tid to AppleScript’s text item delimiters
set AppleScript’s text item delimiters to “Hello”
set aList to the text items in the theClipboard
set theCount to (the count aList) - 1
set AppleScript’s text item delimiters to tid
return theCount

Thanks

Hi,

just coerce the integer to text


return theCount as text

the clipboard is actually not needed in the script

Hi,

I have tried this. But it seems idle.

return theCount as text
display dialog theCount

the keyword return aborts the script or returns from a handler.
use this


set countString to theCount as text
display dialog countString

Hi StefanK,

It works. Thanks