Page 1 of 1

[ANN] SSRequestUserAttention

Posted: Sun Nov 12, 2017 4:44 pm
by shaosean
Here is my first LCB script.. It's Mac-only though.. It allows you to get the user's attention (make the dock icon bounce).. Syntax is very simple: RequestUserAttention(isCritical)

If you just want the dock icon to bounce once

Code: Select all

RequestUserAttention(FALSE)
If you want the dock icon to bounce until the application is brought to the foreground

Code: Select all

RequestUserAttention(TRUE)
To install this, download the attached file and save it somewhere (go and unzip it)
In LiveCode, go to the menu Tools > Extension Builder
In the new window, click the Folder icon (top right corner) and find the file
Once it loads in, click on the "Install" button (bottom of the window)

Now the library is installed to your Documents > My LiveCode > Extensions folder
You will need to do manual inclusions when building though.

Re: [ANN] SSRequestUserAttention

Posted: Tue Nov 14, 2017 12:55 am
by capellan
This LCB script remembers me an external that you have published before.
I use Linux and Windows and could not compile this LCB script.
Are you going to publish more Mac-only LCB scripts?

Al

Re: [ANN] SSRequestUserAttention

Posted: Tue Nov 14, 2017 8:13 am
by shaosean
capellan wrote:
Tue Nov 14, 2017 12:55 am
This LCB script remembers me an external that you have published before.
I use Linux and Windows and could not compile this LCB script.
Are you going to publish more Mac-only LCB scripts?

Al
This script is Mac-only, as only the macOS has that exact feature.. Yes, the other two OSes have similar features, and I would love to do the same for them, but I'm just learning this stuff and I am more familiar with the Mac than the other OSes so I will start with what I know and hopefully can branch out (but no promises)..

Re: [ANN] SSRequestUserAttention

Posted: Tue Nov 14, 2017 7:39 pm
by capellan
Many thanks for answering my request! :D
Hopefully, LCB scripts works just as well
with Linux and Windows.

Re: [ANN] SSRequestUserAttention

Posted: Tue Nov 14, 2017 8:55 pm
by shaosean
I'll see what I can do. :-)

Re: [ANN] SSRequestUserAttention

Posted: Thu Nov 16, 2017 12:00 am
by PaulDaMacMan
Cool Thanks! There needs to be more LCB FFI examples!

Some people might not realize that this only works if LiveCode IDE or Standalone is in the background, if your stack is in the foreground then it does not do anything (nor should it).
To test it just put a

Code: Select all

wait 5 secs
line in front of the

Code: Select all

RequestUserAttention(isCritical)
or use a do as AppleScript... line and switch to the Finder.

Re: [ANN] SSRequestUserAttention

Posted: Thu Nov 16, 2017 6:11 am
by shaosean
Thanks for pointing that out.. I'm not very good at docs, but you're right, it only works when your application is in the background.. If you use the RequestUserAttention(TRUE) method, the dock icon will keep bouncing until your application is brought to the foreground..

I'm attempting to do more LCB projects, but the docs are kind of like I wrote them ;) Right now I'm at a bit of a standstill as the sample code, posted in the other thread, doesn't seem to do anything, so that limits what I can do with working with the windows.. I have another piece of code that fails on the binding, so need to figure out what's up with that..

Re: [ANN] SSRequestUserAttention

Posted: Fri Jan 19, 2018 7:39 pm
by PaulDaMacMan
I posted a script that kind of compliments your LCB SSRequestUserAttention nicely. There's probably a way to do this more elaborately though LCB FFI and add more options (I've seen these notifications have buttons), but this does what I needed it to do using just LCS (mixed with AppleScript):
http://livecodeshare.runrev.com/stack/862/MacToast

Re: [ANN] SSRequestUserAttention

Posted: Sat Jan 20, 2018 7:05 am
by shaosean
Pretty cool Paul..