User Tools

Site Tools


add_incomingvalue_last_lineofscript

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
add_incomingvalue_last_lineofscript [2025/05/20 11:44] – wikiadminadd_incomingvalue_last_lineofscript [2025/05/20 13:52] (current) – [How to add incomingValue; to every script in a .tsx (TransSECS project file)] wikiadmin
Line 26: Line 26:
 } }
 incomingValue; incomingValue;
 +</code>
 +
 +This is also OK (there is an output at the end)
 +<code text>
 +if (incomingValue.getQuality()==0) {
 +  status=2;
 +} else {
 +  status=-1;
 +}
 +status;
 </code> </code>
  
Line 31: Line 41:
  
 This is a change which was implemented in early 2024 so if you have old projects without this final "incomingValue;" you can add this last line in the script manually to every script, or you can use the steps below (please make a copy of your project before doing this in case there is a corruption of the file after the process). This is a change which was implemented in early 2024 so if you have old projects without this final "incomingValue;" you can add this last line in the script manually to every script, or you can use the steps below (please make a copy of your project before doing this in case there is a corruption of the file after the process).
- 
-<note important>Expert Only, Be careful when manually editing project files. Backup your work!</note> 
  
 ===How to add incomingValue; to every script in a .tsx (TransSECS project file)=== ===How to add incomingValue; to every script in a .tsx (TransSECS project file)===
  
- <note important>Important: Please make a copy of your project before making these changes</note>+<note important>Expert Only, Be careful when manually editing project files. Backup your work!</note>
  
 - Make a copy of your project tsx (as a backup) - Make a copy of your project tsx (as a backup)
 - Exit TransSECS (TransSECS should not be running) - Exit TransSECS (TransSECS should not be running)
 - On Windows use Notepad++ to load the project tsx. You can change the language to XML, but this is not necessary - On Windows use Notepad++ to load the project tsx. You can change the language to XML, but this is not necessary
-<note>Note: this is a two pass process. The first step is to mark all existing "incomingValue;" to keep them. The second step is to add "incomingValue;" where they are missing</note> +<note>Note: this is a two pass process. The first step is to mark all existing outputs strings just before the end of the script (any string ending with ";") with <nowiki>  "<!--OK-->" </nowiki> to keep them. The second step is to add "incomingValue;" where they are missing before the end of the script</note> 
-- Use Ctrl-H to bring up the panel for the Find and Replace + 
-- Set up the Replace: +==First Pass: replace all existing "incomingValue;" so these are preserved== 
-  * Search Mode: Regular Expression +  
-  * Find what: +  - Use Ctrl-H to bring up the panel for the Find and Replace 
 +  - Set up the Replace: 
 +     * Search Mode: Regular Expression 
 +     * Find what:<nowiki>  (;)\s*</Script></nowiki>  
 +     * Replace with:<nowiki> \1<!--OK--></Script></nowiki>  
 +  - Execute the replace: Click Replace All 
 + 
 +{{:pasted:20250520-120308.png}} 
 + 
 +What this does is find any string(or just ;) with a ";" just before the end of the script (the </Script> tag) and replaces this with a place holder marking it as "OK". You should see a count on the bottom bar of this panel of how many of these valid strings were found. In the second pass, below, we look for end of script tags (</Script>) which do not end with a ; and fix them: 
 + 
 + 
 + 
 +==Second Pass: add new incomingValue; where needed to end a script (and ignore the incomingValue; already in place) == 
 + 
 + 
 +  - Set up the Replace: 
 +     * Search Mode: Regular Expression 
 +     * Find what: <nowiki> (?<!<!--OK-->)</Script></nowiki>  
 +     * Replace with: incomingValue;</Script> 
 +  - Execute the replace: Click Replace All 
 +  -  
 +{{:pasted:20250520-123447.png}} 
 + 
 +On this last pass you can add a comment to the replacement line, such as incomingValue;<nowiki>  <!--fixed today--></nowiki> , and put today's date in place of "today"
  
 +Note: the OK comment  <nowiki> <!--OK--> </nowiki> and other comments added in these steps will be removed after you load the project into TransSECS and re-save. 
  
-{{:pasted:20250520-104118.png}}+This procedure should help you modify projects using scripts in which there is no output at the end of the script. However, it is good to do a quick check of your project after these changes. Also there can be some casese where incomingValue; is not inserted before the end of the script because the last line in the script ended with a ; and there is no output on that line. For example, if your last line was a DataSource.logMessage("some message"); this will not get an incomingValue; added and logMessage does not return a value so this can still cause the script not to execute the next time it is triggered. If you had a method call on the last line which does return a value then this satisfies the output requirement. Likewise if your last line was a comment such as <nowiki>"//this is a comment"</nowiki> then a new incomingValue; will be added.
  
add_incomingvalue_last_lineofscript.1747755855.txt.gz · Last modified: by wikiadmin

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki