I’m not sure if this is a Mac thing or an SD thing, but, I noticed that sometimes if I want to get a continuation character in SD by hitting option-return, I have to hit the option-key on the right-side of the keyboard. The option-return with the option-key on the left side just generates a standard return character.
What’s odd is SD seems to get into this mode where only the right-side option-key works.
But, when I wanted to see if it worked in Script Editor, the first time I tried it there was about a two-second pause, then it worked. Went back to SD and right-side option-key worked there, too.
It happens fairly regularly, but it’s only yesterday on my Yosemite setup at work that I noticed that the right-side option-key worked (I almost always use the one on the left). On my home system (El Capitan) it was behaving exactly the same as at work, left-side option-key no effect; right-side option-key worked, until I tested it in SE. And then both worked.
So my question for other testers are:
Have you ever noticed that? If not, do you use option-return much? Does it work now?
If you have noticed that option-return doesn’t work, do you get the same result with either option-key?
If it’s in the mode where it’s not working, does trying it in SE work?
OK, So SD just slipped into that mode. I was working on a large script. (After freeze, which I had to force quit a couple times for dumb scripting error).
Neither option key worked. I switched to a different script in SD, and both worked. Went back to the script where the option key wasn’t working and it started working again.
A lesser “bug” if that’s what it is can be 100% reproduced.
Try this:
Run this script.
set anyList to {"1", "2", "3", "1", "b", "c", "A", "B", "C"}
Drag and drop from the result into the script window.
Try option-return
Compile and try option-return again.
OMM, option-return doesn’t work after the drag and drop, then works again after the compile. (Both option keys)
When I was having the issue yesterday at work and today, compiling is the first thing I tried, and it had no effect.
So, at the very least, drag and drop a result into a script window starts it on the wrong path?
I also just noticed that if you try to compile after the drag and drop thing, and there is a compile error, that doesn’t fix the issue, and compiling after fixing the error doesn’t fix the issue. But if you switch to a different SD window, do an option-return there, that fixes it.
Let’s step back. When you hit the return key, SD asks if the option key was also down at the same time. It asks for the modifier keys flag for the keyboard event, and tests for the option key. So if you’re seeing different behavior between left and right option keys, then it’s something happening before any of it gets to SD – it’s in the OS, or via some utility.
Exactly. If this is happening, its because of something is happening behind Script Debugger’s back. Script Debugger does not distinguish between option keys and does not have any logic that counts their use or disables them after particular operations.
Quick update. At work on Yosemite, first thing I tired was Option-return with the left option key and it wasn’t working. Tried multiple times making absolutely sure option key was down.
Then tried with the right option key and it worked on the first try.
Tried on with the left option key again, and it worked.
Could not make it stop working. After several hours of off and on scripting and doing nothing it continues to work.
This issue keeps coming up and it’s pretty frustrating. Basically after I’ve done a drag and drop, and have been working in SD for a while I can’t generate a continuation character by holding option and hitting return. (I also tried with space, control and shift). Sometimes it comes back after relaunching, or just going out of SD and back into it, sometimes it doesn’t.
I’m not experiencing this here. I Just tried dropping a file into a SD window to create an alias, and then used Option-RETURN to insert a line continuation and it all worked as I would expect it to.
The code within SD for this is pretty simple: it when you press the RETURN key, it samples the state of the option and command keys and responds accordingly.
I notice this usually after some time working on a script, and it always seems to work at first, and them stop working. Sometimes after only doing it a few times. Sometimes after working for hours.
As for the title of the thread, it seems that when I first notice it happening, the left option key doesn’t work, but the right option key does, but then after a couple more tries neither works.
This last part suggests to me that something external to Script Debugger is interfering. Script Debugger just asks if “the” option key is down. The API I’m using does not distinguish between left and right.
So the continuation character is not working at the moment.
I’ve looked through every accessibility pane, and all the keyboard settings and shortcuts and can’t find anything using the option key at all, so nothing using option-return either. Plenty of command; control; shift keys and combinations of those.
My mac has a very limited number of third party utilities installed and as far as I can tell none intercept the option key.
I’m going to try to switch the SD shortcut to Command-return rather than option return.
Also, while in this state, I am still able to use the option key for other purposes in SD, namely to open for editing a script from the SD or system script windows.
How does the Command-Return key combination work when your machine is in this state? It should insert a new line below the current line regardless of where your insertion point is within the line.