两个动作,第一步操作区别,导致变量在字符串拼接一次后,变量值就被清空

动作开发 · 674 次浏览
晓风斩柳 创建于 2023-07-26 09:31

动作一,从编辑器光标处取行文本,然后删除编辑器该行

动作二,通过弹出输入框,取得输入文本

例如 文本值 

          bool IsOld;

后续动作

   正则解析文本,获取2个文本值 mtype  mvalue

        分别为 bool  和  IsOld   

   拼接文本,发送到文本编辑器

拼接规则

$$/// <summary>
/// 
/// </summary>
public {mtype}{mvalue}
{
    get => _{mvalue};
    set => this.RaiseAndSetIfChanged(ref _{mvalue}, value);
}
private {mtype} _{mvalue};

结果1:

    /// <summary>
    /// 
    /// </summary>
    public bool IsOld
    {
        get => _IsOld;
        set => this.RaiseAndSetIfChanged(ref _IsOld, value);
    }
    private bool _IsOld;

结果2:

    /// <summary>
    /// 
    /// </summary>
    public bool IsOld
    {
        get => _;
        set => this.RaiseAndSetIfChanged(ref _, value);
    }
    private bool _;

动作一

{
  "Row": 0,
  "Col": 3,
  "ActionType": 24,
  "Title": "WPFBind",
  "Description": "WPF UI绑定属性生成辅助器",
  "Icon": "",
  "Path": null,
  "DelayMs": 0,
  "Data": "{\"LimitSingleInstance\":true,\"SummaryExpression\":\"\",\"SubPrograms\":[],\"Variables\":[{\"Key\":\"text\",\"Type\":0,\"Desc\":\"默认的文本变量\",\"DefaultValue\":\"\",\"SaveState\":false,\"IsInput\":false,\"IsOutput\":false,\"ParamName\":null,\"InputParamInfo\":null,\"OutputParamInfo\":null,\"TableDef\":null,\"CustomType\":null},{\"Key\":\"selecttext\",\"Type\":0,\"Desc\":\"\",\"DefaultValue\":\"\",\"SaveState\":false,\"IsInput\":false,\"IsOutput\":false,\"ParamName\":\"\",\"InputParamInfo\":null,\"OutputParamInfo\":null,\"TableDef\":null,\"CustomType\":null},{\"Key\":\"head1\",\"Type\":0,\"Desc\":\"\",\"DefaultValue\":\"\",\"SaveState\":false,\"IsInput\":false,\"IsOutput\":false,\"ParamName\":\"\",\"InputParamInfo\":null,\"OutputParamInfo\":null,\"TableDef\":null,\"CustomType\":null},{\"Key\":\"mtype\",\"Type\":0,\"Desc\":\"\",\"DefaultValue\":\"\",\"SaveState\":false,\"IsInput\":false,\"IsOutput\":false,\"ParamName\":\"\",\"InputParamInfo\":null,\"OutputParamInfo\":null,\"TableDef\":null,\"CustomType\":null},{\"Key\":\"mvalue\",\"Type\":0,\"Desc\":\"\",\"DefaultValue\":\"\",\"SaveState\":false,\"IsInput\":false,\"IsOutput\":false,\"ParamName\":\"\",\"InputParamInfo\":null,\"OutputParamInfo\":null,\"TableDef\":null,\"CustomType\":null},{\"Key\":\"matchs\",\"Type\":99,\"Desc\":\"\",\"DefaultValue\":\"\",\"SaveState\":false,\"IsInput\":false,\"IsOutput\":false,\"ParamName\":\"\",\"InputParamInfo\":null,\"OutputParamInfo\":null,\"TableDef\":null,\"CustomType\":null},{\"Key\":\"isSuccess\",\"Type\":2,\"Desc\":\"\",\"DefaultValue\":\"\",\"SaveState\":false,\"IsInput\":false,\"IsOutput\":false,\"ParamName\":\"\",\"InputParamInfo\":null,\"OutputParamInfo\":null,\"TableDef\":null,\"CustomType\":null},{\"Key\":\"codes\",\"Type\":0,\"Desc\":\"\",\"DefaultValue\":\"\",\"SaveState\":false,\"IsInput\":false,\"IsOutput\":false,\"ParamName\":\"\",\"InputParamInfo\":null,\"OutputParamInfo\":null,\"TableDef\":null,\"CustomType\":null}],\"Steps\":[{\"StepRunnerKey\":\"sys:getSelectedText\",\"InputParams\":{\"format\":{\"VarKey\":null,\"Value\":\"UnicodeText\"},\"repeat\":{\"VarKey\":null,\"Value\":\"3\"},\"useActionParam\":{\"VarKey\":null,\"Value\":\"0\"},\"stopIfFail\":{\"VarKey\":null,\"Value\":\"1\"}},\"OutputParams\":{\"output\":\"selecttext\",\"outputEncoded\":null,\"url\":null,\"isSuccess\":null},\"IfSteps\":null,\"ElseSteps\":null,\"Note\":\"\",\"Disabled\":false,\"Collapsed\":false,\"DelayMs\":0},{\"StepRunnerKey\":\"sys:regexExtract\",\"InputParams\":{\"getGroup\":{\"VarKey\":null,\"Value\":\"1\"},\"data\":{\"VarKey\":null,\"Value\":\"$${selecttext}\"},\"pattern\":{\"VarKey\":null,\"Value\":\"^[\\\\s]+([a-zA-Z0-9<>]+[\\\\s]+)([\\\\w]+);\"},\"ignoreCase\":{\"VarKey\":null,\"Value\":\"0\"},\"singleLine\":{\"VarKey\":null,\"Value\":\"0\"},\"multiLine\":{\"VarKey\":null,\"Value\":\"0\"},\"rightToLeft\":{\"VarKey\":null,\"Value\":\"0\"},\"stopIfFail\":{\"VarKey\":null,\"Value\":\"1\"}},\"OutputParams\":{\"matches\":null,\"match1 \":\"mtype\",\"match2 \":\"mvalue\",\"match3 \":null,\"match4 \":null,\"match5 \":null,\"matchObj\":null,\"isSuccess\":\"isSuccess\"},\"IfSteps\":null,\"ElseSteps\":null,\"Note\":\"\",\"Disabled\":false,\"Collapsed\":false,\"DelayMs\":0},{\"StepRunnerKey\":\"sys:keyInput\",\"InputParams\":{\"keys\":{\"VarKey\":null,\"Value\":\"{\\\"CtrlKeys\\\":[162,160],\\\"Keys\\\":[75]}\"}},\"OutputParams\":{},\"IfSteps\":null,\"ElseSteps\":null,\"Note\":\"删除原来行\",\"Disabled\":false,\"Collapsed\":false,\"DelayMs\":0},{\"StepRunnerKey\":\"sys:outputText\",\"InputParams\":{\"content\":{\"VarKey\":null,\"Value\":\"$$/// <summary>\\r\\n/// \\r\\n/// </summary>\\r\\npublic {mtype}{mvalue}\\r\\n{\\r\\n\\tget => _{mvalue};\\r\\n\\tset => this.RaiseAndSetIfChanged(ref _{mvalue}, value);\\r\\n}\\r\\nprivate {mtype} _{mvalue};\\r\\n\"},\"method\":{\"VarKey\":null,\"Value\":\"paste\"},\"delayBeforePaste\":{\"VarKey\":null,\"Value\":\"50\"},\"delayAfterPaste\":{\"VarKey\":null,\"Value\":\"10\"},\"appendReturn\":{\"VarKey\":null,\"Value\":\"0\"}},\"OutputParams\":{},\"IfSteps\":null,\"ElseSteps\":null,\"Note\":\"\",\"Disabled\":false,\"Collapsed\":false,\"DelayMs\":0},{\"StepRunnerKey\":\"sys:delay\",\"InputParams\":{\"delayMs\":{\"VarKey\":null,\"Value\":\"50\"},\"monitorWaitWin\":{\"VarKey\":null,\"Value\":\"0\"}},\"OutputParams\":{},\"IfSteps\":null,\"ElseSteps\":null,\"Note\":\"\",\"Disabled\":false,\"Collapsed\":false,\"DelayMs\":0},{\"StepRunnerKey\":\"sys:keyInput\",\"InputParams\":{\"keys\":{\"VarKey\":null,\"Value\":\"{\\\"CtrlKeys\\\":[162],\\\"Keys\\\":[75,68]}\"}},\"OutputParams\":{},\"IfSteps\":null,\"ElseSteps\":null,\"Note\":\"\",\"Disabled\":false,\"Collapsed\":false,\"DelayMs\":0},{\"StepRunnerKey\":\"sys:delay\",\"InputParams\":{\"delayMs\":{\"VarKey\":null,\"Value\":\"50\"},\"monitorWaitWin\":{\"VarKey\":null,\"Value\":\"0\"}},\"OutputParams\":{},\"IfSteps\":null,\"ElseSteps\":null,\"Note\":\"\",\"Disabled\":false,\"Collapsed\":false,\"DelayMs\":0},{\"StepRunnerKey\":\"sys:keyInput\",\"InputParams\":{\"keys\":{\"VarKey\":null,\"Value\":\"{\\\"CtrlKeys\\\":[162],\\\"Keys\\\":[83]}\"}},\"OutputParams\":{},\"IfSteps\":null,\"ElseSteps\":null,\"Note\":\"\",\"Disabled\":false,\"Collapsed\":false,\"DelayMs\":0},{\"StepRunnerKey\":\"sys:keyInput\",\"InputParams\":{\"keys\":{\"VarKey\":null,\"Value\":\"{\\\"CtrlKeys\\\":[],\\\"Keys\\\":[38]}\"},\"repeat\":{\"VarKey\":null,\"Value\":\"8\"},\"interval\":{\"VarKey\":null,\"Value\":\"1\"},\"holdMs\":{\"VarKey\":null,\"Value\":\"-1\"}},\"OutputParams\":{},\"IfSteps\":null,\"ElseSteps\":null,\"Note\":\"\",\"Disabled\":false,\"Collapsed\":false,\"DelayMs\":0},{\"StepRunnerKey\":\"sys:keyInput\",\"InputParams\":{\"keys\":{\"VarKey\":null,\"Value\":\"{\\\"CtrlKeys\\\":[],\\\"Keys\\\":[35]}\"},\"repeat\":{\"VarKey\":null,\"Value\":\"1\"},\"interval\":{\"VarKey\":null,\"Value\":\"1\"},\"holdMs\":{\"VarKey\":null,\"Value\":\"-1\"}},\"OutputParams\":{},\"IfSteps\":null,\"ElseSteps\":null,\"Note\":\"\",\"Disabled\":false,\"Collapsed\":false,\"DelayMs\":0}]}",
  "Data2": null,
  "Data3": null,
  "Children": [],
  "Id": "807f4e49-820c-4f5e-8a40-cd5444ba5d28",
  "TemplateId": "17974c14-2b50-4b90-9411-08d9620ff65a",
  "TemplateRevision": 1,
  "UseTemplate": false,
  "LastEditTimeUtc": "2023-07-21T09:46:22.9901323+08:00",
  "SharedActionId": "",
  "ShareTimeUtc": null,
  "CreateTimeUtc": "2023-07-20T02:00:19.7433471Z",
  "AsSubProgram": false,
  "SkipWhenStopRunningActions": false,
  "SkipCheckUpdate": false,
  "AutoUpdate": false,
  "KeepInfoWhenUpdate": false,
  "MinQuickerVersion": "",
  "ContextMenuData": "",
  "AllowScrollTrigger": false,
  "EnableEvaluateVariable": false,
  "IsTextProcessor": false,
  "IsImageProcessor": false,
  "Association": {
    "MatchProcess": null,
    "IsImageProcessor": false,
    "ReturnImageFromFirstScreenShotStep": true,
    "IsTextProcessor": false,
    "ReturnTextFromGetSelectedTextStep": true,
    "TextMatchExpression": "",
    "TextMinLength": 0,
    "TextMaxLength": 0,
    "IsHtmlProcessor": false,
    "IsFileProcessor": false,
    "FileMinCount": 0,
    "FileMaxCount": 0,
    "AllowedFileExtensions": "",
    "RequireAllFileMatchExt": false,
    "SearchBoxPlaceholder": "",
    "IsWindowProcessor": false,
    "EnableRealtimeSearch": false,
    "BrowserContextMenu": null,
    "UrlPattern": ""
  },
  "DoNotClosePanel": false,
  "UserLimitation": null
}

 

动作二

{
  "Row": 1,
  "Col": 3,
  "ActionType": 24,
  "Title": "代码模板1",
  "Description": "",
  "Icon": "fa:Brands_Mixcloud",
  "Path": null,
  "DelayMs": 0,
  "Data": "{\"LimitSingleInstance\":true,\"SummaryExpression\":\"$$\",\"SubPrograms\":[],\"Variables\":[{\"Key\":\"text\",\"Type\":0,\"Desc\":\"默认的文本变量\",\"DefaultValue\":\"\",\"SaveState\":false,\"IsInput\":false,\"IsOutput\":false,\"ParamName\":null,\"InputParamInfo\":null,\"OutputParamInfo\":null,\"TableDef\":null,\"CustomType\":null},{\"Key\":\"textValue\",\"Type\":0,\"Desc\":\"\",\"DefaultValue\":\"\",\"SaveState\":false,\"IsInput\":false,\"IsOutput\":false,\"ParamName\":\"\",\"InputParamInfo\":null,\"OutputParamInfo\":null,\"TableDef\":null,\"CustomType\":null},{\"Key\":\"isEmpty\",\"Type\":2,\"Desc\":\"\",\"DefaultValue\":\"\",\"SaveState\":false,\"IsInput\":false,\"IsOutput\":false,\"ParamName\":\"\",\"InputParamInfo\":null,\"OutputParamInfo\":null,\"TableDef\":null,\"CustomType\":null},{\"Key\":\"m_type\",\"Type\":0,\"Desc\":\"\",\"DefaultValue\":\"\",\"SaveState\":false,\"IsInput\":false,\"IsOutput\":false,\"ParamName\":\"\",\"InputParamInfo\":null,\"OutputParamInfo\":null,\"TableDef\":null,\"CustomType\":null},{\"Key\":\"m_value\",\"Type\":0,\"Desc\":\"\",\"DefaultValue\":\"\",\"SaveState\":false,\"IsInput\":false,\"IsOutput\":false,\"ParamName\":\"\",\"InputParamInfo\":null,\"OutputParamInfo\":null,\"TableDef\":null,\"CustomType\":null},{\"Key\":\"txt_list\",\"Type\":4,\"Desc\":\"\",\"DefaultValue\":\"\",\"SaveState\":false,\"IsInput\":false,\"IsOutput\":false,\"ParamName\":\"\",\"InputParamInfo\":null,\"OutputParamInfo\":null,\"TableDef\":null,\"CustomType\":null},{\"Key\":\"pub_value\",\"Type\":0,\"Desc\":\"\",\"DefaultValue\":\"\",\"SaveState\":false,\"IsInput\":false,\"IsOutput\":false,\"ParamName\":\"\",\"InputParamInfo\":null,\"OutputParamInfo\":null,\"TableDef\":null,\"CustomType\":null},{\"Key\":\"prv_value\",\"Type\":0,\"Desc\":\"\",\"DefaultValue\":\"\",\"SaveState\":false,\"IsInput\":false,\"IsOutput\":false,\"ParamName\":\"\",\"InputParamInfo\":null,\"OutputParamInfo\":null,\"TableDef\":null,\"CustomType\":null},{\"Key\":\"result_value\",\"Type\":0,\"Desc\":\"\",\"DefaultValue\":\"\",\"SaveState\":false,\"IsInput\":false,\"IsOutput\":false,\"ParamName\":\"\",\"InputParamInfo\":null,\"OutputParamInfo\":null,\"TableDef\":null,\"CustomType\":null}],\"Steps\":[{\"StepRunnerKey\":\"sys:userInput\",\"InputParams\":{\"type\":{\"VarKey\":null,\"Value\":\"text\"},\"prompt\":{\"VarKey\":null,\"Value\":\"请输入内容\"},\"defaultValue\":{\"VarKey\":null,\"Value\":\"\"},\"pattern\":{\"VarKey\":null,\"Value\":\"\"},\"isRequired\":{\"VarKey\":null,\"Value\":\"1\"},\"restoreFocus\":{\"VarKey\":null,\"Value\":\"1\"},\"closeOnDeactivated\":{\"VarKey\":null,\"Value\":\"0\"},\"topMost\":{\"VarKey\":null,\"Value\":\"0\"},\"stopIfFail\":{\"VarKey\":null,\"Value\":\"1\"},\"texttools\":{\"VarKey\":null,\"Value\":\"\"},\"fontfamily\":{\"VarKey\":null,\"Value\":\"\"},\"fontsize\":{\"VarKey\":null,\"Value\":\"14\"},\"winLocation\":{\"VarKey\":null,\"Value\":\"CenterScreen\"},\"imeState\":{\"VarKey\":null,\"Value\":\"NO_CONTROL\"},\"help\":{\"VarKey\":null,\"Value\":\"\"}},\"OutputParams\":{\"isSuccess\":null,\"textValue\":\"textValue\",\"isEmpty\":null},\"IfSteps\":null,\"ElseSteps\":null,\"Note\":\"\",\"Disabled\":false,\"Collapsed\":false,\"DelayMs\":0},{\"StepRunnerKey\":\"sys:regexExtract\",\"InputParams\":{\"getGroup\":{\"VarKey\":null,\"Value\":\"0\"},\"data\":{\"VarKey\":null,\"Value\":\"$${textValue}\"},\"pattern\":{\"VarKey\":null,\"Value\":\"^([a-zA-Z0-9<>]+[\\\\s]+)([\\\\w]+);\"},\"ignoreCase\":{\"VarKey\":null,\"Value\":\"false\"},\"singleLine\":{\"VarKey\":null,\"Value\":\"false\"},\"multiLine\":{\"VarKey\":null,\"Value\":\"false\"},\"rightToLeft\":{\"VarKey\":null,\"Value\":\"false\"},\"stopIfFail\":{\"VarKey\":null,\"Value\":\"1\"}},\"OutputParams\":{\"matches\":null,\"match1 \":\"m_type\",\"match2 \":\"m_value\",\"match3 \":null,\"match4 \":null,\"match5 \":null,\"matchesCollection\":null,\"isSuccess\":null},\"IfSteps\":null,\"ElseSteps\":null,\"Note\":\"\",\"Disabled\":false,\"Collapsed\":false,\"DelayMs\":0},{\"StepRunnerKey\":\"sys:outputText\",\"InputParams\":{\"content\":{\"VarKey\":null,\"Value\":\"$$public {m_type}{m_value}\\r\\n{\\r\\n\\tget => _{m_value};\\r\\n\\tset => this.RaiseAndSetIfChanged(ref _{m_value}, value);\\r\\n}\\r\\nprivate {m_type} _{m_value};\"},\"method\":{\"VarKey\":null,\"Value\":\"paste\"},\"delayBeforePaste\":{\"VarKey\":null,\"Value\":\"50\"},\"delayAfterPaste\":{\"VarKey\":null,\"Value\":\"10\"},\"appendReturn\":{\"VarKey\":null,\"Value\":\"0\"}},\"OutputParams\":{},\"IfSteps\":null,\"ElseSteps\":null,\"Note\":\"\",\"Disabled\":false,\"Collapsed\":false,\"DelayMs\":0},{\"StepRunnerKey\":\"sys:delay\",\"InputParams\":{\"delayMs\":{\"VarKey\":null,\"Value\":\"50\"},\"monitorWaitWin\":{\"VarKey\":null,\"Value\":\"0\"}},\"OutputParams\":{},\"IfSteps\":null,\"ElseSteps\":null,\"Note\":\"\",\"Disabled\":false,\"Collapsed\":false,\"DelayMs\":0},{\"StepRunnerKey\":\"sys:keyInput\",\"InputParams\":{\"keys\":{\"VarKey\":null,\"Value\":\"{\\\"CtrlKeys\\\":[162],\\\"Keys\\\":[75,68]}\"},\"repeat\":{\"VarKey\":null,\"Value\":\"1\"},\"interval\":{\"VarKey\":null,\"Value\":\"1\"},\"holdMs\":{\"VarKey\":null,\"Value\":\"-1\"}},\"OutputParams\":{},\"IfSteps\":null,\"ElseSteps\":null,\"Note\":\"\",\"Disabled\":false,\"Collapsed\":false,\"DelayMs\":0},{\"StepRunnerKey\":\"sys:delay\",\"InputParams\":{\"delayMs\":{\"VarKey\":null,\"Value\":\"50\"},\"monitorWaitWin\":{\"VarKey\":null,\"Value\":\"0\"}},\"OutputParams\":{},\"IfSteps\":null,\"ElseSteps\":null,\"Note\":\"\",\"Disabled\":false,\"Collapsed\":false,\"DelayMs\":0},{\"StepRunnerKey\":\"sys:keyInput\",\"InputParams\":{\"keys\":{\"VarKey\":null,\"Value\":\"{\\\"CtrlKeys\\\":[162],\\\"Keys\\\":[83]}\"},\"repeat\":{\"VarKey\":null,\"Value\":\"1\"},\"interval\":{\"VarKey\":null,\"Value\":\"1\"},\"holdMs\":{\"VarKey\":null,\"Value\":\"-1\"}},\"OutputParams\":{},\"IfSteps\":null,\"ElseSteps\":null,\"Note\":\"\",\"Disabled\":false,\"Collapsed\":false,\"DelayMs\":0}]}",
  "Data2": null,
  "Data3": null,
  "Children": null,
  "Id": "77aa7103-bf97-47a0-b9dc-087b6912c7b1",
  "TemplateId": null,
  "TemplateRevision": 0,
  "UseTemplate": false,
  "LastEditTimeUtc": "2023-07-20T02:07:06.9210005+08:00",
  "SharedActionId": "",
  "ShareTimeUtc": null,
  "CreateTimeUtc": "2023-07-20T02:05:27.220396Z",
  "AsSubProgram": false,
  "SkipWhenStopRunningActions": false,
  "SkipCheckUpdate": false,
  "AutoUpdate": false,
  "KeepInfoWhenUpdate": false,
  "MinQuickerVersion": "",
  "ContextMenuData": "",
  "AllowScrollTrigger": false,
  "EnableEvaluateVariable": false,
  "IsTextProcessor": false,
  "IsImageProcessor": false,
  "Association": {
    "MatchProcess": null,
    "IsImageProcessor": false,
    "ReturnImageFromFirstScreenShotStep": true,
    "IsTextProcessor": false,
    "ReturnTextFromGetSelectedTextStep": true,
    "TextMatchExpression": "",
    "TextMinLength": 0,
    "TextMaxLength": 0,
    "IsHtmlProcessor": false,
    "IsFileProcessor": false,
    "FileMinCount": 0,
    "FileMaxCount": 0,
    "AllowedFileExtensions": "",
    "RequireAllFileMatchExt": false,
    "SearchBoxPlaceholder": "",
    "IsWindowProcessor": false,
    "EnableRealtimeSearch": false,
    "BrowserContextMenu": null,
    "UrlPattern": ""
  },
  "DoNotClosePanel": false,
  "UserLimitation": null
}

 


回复内容
CL 2023-07-26 09:43
#1

看不太懂。

遇到问题可以尝试右键调试运行,对每一步进行分析。

晓风斩柳 回复 CL 2023-08-01 11:14 :

两个动作想要实现的输出结果是一样的;但是动作2使用弹窗输入,将输入作为源文本,后续两个动作流程一致,最终输出结果却和动作1不一致;动作2字符串拼接的时候,后4变量没有拼接进去。 最后一步拼接文本没有正常拼接,怎么调试?

晓风斩柳 最后更新于 2023-08-01 11:17
CL 回复 晓风斩柳 2023-08-01 11:43 :

网页顶部的搜索框,输入 "调试运行" 

晓风斩柳 回复 CL 2023-08-01 13:10 :
晓风斩柳 最后更新于 2023-08-01 13:14
CL 回复 晓风斩柳 2023-08-01 14:35 :

你需要根据自己的思路来判断具体哪一步不符合预期。 别人并不了解你的思路,也很难看懂调试文件。

如果定位到了不符合预期的步骤又搞不懂,就截图一下步骤,说明预期的结果。

瞑空凌 2023-08-01 14:05
#2

大佬求解

为啥你们的代码都带有这个?🤔,有啥用意?

/// <summary>
/// 
/// </summary>

乐昂岚【接定制】 回复 瞑空凌 2023-08-01 14:14 :

不用管,大概是默认的,不过被注释了

瞑空凌 2023-08-01 14:19 :

我在文档经常看到,主要是看到大佬代码带有这个却又没写说明,所以不理解。😂

回复主贴