Unable to make bindings


(Jonas Whale) #1

After doing a lot of work on a Project, I needed to add a button.
If I duplicate an existing button, it will be bound to the right handler in main script.
But if I create a new one, it’s impossible to bind it.
And it’s the same for every control on the window.

I guess It’s a normal behavior but I don’t understand why and how to make bindings possible again?


(Shane Stanley) #2

I’m guessing that when you say “bind” you actually mean setting it’s action. You should be able to do that with new buttons.

How are you editing the file? If you’re using an external editor, as you should, make sure you’re saving with linefeeds for linebreaks, and not carriage returns.


(Jonas Whale) #3

I do! And guess what? It’s Script Debugger! :wink:

Do you mean this:

While answering, I figured out where is the problem:
I have a script that compares the the code in XC vs SD then ask what to do if they differs.
If the choice is to keep the XC source, then it replaces the SD version.
I guess the LF are changed to CR at this time.

Thank you for pointing me on this, without your help, I would be searching in decades!
:slight_smile:


(Shane Stanley) #4

No, here:


(Jonas Whale) #5

What I did not get is that Script Debugger is always converting linefeeds to CR at compile time, regardless how the preference is set.

When saving from Script Debugger, I resolved this with save document 1 line endings Unix endings.
And for comparison before opening the Xcode script in Script Debugger, I added a statement that changes LF to CR.

:wink:


(Shane Stanley) #6

That’s what the AppleScript compiler returns.


(Jonas Whale) #7

That’s what I meant :wink:

My phrase should have been:
«I thought that with that pref, SD should convert CR to LF after compiling. But this is stupid because the only way to keep linefeeds is to leave the script uncompiled.»

[[I’m not sure this is clearer! :laughing:]]