2

Is there a way to see some code, when writing automation with ? I have the following in UiPath Studio:

enter image description here

Is there a way to see the code that looks like this or something similar in :

Sub Main

    Dim year as Integer
    year = InputBox()
    If year mod 4 = 0 Then           'the rule for leap year is a bit different.
        MsgBox "It is leap"
    Else
        MsgBox "It is not leap"
    End If

End Sub

I have browsed around the internet, but so far I only found the XAML code, used for the creation of the boxes. My logic (or hope) is that if the UiPath Studio works with VB expression, then it should be possible to see the generated code:

enter image description here

Vityata
  • 42,633
  • 8
  • 55
  • 100
  • 1
    https://www.uipath.com/studio - looks like a proprietary, closed-source application to me. So I highly doubt you'll be able to get hold of the source. Why do you need to see it? Are you hoping to debug something? Have you tried using the logging features to see what's going on? https://studio.uipath.com/docs/types-of-logs – ADyson Sep 03 '18 at 12:50
  • @ADyson - thanks for answering. I want to see it, because I suppose this way I can learn the tool a bit faster, the built-in debugger is actually pretty primitive. – Vityata Sep 03 '18 at 12:53
  • Anyway it won't be literally translating your diagrams directly into code like you've shown. That's a very naive approach. You're simply putting together a series of pre-defined steps into a sequence, and passing in some variables. So it will execute some pre-defined code as per that step's definition in the original source code, and the behaviour will change only depending on the variables you set, and your definitions of what the possible next step(s) is/are. So it's questionable how useful it would be. The diagram is probably clearer at showing what's supposed to be happening. – ADyson Sep 03 '18 at 12:54
  • ...that's kind of the whole point of the tool, really. Also what makes you think it would be VB.NET? This application could be written in any .NET language. – ADyson Sep 03 '18 at 12:56
  • @ADyson - it uses .NET libraries and the operators are VB.NET operators. Thus, I guessed it somehow internally translates to VB.NET inside. – Vityata Sep 03 '18 at 12:59
  • It's a strong possibility but all the .NET languages are interoperable with each other once compiled. Anyway as I said it won't be turning your diagrams into actual literal code, I'm quite certain. – ADyson Sep 03 '18 at 13:06
  • @ADyson - well, I hope you are wrong. :) And turning digrams into actual literal code is done in Access, where you can build a macro and translate it to VBA with a button click. The macro is actually some kind of similar diagrams. – Vityata Sep 03 '18 at 13:38
  • True but Access originated in the dark ages, and hasn't actually changed a huge amount since in its fundamentals. No workflow engine I've ever worked on / with has done it like that. There are more efficient ways. I sincerely doubt that this package works like Access macros, but maybe I'm wrong, and I don't mind being proved so if it turns out to be the case You could ask on their support channel if no-one answers here. – ADyson Sep 03 '18 at 13:41
  • @ADyson - could be. This is the first workflow engine I am working with, thought it would be nice to see that as an additional option. – Vityata Sep 03 '18 at 13:43
  • @ADyson - most probably the .Net code is not provided, however in the publishing xaml I found what I needed. – Vityata Sep 04 '18 at 15:55

1 Answers1

2

UiPath Studio automatically "translates" the diagrams to :

Thus, the XAML code of the above diagram looks like this:

<Flowchart.Variables>
  <Variable x:TypeArguments="x:Int32" Default="2013" Name="year" />
</Flowchart.Variables>
<Flowchart.StartNode>
  <x:Reference>__ReferenceID3</x:Reference>
</Flowchart.StartNode>
<FlowDecision x:Name="__ReferenceID2" Condition="[year mod 4 = 0]" sap2010:WorkflowViewState.IdRef="FlowDecision_1">
  <FlowDecision.True>
    <FlowStep x:Name="__ReferenceID0" sap2010:WorkflowViewState.IdRef="FlowStep_2">
      <ui:MessageBox ChosenButton="{x:Null}" Buttons="Ok" Caption="It Is" DisplayName="Message box" sap2010:WorkflowViewState.IdRef="MessageBox_2" Text="It Is" TopMost="True" />
    </FlowStep>
  </FlowDecision.True>
  <FlowDecision.False>
    <FlowStep x:Name="__ReferenceID1" sap2010:WorkflowViewState.IdRef="FlowStep_4">
      <ui:MessageBox ChosenButton="{x:Null}" Buttons="Ok" Caption="It Is Not" DisplayName="Message box" sap2010:WorkflowViewState.IdRef="MessageBox_4" Text="It Is Not" TopMost="True" />
    </FlowStep>
  </FlowDecision.False>
</FlowDecision>
Vityata
  • 42,633
  • 8
  • 55
  • 100