Enable scripts without card or stack visible

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
AlessioForconi
Posts: 90
Joined: Sun Feb 15, 2015 2:51 pm

Enable scripts without card or stack visible

Post by AlessioForconi » Tue Aug 30, 2016 9:37 am

Hi,

having this script

Code: Select all

try
   set wirelessstatus to do shell script "networksetup -getairportpower en1"
on error
   display dialog "Lo script non funziona come previsto. Controlla le impostazioni network."
end try

if wirelessstatus is "Wi-Fi Power (en1): On" then
   do shell script "networksetup -setairportpower en1 off"
else if wirelessstatus is "Wi-Fi Power (en1): Off" then
   do shell script "networksetup -setairportpower en1 on"
else
   display dialog "Lo script non funziona come previsto. Controlla che la connessione wireless sia specificata correttamente, per impostazione predefinita è EN1. Puoi ottenere questa informazione dal Menu Apple-->Resoconto di sistema-->Network-->Wi-Fi oppure da Terminale-->ifconfig -a"
   
end if
It can work by entering into an ordinary button.
But what I want to do is activate it without getting the card, in practice by clicking on the icon you should run the script with nothing visible and nothing more, but I do not know how to do.
I tried to put the script in both OpenStack that preOpenStack setting up the stack as invisible but it does not activate script, perhaps because invisible setting will not charge?

Some inspiration?

Thank you.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10330
Joined: Wed May 06, 2009 2:28 pm

Re: Enable scripts without card or stack visible

Post by dunbarx » Tue Aug 30, 2016 1:42 pm

Hi.

If I understand what you mean, do you want to invoke a handler in an invisible stack from a remote location?

Would not the "send" command (or "dispatch") do what you need? Note that the invisible stack has to be in memory for this to work, otherwise it has to be explicitly opened, even if invisible.

Craig Newman

Post Reply