Sign in to follow this  
Followers 0
HypercamJ

Array Help

2 posts in this topic

I'm trying to design a script that opens all the cd drives but my coding isn't that great yet

What am I doing wrong? :

CODE

#include <Array.au3>

$trays = StringSplit("A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,Y,X,Z", ",")

;For $t=$trays[0] to $trays[26]

do

CDTray($trays & ":", "open")

until $trays = "Z"

exit

Also, is there a way to make it run only to open one drive?


Prove, and I will believe...

Share this post


Link to post
Share on other sites



I'm trying to design a script that opens all the cd drives but my coding isn't that great yet

What am I doing wrong? :

#include <Array.au3>

$trays = StringSplit("A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,Y,X,Z", ",")

;For $t=$trays[0] to $trays[26]
do
CDTray($trays & ":", "open")
until $trays = "Z"
exit

Also, is there a way to make it run only to open one drive?

Take another look at For/Next loops in the help file. This example gets a list of all "CDROM" type drives and then opens them. Look each of the functions up in the help file:
#include <Array.au3>; Only for _ArrayDisplay(), otherwise not required

$trays = DriveGetDrive("CDROM")
_ArrayDisplay($trays, "Debug: $trays")
For $t = 1 to $trays[0]
    CDTray($trays[$t], "open")
    Sleep(1000)
Next

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0