Friday, November 16, 2018

#1 2018-09-25 12:41:43 am

Mr. Science
Member
From:: Satellite Beach, Florida
Registered: 2015-08-13
Posts: 23
Website

How To Crash Script Editor

OK, first let me say, "Don't try this at home." Now that you agree this is a bad idea, here's what happened: I was playing with various versions of passing an argument from one script to another. My two scripts were simulating a phone call between Bert & Ernie. The goal was to identify as many variations of usefulness as I could from the exercise. Eventually I felt like I understood it and moved on. Later, in a completely different project, it came to me that the way I had used the "me" variable to differentiate between "on run" in an application and "on run" played from the Script Editor ("me" meaning "«script»" and "me" meaning "current application") might cause Ernie to experience an existential crises.  In fact, it was a bad one. So bad, that not only did Ernie handily crash the Script Editor in a mere 7 words, but after rebooting it, Ernie put on a dazzling display of trailing window clones & shadows which I hadn't seen since PC's began using mouses that were too fast for the monitor refresh!

So, that said – here's the punch that knocked out Script Editor version 2.7 (176) with AppleScript 2.4 in Yosemite 10.10.5...

Applescript:


on run "«script»"
   return "«script»"
end run

Please don't blame me for you trying this. But seriously, was it just me?

Last edited by Mr. Science (2018-09-25 12:46:45 am)


"Fail and fail until you fail to fail!"   ~   http://www.theMrScienceShow.com


Filed under: , crash, Editor, «script»

Offline

 

#2 2018-09-25 09:40:31 am

Mr. Science
Member
From:: Satellite Beach, Florida
Registered: 2015-08-13
Posts: 23
Website

Re: How To Crash Script Editor

I should add that upon rebooting Script Editor, my crashing code had somehow transformed itself into Chinese. Which, when run, still crashes the Script Editor!

Applescript:


on run "꬀猀挀爀椀瀀琀묀"
   return "«script»"
end run


"Fail and fail until you fail to fail!"   ~   http://www.theMrScienceShow.com

Offline

 

#3 2018-09-25 09:47:04 am

Mr. Science
Member
From:: Satellite Beach, Florida
Registered: 2015-08-13
Posts: 23
Website

Re: How To Crash Script Editor

This caused the crash too. Again with conversion to Chinese characters and bizarre video artifacts upon reboot. I guess it wasn't the "«script»" string.

Applescript:


on run "oops"
return "oops"
end run


"Fail and fail until you fail to fail!"   ~   http://www.theMrScienceShow.com

Offline

 

#4 2018-09-25 10:35:28 am

Mr. Science
Member
From:: Satellite Beach, Florida
Registered: 2015-08-13
Posts: 23
Website

Re: How To Crash Script Editor

It appears that any quoted text string or number placed after "on run" will cause a crash. Script Editor either ignores or gives proper refusal to reserved words or other predefined strings. Typically indicating that they are illegal as a formal parameter.

All these are fine have no problem...

  on run application
  on run script
  on run file
  on run text
  on run integer
  on run null
  on run (grr)
  on run {}
  on run []

This gets a tidy error...
  on run Applescript's  Text Item Delimiters

But these oddities crash it...
  on run [grr]
  on run 666
  on run ""

Oh, well... One more thing for the Applescript "Nope" list!


"Fail and fail until you fail to fail!"   ~   http://www.theMrScienceShow.com

Offline

 

#5 2018-09-25 11:26:56 am

Nigel Garvey
Moderator
From:: Warwickshire, England
Registered: 2002-11-20
Posts: 4720

Re: How To Crash Script Editor

The thing is, of course, is that 'on run' is the first line of a 'run' handler. As with any handler, any parameter has to be either a variable to receive a passed value or a list containing a variable or variables, not a value itself.

on run aVariable -- Whatever's passed.
on run {aVariable} -- The (first) item in what's known to be a list.
on run {{a:aVariable}, {a:anotherVariable}} -- The values of a in the first two items of a list of records
etc.


NG

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)