Questa funzione vi permette di avere la liste delle opzioni da riga di comando date in pasto al vostro programma.
Ad esempio se il vostro programma viene lanciato così:
mioProgramma.exe -v -s 10x10 -n Max --bello -z=51
potete cercare di estrarre le opzioni così:
put GetOpt("v s n b,bello z") into tInfoif the number of elements in tInfo["errors"] > 0 then write "ERROR:" && tInfo["errors"][1] to stderrelse if "v" is among the keys of tInfo["options"] then put "l'utente ha scelto l'opzione v"else if "s" is among the keys of tInfo["options"] then put "s = " tInfo["options"]["s"]else if "n" is among the keys of tInfo["options"] then put "n = " tInfo["options"]["n"] end iPer più informazioni leggete: http://livecode.wikia.com/wiki/Getopt
Nessun commento:
Posta un commento