openmolecules.org

 
Home » DataWarrior » Functionality » number of visible rows into macro saving variable (It is possible to read the number of the visible rows into a macro variable?)
number of visible rows into macro saving variable [message #2271] Tue, 06 August 2024 14:12 Go to next message
juliocoll is currently offline  juliocoll
Messages: 35
Registered: January 2023
Location: Madrid SPAIN
Member
dear Thomas,

When working with many different and long dwar files, it will be very helpful to automatically include the visible or total number of rows into their saving name files. I am doing it manually now and often run into some confusions.

For instance: In one XXX experiment, a file of 3356_XXX rows is filtered to 2459_XXX rows and then with another filter to 1567_XXX rows, etc, etc. All nth files require independently saving n names maintaining the same XXX label to differentiate those from other experiments.

Perhaps their corresponding visible number or total number are included into some variables (as they show up at the bottom of the DW) that could be added to saving into the macros either at the fileName=#ask# command, or at the following fileType=dwar command.

Perhaps something like:
fileName=Visible + #ask# or
prefileName=Visible or
something else............?

Thank you for your help and attention,
sincerly
julio


Julio Coll
Profesor de Investigación. Emérito
Dpt.Biotecnología
CSIC-centro Nacional INIA, Madrid, SPAIN
Dr. Biologia Univ.Comp(UCM). Madrid, Spain
PHD. Biology Mass.Inst,Technol (MIT). Massachusetts, USA
orcid: 0000-0001-8496-3493
Re: number of visible rows into macro saving variable [message #2360 is a reply to message #2271] Fri, 20 December 2024 09:56 Go to previous messageGo to next message
juliocoll is currently offline  juliocoll
Messages: 35
Registered: January 2023
Location: Madrid SPAIN
Member
In numerous attempts to automatically get a row number to be included into the dwar file name (to be saved inside a DW macro), I got the following "best behaviour":

<macro name="SaveRowCount">
<task name="defineVariable">
name=rowcount
</task>
<task name="showMessage">
message=$rowcount
</task>
<task name="saveFileAs">
fileName=E:\$rowcount.dwar
fileType=dwar
</task>
</macro>

The rowcount name was kindly provided by Norwid B as one of the defined dwar file properties. The showMessage confirms the new name of the file which is then saved on the included dir.......
However, everytime I need to type the rowcount value and give any dir address in the fileName. I would like those to be automatically included to avoid any mistakes !!!!

I tried alternatives to use getRowCount(Wink, PROPERTY_LINE_COUNT, lastRow, etc,.. No sucess.
Any ideas?

MERRY CHRISTMAS !
julio


Julio Coll
Profesor de Investigación. Emérito
Dpt.Biotecnología
CSIC-centro Nacional INIA, Madrid, SPAIN
Dr. Biologia Univ.Comp(UCM). Madrid, Spain
PHD. Biology Mass.Inst,Technol (MIT). Massachusetts, USA
orcid: 0000-0001-8496-3493
Re: number of visible rows into macro saving variable [message #2361 is a reply to message #2360] Sun, 22 December 2024 19:20 Go to previous message
nbehrnd is currently offline  nbehrnd
Messages: 229
Registered: June 2019
Senior Member
Dear Thomas,

in the user case described above by Julio, one approach I pursued let DataWarrior complete its work and subsequently (when DataWarrior wasn't running any more) renamed the exported .dwar or .sdf files with a Python script (cf. attached scripts).

However, it is somewhat _post factum est_. Independent from Julio's feature request to access variable `rowcount` already written into the .dwar files to become an accessible item in the macro editor, I started to wonder if the macro editor could be extended further. Namely by one entry which would i) allow the dwam macro to launch a script (for instance, but not limited to Python), or an compiled executable outside DW, ii) await this assistant to complete its sub task, before iii) continue with actions defined in the .dwam macro. Something similar to the `system()` command in AWK, or `subprocess.Popen` in Python -- if there were an equivalent in Java.

With best regards,

Norwid
Previous Topic: macro comments
Next Topic: Datawarrior Commandline Option to Use Template
Goto Forum:
  


Current Time: Tue Feb 11 02:20:27 CET 2025

Total time taken to generate the page: 0.03346 seconds