AUTOMATE


page index:

basic scripting    

date handling BASIC script

event viewer searches   

FTP examples

percent sign use in variables

task variables vs task function variables

writing debug info in a task to a file


BASIC SCRIPTING

[2024-04-09]

Execute command help
file:///C:/Program%20Files/Automate%20Enterprise%2011/Help/Content/Task_Builder/Actions_Activities/BASIC_Script/BASIC_Script_-_Execute.htm

Basic commands help
file:///C:/Program%20Files/Automate%20Enterprise%2011/Help/Content/TechRef/Basic_Scripting/Functions/doc_dateadd_func.htm?tocpath=Technical%20Reference%7CBASIC%20Scripting%7CBasic%20Functions%7C_____28

Doc classmodule help
file:///C:/Program%20Files/Automate%20Enterprise%2011/Help/Content/TechRef/Basic_Scripting/Definitions/doc_classmodule_def.htm

 


DATE HANDLING BASIC script

[2024-04-09]
Option Explicit

Sub Main
    '  put yesterday's date into tv_sFromDate and tv_sThroughDate in the correct yyyyMMdd format
    ' for P & U files, these dates must be passed to the .exe but they are not used
    ' for T files, tv_sFromDate will be overwritten with the value from the "remember" file later

    Dim sYear As String
    Dim sMonth As String
    Dim sDay As String
    Dim dMyDate As Date

    'left these here commented for future debugging if needded
    'Dim tv_sFromDate As String
    'Dim tv_sThroughDate As String


    ' Get today's date
    dMyDate = Now
    ' Now go back one day so we have T-1
    dMyDate = DateAdd("d", -1, dMyDate)

    sYear = Format(DatePart("yyyy", dMyDate), "0000")
    sMonth = Format(DatePart("m", dMyDate), "00")
    sDay = Format(DatePart("d", dMyDate), "00")

    tv_sFromDate = sYear & sMonth & sDay
    tv_sThroughDate =  sYear & sMonth & sDay

End Sub

 

 

EVENT VIEWER SEARCHES

prior to server upgrade ~2024-06-23, there were ~5M application events and after filter was applied, any manipulation of results such as sorting differently etc. would repeat search rather than just sorting results (thus searching took forever)

(?<=(^Source:        Automate Agent 11(.*(\r\n)){8})Description.*(\r\n)).*\r\n

I later found it was easier to export 7 days then read it on my local vdi in event viewer


FTP examples

see ...\office_repository\automate\tasks\automate ftp\...

 

 


PERCENT SIGN USE IN VARIABLES

[2024-05-28
]to display 2 variables in a row encapsulate together in percent and use space + & + space between them
%sSrcDir & sFilename%
can't do double percent as that is the literal percent sign

if there is a char needed between them just percent each variable
%sSrcDir%\%sFilename%

help link
file:///C:/Program%20Files/Automate%20Enterprise%2011/Help/Content/Advanced/Percent_Signs_in_Automate.htm?Highlight=concatenation

 


TASK VARIABLES VS TASK FUNCTION VARIABLES

[4/25/2024 3:21 PM] Rick Bambauer
The last couple tickets I looked at had existing tasks with variables created in the Main() function having a name starting with "tv_" indicating they are task variables. These are not task variables; they are task function variables whose scope is the Main() function of the task only.  To declare a task variable that is available in all functions of the task, create the variable on the "Task Variables" tab.  I propose variables created in a function be named "tfv_" or similar going forward to avoid boatloads of confusion down the road as our tasks become more sophisticated and begin containing more than one function.

can't copy variable name from "Task Variables" tab


WRITING DEBUG INFO IN A TASK TO A FILE

!--2024-06-17 247pm et RJB create a log file that gets entries whether step is successful or not-->
<AMVARIABLE NAME="tfv_LogFilename" VALUE="" />
<AMVARIABLE ACTIVITY="set" VARIABLENAME="tfv_LogFilename" VALUE="*** INSERT FILENAME NAME HERE****" />
<AMFILESYSTEM ACTIVITY="write_file" FILE="%tfv_LogFilename%">%Format(Now(), "yyyy-MM-dd HH_mm_ss")% Starting task "*** INSERT TASK NAME HERE****"</AMFILESYSTEM>

Oddly, it doesn't append to the file the next day
It makes a new copy of the file with the same name
So 2 appear with same name in windows explorer
I noticed that after i did shift+right then "copy as path", the ordinal is displayed so every file is uniquely named in windows explorer

 


 

last updated:    Wed 2024-06-26 3:57 AM