mikeraut Report post Posted 04/29/2013 07:05 AM I would like set up a script to randomly select anumber form list and then pass the selected number to the transfer call moduleto perform the transfer. Please show me the script syntax as I believe it requires reading from a file (open text file) and to Randomize the result and pass the $RV result to the transfer module Share this post Link to post
mikeraut Report post Posted 04/29/2013 08:02 AM So far I have come this far with the script - need assistance to complete the transfer section CONST FOR_READING = 1 set vg = CreateObject("vgServices.CommandLink") Set ofso = CreateObject("Scripting.FileSystemObject") Set ofile = ofso.OpenTextFile("C:Program Files\Voiceguide\Scripts\Project\extensions.txt",FOR_READING) arrFile = Split(ofile.readall,vbCrLf) Randomize i = Int((Rnd * UBound(arrFile))) arrLine = Split(arrFile(i),",") For i=0 To UBound(arrLine) WScript.Echo arrLine(i) vg.Script_Goto iLineId, "", "TransferToExt", sRv set fso = Nothing set vg = Nothing Next Share this post Link to post
SupportTeam Report post Posted 04/29/2013 08:05 AM Probably the most straightforward approach here would be to use a "Run VBScript" type module and make it run a VBScript that opens the input file (or to simplify just set the phone numbers in the VBScript) and loads them into an array. Then a random selection of the array index is made and the contents of that array entry are saved as $RV which is then used in Transfer Call module. Share this post Link to post
SupportTeam Report post Posted 04/29/2013 08:10 AM Why was this included: arrLine = Split(arrFile(i),",") ? The below should probably be enough: CONST FOR_READING = 1 set vg = CreateObject("vgServices.CommandLink") Set ofso = CreateObject("Scripting.FileSystemObject") Set ofile = ofso.OpenTextFile("C:Program Files\Voiceguide\Scripts\Project\extensions.txt",FOR_READING) arrFile = Split(ofile.readall,vbCrLf) Randomize i = Int((Rnd * UBound(arrFile))) sRv = "[xferdest]{" & arrFile(i) & "}" vg.Script_Goto iLineId, "", "TransferToExt", sRv set ofile = Nothing set ofso = Nothing set vg = Nothing then use $RV[xferdest] in the module "TransferToExt" Share this post Link to post
mikeraut Report post Posted 04/29/2013 10:47 AM Thank you Here is the final script that works for other like me who need a little help on the coding... CONST FOR_READING = 1 set vg = CreateObject("vgServices.CommandLink") Set ofso = CreateObject("Scripting.FileSystemObject") Set ofile = ofso.OpenTextFile("C:\Program Files\Voiceguide\Scripts\Project\extensions.txt",FOR_READING) arrFile = Split(ofile.readall,vbCrLf) Randomize i = Int((Rnd * UBound(arrFile))) sRv = "[TransfertoExt]{" & arrFile(i) & "}" 'sRv = arrFile(i) vg.Script_Goto $RV_LINEID, "", "TransferToExt", sRv 'vg.Script_Goto $RV_LINEID, "", "C:\Program Files\VoiceGuide\Scripts\Project\Project.vgs\TransferToExt", sRv set ofile = Nothing set ofso = Nothing set vg = Nothing Share this post Link to post