code
Member in Training
Posts: 74
|
Post by code on Jun 11, 2019 18:35:52 GMT
Here the .bas file:
UpperLeftX = 20 UpperLeftY = 45 WindowWidth = 620 WindowHeight = 620
nomainwin
button #scr.b1, "Start coin pusher...", [b1], UL, 40, 300,200,60
open "Coin pusher" for window as #scr
wait [b1] timer 5000, [tg] inc=0
wait [tg] inc=inc+1 if inc<5 then open "coin.vbs" for output as #tf
print #tf,"Set cd = CreateObject("+chr$(34)+"WMPlayer.OCX.7"+chr$(34)+")" print #tf,"Set ocd= cd.cdromCollection" print #tf,"if ocd.Count >= 1 then" print #tf,"for i = 0 to ocd.Count - 1" print #tf,"ocd.Item(i).Eject" print #tf,"next" print #tf,"for i = 0 to ocd.Count - 1" print #tf,"ocd.Item(i).Eject" print #tf,"next"
print #tf,"end if" close #tf
RUN"wscript coin.vbs" end if
wait
|
|
|
Post by jarych on Jun 11, 2019 19:58:30 GMT
Program code looks strange so I am afraid to try running it.
How is that VBS file and what does it do and how does the right thing know what to do with it? Why is there a PRINT "end if" and why is there an unattached 'end if' line?
|
|
code
Member in Training
Posts: 74
|
Post by code on Jun 11, 2019 20:56:30 GMT
Its a .vbs file wich runs 4 times... It opens the cd-rom door... not much that impressing. You only have to know it can be done with visual basic script (vbs)... Maybe usefull when you wanna make a vendor machine... You can easily search on: vbs open cd... and check for yourself. Thats all ! Regards, code
|
|
|
Post by jarych on Jun 11, 2019 21:13:11 GMT
Its a .vbs file wich runs 4 times... It opens the cd-rom door... not much that impressing. You only have to know it can be done with visual basic script (vbs)... Maybe usefull when you wanna make a vendor machine... You can easily search on: vbs open cd... and check for yourself. Thats all ! Regards, code What about the hanging 'end if' shown in your code? This makes me think parts of your program example are missing.
|
|
code
Member in Training
Posts: 74
|
Post by code on Jun 11, 2019 22:20:33 GMT
Hi,
The end if is to limit not more than 4 times execute the .vbs file (here coin.vbs) (Runned with : RUN"wscript coin.vbs") I did make a test , and if you don't limit it keeps execute the coin.vbs... Uhh, then you can't stop it easily... don't know how it exactly works...so i kept it to 4 times. The picture is not a program/game screenshot. This is just to let know that you can open a cd-rom door...it could have been(maybe better) on Tips and Utilities thread. Thats it/all !
Regards,
code
|
|
|
Post by jarych on Jun 11, 2019 22:30:36 GMT
NOW I see the IF block. (Earlier my complaint in two of my previous posts)
|
|
|
Post by Rod on Jun 12, 2019 8:33:55 GMT
In the past we would not have allowed other script be published on the forum. However VBS has become an exception since it has been used to provide Just BASIC with additional functionality. Speech for example.
If we are adding VBS we should make it very clear what the purpose of the code is for. Then folks can choose to try or not.
|
|