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
-
Fasasoftware
- Posts: 203
- Joined: Mon Oct 31, 2011 9:36 pm
-
Contact:
Post
by Fasasoftware » Wed Apr 04, 2018 8:33 pm
Is There a way to command..to open and close a cd?
i need a solution cross-platform at least for window10 and mac os x for livecode community.....
I s there an easy way??? i know...livecode do not do....why???
Thanks a lot in advance,
Lestroso

-
Klaus
- Posts: 14198
- Joined: Sat Apr 08, 2006 8:41 am
-
Contact:
Post
by Klaus » Wed Apr 04, 2018 8:51 pm
Buonasera Lestroso,
what exactly do you mean with "open and close a cd"?
To "open" a card you need to "go to cd xyz" and to "close" it you need to go to another card or close the stack. Is that what you are looking for? Of course this can be scripted.
Best
Klaus
-
DavJans
- Posts: 275
- Joined: Thu Dec 12, 2013 4:21 pm
Post
by DavJans » Wed Apr 04, 2018 8:52 pm
Something like this?
Code: Select all
on rawKeyDown pKey
--F1
if pKey is "65470" then
go to next card
--or go to card "card name"
else
pass rawKeyDown
end if
end rawKeyDown
"Det bästa stället att hitta en hjälpande hand är i slutet av din egen arm" förutom här
-
bogs
- Posts: 5480
- Joined: Sat Feb 25, 2017 10:45 pm
Post
by bogs » Wed Apr 04, 2018 10:24 pm
I believe he means a 'cd/dvd player', not a cd(card). I could be wrong though.
-
Fasasoftware
- Posts: 203
- Joined: Mon Oct 31, 2011 9:36 pm
-
Contact:
Post
by Fasasoftware » Wed Apr 04, 2018 10:46 pm
Yes, bogs, i'm sorry...you're right....
i need a command to eject the cd inside the computer..is there a manner cross platform?? thanks a lot..
i saw the trick...launch the applescript to do that...ok but in windows??? ok....in addition the launch command don't work....
thanks a lot...
lestroso

-
Fasasoftware
- Posts: 203
- Joined: Mon Oct 31, 2011 9:36 pm
-
Contact:
Post
by Fasasoftware » Wed Apr 04, 2018 10:49 pm
This applescript works fine! how i can launch this?? the command "launch" don't open any app!!!
i have made an app from this code....manually ok work but i f put a button and the script launch don't work...
Code: Select all
tell application "Finder"
eject (disks whose ejectable is true)
end tell
Best regards,
Lestroso
-
bogs
- Posts: 5480
- Joined: Sat Feb 25, 2017 10:45 pm
Post
by bogs » Wed Apr 04, 2018 11:13 pm
I believe what you are going to wind up using is "shell" function, probably within an if/then or case/switch statement (since you'll have to issue different command line functions based on windows/mac), but maybe someone else has actually played with ejecting cds/dvds and will know better.
-
Klaus
- Posts: 14198
- Joined: Sat Apr 08, 2006 8:41 am
-
Contact:
Post
by Klaus » Thu Apr 05, 2018 11:08 am
AHA!
OK, on the Mac you can use shell to open and close the CD try:
Code: Select all
...
## Open:
get shell("drutil tray eject")
...
## Close:
get shell("drutil tray close")
...
Tested and works!
Since this is still listed in the dictionary you could try this on Windows:
Code: Select all
...
## Open:
get MCISendString("set cdaudio door open")
...
## Close
get MCISendString("set cdaudio door closed")
...
No idea if and how it will work if you have more than one CD/DVD device attached to your machine.
Best
Klaus
-
Fasasoftware
- Posts: 203
- Joined: Mon Oct 31, 2011 9:36 pm
-
Contact:
Post
by Fasasoftware » Thu Apr 05, 2018 10:42 pm
thank a lot klaus.... i'll try your code...thanks again...
cheers!
Lestroso

-
Fasasoftware
- Posts: 203
- Joined: Mon Oct 31, 2011 9:36 pm
-
Contact:
Post
by Fasasoftware » Fri Apr 06, 2018 12:42 pm
Dear friends,
i have tryed this script for Mac os x in a button :
Code: Select all
on mousedown
## Open:
get shell("drutil tray eject")
end mousedown
This works very fine!!!! Now i will try for windows...Thanks a lot to everybody!!!
Best regards,
Lestroso
-
Klaus
- Posts: 14198
- Joined: Sat Apr 08, 2006 8:41 am
-
Contact:
Post
by Klaus » Fri Apr 06, 2018 1:17 pm
Fasasoftware wrote: ↑Fri Apr 06, 2018 12:42 pm
Code: Select all
on mousedown
## Open:
get shell("drutil tray eject")
end mousedown
This works very fine!!!!
That's what I meant with "Tested and works".

-
bogs
- Posts: 5480
- Joined: Sat Feb 25, 2017 10:45 pm
Post
by bogs » Fri Apr 06, 2018 3:47 pm
Klaus wrote: ↑Fri Apr 06, 2018 1:17 pm
Fasasoftware wrote: ↑Fri Apr 06, 2018 12:42 pm
This works very fine!!!!
That's what I meant with "Tested and works".
He's just confirming your not exploiting a
bug 
-
Klaus
- Posts: 14198
- Joined: Sat Apr 08, 2006 8:41 am
-
Contact:
Post
by Klaus » Fri Apr 06, 2018 4:00 pm
bogs wrote: ↑Fri Apr 06, 2018 3:47 pm
Klaus wrote: ↑Fri Apr 06, 2018 1:17 pm
Fasasoftware wrote: ↑Fri Apr 06, 2018 12:42 pm
This works very fine!!!!
That's what I meant with "Tested and works".

He's just confirming your not exploiting a
bug 
OK, I think can live with that.
