Reading txt-file and summarize with another value


I thought it would be simple to read a text-file (there is only a number in that file example: 100). That number must be summarized with another number that is been setted in the script.

I tried the following:

Result is following errormessage: Can’t make number into a number

When I use “integer” for all variables (also for subtotal), I get the message: “can’t make integer into a number” or “can’t make number into an integer”.

What do I wrong?

kindly regards,


this is syntax confusion
number is a reserved word, you can’t use it as a variable name

Set total to number

sets the variable total to class number, but this declaration is not needed.
The class of the variable is set automatically by the class of the value.

set subtotal to (read file "Macintosh HD:desktop folder:total.txt" as "number")

as number (without quotes!) is a valid coercion, but you try to coerce with a literal string.

You probably mean something like this

set total to 100
set subtotal to (read file "Macintosh HD:desktop folder:total.txt") as number
total2 = total + subtotal