3 Replies Latest reply: Nov 20, 2014 9:15 AM by Andy Hewitt RSS


    Andy Hewitt

      I'm trying to write a post process script to capture project variables into a text file.  I can write strings to the file but I can't find away to capture the current project variables.  I assume they are there because I can use them to create an email message.


      I've seen these.....


      year 4 digit: &[yyyy]

      year 2 digit: &[yy]

      month: &[mm]

      Completed on  &[mm]/&[dd]/&[yyyy]  at  &[hh]:&[mi]:&[ss]

      day: &[dd]

      hour: &[hh]

      minute: &[mi]

      second: &[ss]

      quarter: &[qtr]

      day of year: &[dayofyear]

      ISO: &[isoyear]

      ISO: &[isoweek]

      ISO: &[isoday]

      Item File Path: &[source]

      Item File Directory: &[source.dir]

      Item File Name: &[source.file]

      Item File Name (no Extension): &[source.name]

      Item File Extension: &[source.ext]

      Item URL: &[source.uri]

      Item Title: &[item.title]

      Item Description: &[item.description]

      Job Number: &[jobid]

      Job Log File Name: &[joblog]

      Process Name: &[process]

      System Wide Counter: &[counter]


      So how to I use them in a post process script?




      Dim FILE_NAME As String = "D:\TEMP\LAG\mdp.txt"

      Dim path, file

      path = Log.ExpandMacros("&[source.dir]")
      file = Log.ExpandMacros("&[source.file]")

      If System.IO.File.Exists(FILE_NAME) = True Then

      Dim objWriter As New System.IO.StreamWriter( FILE_NAME )
      objWriter.Write( path & file )


      MsgBox("File Does Not Exist")

      End If


      thanks in advance.

          Olly Bond

          Hello Andy,


          All this useful meta-information is in the log file, no? So if you can just get a handle on the Job ID, all the data you need will be in a file.


          I'm not an expert in much apart from Monarch, but my fellow Experts can handle this sort of stuff. If you'd like a chat with Scott and me, please drop me a line.


          Best wishes,



              Andy Hewitt

              Thanks for the reply.


              Even though the information might be in the log I don't think the log would be closed at the time I would want to use the variable.


              For simplicity say I just want to run a post export script that writes the name and a date stamp of the file that was just processed to a log file.  .


              If I added this to all of my projects at the end of the day I would have a complete list of the files that were processed via datapump.


              Its probably easy to do I just haven't figured out the way to access the variables via script.


              any ides?

              Andy Hewitt

              Thanks for those who provided input to the subject.  With help I've been able to do what I wanted.


              Here is a some code that worked for me.

              Dim LogFileName As String = "\\server\data\MDP\CCO\JASX\DEMO\DEMO.log"

              Dim ExportedFileName As String   =  Log.ExpandMacros("&[output]")    

              Dim InputFileName As String  =  Log.ExpandMacros("&[input]")

              Dim AppendData As Boolean = True        

              Dim objWriter As New System.IO.StreamWriter(LogFileName, AppendData)


              objWriter.WriteLine("Run Date: " & now)                         

              objWriter.WriteLine("Year (4 digit): "  & Log.ExpandMacros("&[year]"))

              objWriter.WriteLine("Year (2 digit): "  & Log.ExpandMacros("&[yy]"))

              objWriter.WriteLine("Month: "  & Log.ExpandMacros("&[mm]"))

              objWriter.WriteLine("Day: "  & Log.ExpandMacros("&[dd]"))

              objWriter.WriteLine("Hour: "  & Log.ExpandMacros("&[hh]"))

              objWriter.WriteLine("Minute: "  & Log.ExpandMacros("&[mi]"))

              objWriter.WriteLine("Second: "  & Log.ExpandMacros("&[ss]"))

              objWriter.WriteLine("Quarter: "  & Log.ExpandMacros("&[qtr]"))

              objWriter.WriteLine("ISO Week: "  & Log.ExpandMacros("&[isoweek]"))

              objWriter.WriteLine("ISO Day: "  & Log.ExpandMacros("&[isoday]"))

              objWriter.WriteLine("ISO Year: "  & Log.ExpandMacros("&[isoyear]"))

              objWriter.WriteLine("Day of year: "  & Log.ExpandMacros("&[dayofyear]"))

              objWriter.WriteLine("ISO Week Day: "  & Log.ExpandMacros("&[isoweekday]"))

              objWriter.WriteLine("ISO Day of Year: "  & Log.ExpandMacros("&[isodayofyear]"))

              objWriter.WriteLine("Half Year: "  & Log.ExpandMacros("&[halfyear]"))

              objWriter.WriteLine("Week: "  & Log.ExpandMacros("&[week]"))

              objWriter.WriteLine("Month Name: "  & Log.ExpandMacros("&[monthname]"))

              objWriter.WriteLine("Short Month Name: "  & Log.ExpandMacros("&[shortmonthname]"))

              objWriter.WriteLine("Day Name: "  & Log.ExpandMacros("&[dayname]"))

              objWriter.WriteLine("Short Day Name: "  & Log.ExpandMacros("&[shortdayname]"))

              objWriter.WriteLine("Fiscal Day of the Year: "  & Log.ExpandMacros("&[fdayofyear]"))

              objWriter.WriteLine("Fiscal Half Year: "  & Log.ExpandMacros("&[fhalfyear]"))

              objWriter.WriteLine("Fiscal Period: "  & Log.ExpandMacros("&[fperiod]"))

              objWriter.WriteLine("Fiscal Month: "  & Log.ExpandMacros("&[fmm]"))

              objWriter.WriteLine("Fiscal Quarter: "  & Log.ExpandMacros("&[fqtr]"))

              objWriter.WriteLine("Fiscal Week: "  & Log.ExpandMacros("&[fweek]"))

              objWriter.WriteLine("Fiscal End of Year: "  & Log.ExpandMacros("&[fendyear]"))

              objWriter.WriteLine("Fiscal Start of Year: "  & Log.ExpandMacros("&[fstartyear]"))

              objWriter.WriteLine("Fiscal End of Year: "  & Log.ExpandMacros("&[fendyy]"))

              objWriter.WriteLine("Fiscal Start of Year: "  & Log.ExpandMacros("&[fstartyy]"))

              objWriter.WriteLine("Input file location: "  & Log.ExpandMacros("&[input]"))

              objWriter.WriteLine("Output file location: "  & Log.ExpandMacros("&[output]"))

              objWriter.WriteLine("Job number: "  & Log.ExpandMacros("&[jobid]"))

              objWriter.WriteLine("Job log: "  & Log.ExpandMacros("&[joblog]"))

              objWriter.WriteLine("Process name: "  & Log.ExpandMacros("&[process]"))

              objWriter.WriteLine("Password: "  & Log.ExpandMacros("&[pwd]"))