I wrote the solution with Araq's hint. It did not work for me with a procedure 
instead of a macro.
    
    
    import macros, winim
    
    let myRange = 0..99
    
    macro playAndWriteLN(audioFile: string; myStr: varargs[typed]): untyped =
      result = newStmtList()
      
      # Add PlaySound call to result
      let playStmt = quote do:
        PlaySound(`audioFile`, 0, SND_NOSTOP)
      result.add(playStmt)
      
      # Add echo call to result
      let echoStmt = newCall("echo")
      for s in myStr:
        echoStmt.add(s)
      result.add(echoStmt)
    
    playAndWriteLN("C:/winvox/Sound/Sortevox/So_sorte.wav", "The range is 
between ", myRange.a, " and ", myRange.b)
    
    
    Run

Reply via email to