We have upgraded from RoboTask 6.4 to 9.4. I see that the basic evaluate functionality has depreciated. Is there any way you could help me turn these two into VB? Our developer that created this originally is no longer here.
Sub Main
Dim s As String
Dim yr As String
Dim yrInt As Integer
Dim Julian As Integer
Dim d As Date
Dim realMo As String
Dim realDay As String
' extract Julian date from file name
s = RoboTaskApp.ExpandText("{JULDATE_DAY}")
yr = RoboTaskApp.ExpandText("{JULDATE_YEAR}")
yrInt = CInt(yr)
'MsgBox(s)
On Error Resume Next
' convert string date to integer
Julian = CInt(s)
If Err Then
Err.Clear
Julian = 0
End If
If Julian >0 Then
d = DateSerial(yrInt,1,1)
d = DateAdd("d",Julian-1,d)
If(Month(d) < 10) Then
realMo = ("0"+CStr(Month(d)))
Else
realMo = CStr(Month(d))
End If
If(Day(d) < 10) Then
realDay = ("0"+CStr(Day(d)))
Else
realDay = CStr(Day(d))
End If
RoboTaskApp.SetUserVariable("ProcessDate", CStr(yrInt)+"-"+realMo+"-"+realDay)
'MsgBox(CStr(Month(d))+"/"+CStr(Day(d)))
Else
RoboTaskApp.SetUserVariable("ProcessDate", "Invalid")
'MsgBox("Invalid date")
End If
End Sub
Sub Main
Dim f As String
Dim s As String
Dim yr As String
Dim Julian As Integer
Dim d As Date
' extract Julian date from file name
's = RoboTaskApp.ExpandText("{ExtractFileExt({ExtractFileNameNoExt({C_file})})}")
f = RoboTaskApp.ExpandText("{ExtractFileNameNoExt({RETURN_FILE})}")
'If InStr(f, "ILSTFRM") > 0 Then
s = Mid(f,11,3)
yr = Mid(f,7,4)
On Error Resume Next
' convert string date to integer
Julian = CInt(s)
If Err Then
Err.Clear
Julian = 0
End If
If Julian >0 Then
d = DateSerial(Year(Date),1,1)
d = DateAdd("d",Julian-1,d)
RoboTaskApp.SetUserVariable("ConvertedDate", yr+"-"+CStr(Month(d))+"-"+CStr(Day(d)))
'MsgBox(CStr(Month (d))+"/"+CStr(Day(d)))
Else
RoboTaskApp.SetUserVariable("ConvertedDate", "Invalid")
'MsgBox("Invalid date")
End If
'Else
'End If
End Sub
I will try to understand what these scripts are supposed to do. But it would be great if you could describe in a couple words what initial data and what they should return.
Sorry about that. I am trying my best to understand it as well since the task is pretty complex.
For the first script I provided there would be a file loop and then it extracts two strings from the file name and creates the first two variables for Julian.
So for todays file the STR extract would be
{JULDATE_DAY} = 131
{JULDATE_YEAR} = 2023
Then the script calculates a ProcessDate variable and that is later used in a SQL query.
For the second script it is used later in the task. There is an if statement looking for a string in a file name and if the result is false it will run the second script. ConvertedDate would be used in creating a text file and a SQL query.
About 1-st script - look at my task example below
Save the text of the task to a file and use menu Task->Import to import the task into RoboTask.
Also you can simply copy task text and paste it into the task list.
Sub DoMain
' extract Julian date from file name
s = RoboTaskApp.ExpandText("{JULDATE_DAY}")
yr = RoboTaskApp.ExpandText("{JULDATE_YEAR}")
yrInt = CInt(yr)
'MsgBox(s)
On Error Resume Next
' convert string date to integer
Julian = CInt(s)
If Err Then
Err.Clear
Julian = 0
End If
If Julian >0 Then
d = DateSerial(yrInt,1,1)
d = DateAdd("d",Julian-1,d)
If(Month(d) < 10) Then
realMo = ("0"+CStr(Month(d)))
Else
realMo = CStr(Month(d))
End If
If(Day(d) < 10) Then
realDay = ("0"+CStr(Day(d)))
Else
realDay = CStr(Day(d))
End If
RoboTaskApp.SetUserVariable "ProcessDate", CStr(yrInt)+"-"+realMo+"-"+realDay
'LogMessage(CStr(yrInt)+"-"+realMo+"-"+realDay)
Else
RoboTaskApp.SetUserVariable "ProcessDate", "Invalid"
'MessageBox("Invalid date")
End If
End Sub
DoMain
For the second script it is used later in the task. There is an if statement looking for a string in a file name and if the result is false it will run the second script. ConvertedDate would be used in creating a text file and a SQL query.
Sub DoMain
' extract Julian date from file name
f = RoboTaskApp.ExpandText("{ExtractFileNameNoExt({RETURN_FILE})}")
'f = "qwerty2023131uiop"
s = Mid(f,11,3)
yr = Mid(f,7,4)
'logmessage(s)
'logmessage(yr)
On Error Resume Next
' convert string date to integer
Julian = CInt(s)
If Err Then
Err.Clear
Julian = 0
End If
If Julian >0 Then
d = DateSerial(Year(Date),1,1)
d = DateAdd("d",Julian-1,d)
RoboTaskApp.SetUserVariable "ConvertedDate", yr+"-"+CStr(Month(d))+"-"+CStr(Day(d))
'logmessage(yr+"-"+CStr(Month(d))+"-"+CStr(Day(d)))
Else
RoboTaskApp.SetUserVariable "ConvertedDate", "Invalid"
'MsgBox("Invalid date")
End If
End Sub
doMain
Thanks for the help Oleg.
Everything was running great yesterday with the first script and today the second script was hit and all went well.
That was the last task that I needed to migrate to our new RoboTask 9.4 server so you helped me finish that project.
I have two more small questions.
We installed a new anti-virus and I believe it messed up zip packing files. I have attached the error message we are getting, it references the DelZip DLL . Yesterday when the error appeared we uninstalled Sentinel 1 from the server and after a reboot the zip feature was working, but today it's not working again and S1 was never re-installed. I am wondering if something residual stayed and has messed up with the DLL. Would you have that available to download?
The 2nd question would be for the check for updates. I have also attached the error, basically it says check your internet.
We have pretty strict rules on our firewall so I am sure it's being blocked. Do you have an IP address or URL that the check for updates tool is reaching out to so I could white-list that?
Do you have an IP address or URL that the check for updates tool is reaching out to so I could white-list that?
the updates URL is: https://www.robotask.com/rss/updates/
Of course CheckForUpdates utility uses this URL with parameters: product ID and current version