If "STOP" Is typed do this Would it be possible For example would it be possible for me to code a very simple repeat code but say If I just typed STOP that it would end the program here is my beginning code for the repeat.

set x to 1

repeat while x is 1
    tell application "Finder"
       activate
       make new Finder window
    end tell
end repeat


and so for example if STOP is entered set x to 2 or something?

Thank you
No - Applescript is not multi-threaded in the sense that you can set up two things to happen at one time.

To do what you want, you'd need another language that could open a window so the user could type characters to be interpreted and change the signal variable to exit the loop. That language would handle multiple threads and communication between the two processes so that the setting of the new X value would be visible to the other thread running the loop.

If you'd rather stick to AppleScript, you could probably do what you want by using the existence of a file to keep the loop running:

if file "semaphore" of application "Finder" exists then
   -- continue processing...
end if


This is documented at https://developer.apple.com/library/mac/documentation/AppleScript/Conceptual/AppleScriptLangGuide/conceptual/ASLR_fundamentals.html

Search for the section titled Direct Parameter or use the semaphore string to locate the snippet I copied above. Then you could have the user delete the "chosen" file - maybe putting it on their desktop and call it "keepRunning" or something so they trash it when the script should stop running.