Guest srusse01 Report post Posted 02/26/2004 03:29 AM I am trying to create a log file for each phone call containing information that is relevant to my colleagues. Here is the event log created and then below is how the log text file looks. Any clues on how I can get each module represented on one line and following the correct order 130546.75 7 [Log StudyID] Run Program 130546.77 7 RVreplace start: [command.com /c echo StudyID: $RV[GetStudyID_1_1] >> c:\DINO\$RV[GetStudyID_1_1].txt] 130546.77 7 RVreplace end: [command.com /c echo StudyID: 001690 >> c:\DINO\001690.txt] 130546.77 7 running:[command.com /c echo StudyID: 001690 >> c:\DINO\001690.txt] WindowMode:[Hide] 130546.78 7 Run Program continuing... 130546.78 7 Going down On Success path. 130546.80 7 [Log Date] Run Program 130546.80 7 RVreplace start: [command.com /c echo DateRand = $RV[Date] >> c:\DINO\$RV[GetStudyID_1_1].txt] 130546.80 7 RVreplace end: [command.com /c echo DateRand = 26/02/2004 >> c:\DINO\001690.txt] 130546.80 7 running:[command.com /c echo DateRand = 26/02/2004 >> c:\DINO\001690.txt] WindowMode:[Hide] 130546.81 7 Run Program continuing... 130546.81 7 Going down On Success path. 130546.83 7 [Log Hosp] Run Program 130546.83 7 RVreplace start: [command.com /c echo Hospital Code = $RV[Enter Hospital Code] >> c:\DINO\$RV[GetStudyID_1_1].txt] 130546.84 7 RVreplace end: [command.com /c echo Hospital Code = 3113 >> c:\DINO\001690.txt] 130546.84 7 running:[command.com /c echo Hospital Code = 3113 >> c:\DINO\001690.txt] WindowMode:[Hide] 130546.86 7 Run Program continuing... 130546.86 7 Going down On Success path. 130546.88 7 [Log URNum] Run Program 130546.88 7 RVreplace start: [command.com /c echo Patient UR = $RV[EnterUR] >> c:\DINO\$RV[GetStudyID_1_1].txt] 130546.88 7 RVreplace end: [command.com /c echo Patient UR = 99 >> c:\DINO\001690.txt] 130546.89 7 running:[command.com /c echo Patient UR = 99 >> c:\DINO\001690.txt] WindowMode:[Hide] 130546.89 7 Run Program continuing... 130546.89 7 Going down On Success path. 130546.92 7 [Log BirthWt] Run Program 130546.92 7 RVreplace start: [command.com /c echo BirthWeight Group (1 = <1250gms, 2 = >= 1250gms) = $RV[birthWt] >> c:\DINO\$RV[GetStudyID_1_1].txt] 130546.92 7 RVreplace end: [command.com /c echo BirthWeight Group (1 = <1250gms, 2 = >= 1250gms) = >> c:\DINO\001690.txt] 130546.94 7 running:[command.com /c echo BirthWeight Group (1 = <1250gms, 2 = >= 1250gms) = >> c:\DINO\001690.txt] WindowMode:[Hide] 130546.94 7 Run Program continuing... 130546.95 7 Going down On Success path. 130546.95 7 [Log MultBth] Run Program 130546.98 7 RVreplace start: [command.com /c echo Multiple Birth (1 = yes, 2 = no) = $RV[MultipleBth] >> c:\DINO\$RV[GetStudyID_1_1].txt] 130547.02 7 RVreplace end: [command.com /c echo Multiple Birth (1 = yes, 2 = no) = >> c:\DINO\001690.txt] 130547.03 7 running:[command.com /c echo Multiple Birth (1 = yes, 2 = no) = >> c:\DINO\001690.txt] WindowMode:[Hide] 130547.03 7 Run Program continuing... 130547.05 7 Going down On Success path. 130547.06 7 [Log Strata] Run Program 130547.06 7 RVreplace start: [command.com /c echo Strata: $RV[GetStrata_1_1] >> c:\DINO\$RV[GetStudyID_1_1].txt] 130547.11 7 RVreplace end: [command.com /c echo Strata: 1 >> c:\DINO\001690.txt] 130547.11 7 running:[command.com /c echo Strata: 1 >> c:\DINO\001690.txt] WindowMode:[Hide] 130547.13 7 Run Program continuing... 130547.14 7 Going down On Success path. 130547.14 7 [MDOB_DAY] Evaluate [Mid($RV[MDOB]+1000000,2,2)] 130547.16 7 RVreplace start: [Mid($RV[MDOB]+1000000,2,2)] 130547.16 7 RVreplace end: [Mid(140106+1000000,2,2)] 130547.17 7 .Eval(Mid(140106+1000000,2,2)) 130547.20 7 Eval Expr result:[14] 130547.20 7 path {14} not found 130547.22 7 [MDOB_MONTH] Evaluate [Mid($RV[MDOB]+1000000,4,2)] 130547.23 7 RVreplace start: [Mid($RV[MDOB]+1000000,4,2)] 130547.23 7 RVreplace end: [Mid(140106+1000000,4,2)] 130547.23 7 .Eval(Mid(140106+1000000,4,2)) 130547.25 7 Eval Expr result:[01] 130547.25 7 path {01} not found 130547.27 7 [MDOB_YEAR] Evaluate [Right($RV[MDOB],2)] 130547.27 7 RVreplace start: [Right($RV[MDOB],2)] 130547.27 7 RVreplace end: [Right(140106,2)] 130547.28 7 .Eval(Right(140106,2)) 130547.28 7 Eval Expr result:[06] 130547.28 7 path {06} not found 130547.31 7 [Log MDOB] Run Program 130547.34 7 RVreplace start: [command.com /c echo Mother's DOB = $RV[MDOB_DAY]/$RV[MDOB_MONTH]/$RV[MDOB_YEAR] >> c:\DINO\$RV[GetStudyID_1_1].txt] 130547.34 7 RVreplace end: [command.com /c echo Mother's DOB = 14/01/06 >> c:\DINO\001690.txt] 130547.36 7 running:[command.com /c echo Mother's DOB = 14/01/06 >> c:\DINO\001690.txt] WindowMode:[Hide] 130547.36 7 Run Program continuing... 130547.38 7 Going down On Success path. Output is: StudyID: 612304 00 Email sent: OK /04/64 = no) = 1 Share this post Link to post
SupportTeam Report post Posted 02/26/2004 04:17 AM If writing to same log file from subsequent modules in same script or from multiple lines then it's preferable to use the Run VB Script module to write log files, as the DOS echo command does not handle concurrent writing to the same file well. From VG Help file, section on Run VBScript module: Example 1: The VB Script below will append a line of text to the file C:\LogCall.txt - the line of text will contain information about start of the call, caller's telephone number and information entered by caller in module "EnterClientNumber". Result Variables are used in this script to allow information from VoiceGuide to be visible to the VB Script. Const ForReading = 1 Const ForWriting = 2 Const ForAppending = 8 set fso = CreateObject("Scripting.FileSystemObject") set tsFile = fso.OpenTextFile("C:\LogCalls.txt", ForAppending, True) tsFile.WriteLine "$RV_STARTTIME, $RV_CIDNUMBER, $RV[EnterClientNumber]" tsFile.Close set tsFile = Nothing set fso = Nothing Share this post Link to post
Guest Sarah Report post Posted 02/26/2004 11:28 AM I will try that. Can I put all the required text from several modules in one VB Script. If so, how do I start a new line for each item? Share this post Link to post
SupportTeam Report post Posted 02/26/2004 11:57 AM each WriteLine writes a new line to the file... an alternative way is to use vbCrLf eg: strOut = "This is the first line" & vbCrLf & "and this is the second line" tsFile.WriteLine strOut Share this post Link to post
Guest Sarah Report post Posted 02/27/2004 01:26 AM I tried using the VB Script as per your instructions, and now I get this message in my event log 115225.53 7 [Log results] Running VB Script... 115225.55 7 RVreplace start (strlen>500) 115225.56 7 Run Script waiting... (shellid=1916, process=1496) 115226.58 7 LsRunWaitTillFinished EV_TIMEOUT_CHECKONSTATE 115226.58 7 task completed (shellid=1916, process=1496) 115226.58 7 No information returned from program to VG (no VGRUNRESULT_7.TXT or SHLRESLT.TXT) 115226.58 7 Hanging up call... [WaitTillFinished - next module not specified] The actual VB Script module looks like this: Const ForReading = 1 Const ForWriting = 2 Const ForAppending = 8 set fso = CreateObject("Scripting.FileSystemObject") set tsFile = fso.OpenTextFile("c:\DINO\$RV[GetStudyID_1_1].txt", ForWriting, True) tsFile.WriteLine "StudyID: $RV[GetStudyID_1_1]" tsFile.WriteLine "DateRand = $RV[Date]" tsFile.WriteLine "Hospital Code = $RV[Enter Hospital Code]" tsFile.WriteLine "Patient UR = $RV[EnterUR]" tsFile.WriteLine "BirthWeight Group (1 = <1250gms, 2 = >= 1250gms) = $RV[birthWeight]" tsFile.WriteLine "Strata: $RV[GetStrata_1_1]" tsFile.Writeline "Allocation Group $RV[GetStudy_2_1]" tsFile.WriteLine "Mother's DOB = $RV[MDOB_DAY]/$RV[MDOB_MONTH]/$RV[MDOB_YEAR]" tsFile.WriteLine "Email sent: $RV[send Email test_SendResult]" tsFile.Close set tsFile = Nothing set fso = Nothing This is in an update script that runs once the caller has hung up. I have set the main script to log information to SHLRESLT.TXT which is stored in c:\ and this is updated with each call. Here is a sample of what it contains: StudyID: 612301 Treat Group: Green UR Number: 55 Trial: 1 Strata: 1 StudyID: 612302 Treat Group: Blue UR Number: 66 Trial: 1 Strata: 1 StudyID: 612303 Treat Group: Pink UR Number: 77 Trial: 1 Strata: 1 StudyID: 612303 Treat Group: Pink UR Number: 88 Trial: 1 Strata: 1 StudyID: 612304 Treat Group: Green UR Number: 99 Trial: 1 Strata: 4 StudyID: 612348 Treat Group: Green UR Number: 145 Trial: 1 Strata: 3 StudyID: 612332 Treat Group: Yellow UR Number: 88 Trial: 1 Hope this helps you to help me. Thanks Share this post Link to post
SupportTeam Report post Posted 02/27/2004 03:45 AM What is the actual problem? Is info written to the file "c:\DINO\$RV[GetStudyID_1_1].txt" OK? (Trace shows that it is). Do you want to run other modules after [Log results] ? If so then you should select "Do not wait for script to complete" option in that module. Share this post Link to post