[SOLVED] Populating Variables by user-input

Questions and answers on how to get the most out of FFAStrans
Post Reply
ThomasM
Site Admin
Posts: 231
Joined: Wed Feb 22, 2017 6:36 am

[SOLVED] Populating Variables by user-input

Post by ThomasM »

Hi,

I am wondering if it is possible to populate Variables or input strings in a workflow by the user.

I tried:

Monitor-Folder -> Command-Executor-Node -> Generate text file-Node

Monitor-Folder picks up a .WAV-File

Command-Executor-Node has

Code: Select all

%comspec% /C "
SET /P _ScanName= Please scan barcode from laptop-screen: |
ECHO %_ScanName%
"
and "Set STDOUT VAriable" set to a User-Variable.

Generate Text File-Node prints this User-Variable to a file.

But it does not work; I guess the Piped command jumps over the Console-input. When I delete

Code: Select all

| ECHO %_ScanName%
I can type my string in an opening console. On "Enter" it closes, but the String is not set to the User-Variable.

Any ideas?

tom
Last edited by ThomasM on Wed Apr 01, 2020 1:02 pm, edited 1 time in total.
emcodem
Posts: 1811
Joined: Wed Sep 19, 2018 8:11 am

Re: Populating Variables by user-input

Post by emcodem »

Hi Thomas!

you dont want to use the webinterface for starting the job with user variable? - i mean instead of a watchfolder, let the user select the file in webinterface and input his barcode directly on the webui? If not, which functionality would be missing so you could use the webinterface for that?

Regarding the batch, this should work for you:

Code: Select all

set /P "barcode=Enter Barcode: " && call echo %^barcode%
Another way to integrate this would be to add a "rightclick" menu item instead of a watchfolder...
emcodem, wrapping since 2009 you got the rhyme?
ThomasM
Site Admin
Posts: 231
Joined: Wed Feb 22, 2017 6:36 am

Re: Populating Variables by user-input

Post by ThomasM »

Hey emcodem,

Thank you for your help again!
you dont want to use the webinterface for starting the job with user variable? - i mean instead of a watchfolder, let the user select the file in webinterface and input his barcode directly on the webui? If not, which functionality would be missing so you could use the webinterface for that?
The idea of this Workflow #1 is to automatically observ a folder if there are *.WAV-Files are present. These files are growing. The user initiates a digitasation in REAPER. REAPER immideately writes a *.WAV-File. The user must provide a Name for this file. As the user cannot rename the file while REAPER is digitizing and still writing this file, FFAStrans looks for new files. When a new file appears the workflow will prompt the user to scan the Barcode. This is to be done in max. 10 seconds after starting the digitisation-process as the user otherwise will skip naming. So this litle workflow will be set to 5 seconds in the properties.

Workflow #2 watches the files until they stop growing. this is set to some minutes in the properties. When growing stopped this workflow #2 will xxHash and rename (reading the Barcode-Name from the GenerateText-Node of Workflow #1) the original, writing a JSON-LOG and Move (copy / del) it to a further processing.
Regarding the batch, this should work for you:
I tried this, but it does not work.

Code: Select all

set /P "barcode=Enter Barcode: " && call echo %^barcode%
Is the ^ correct? I killed it, but no result.
I tried to get behind the secret of && call echo, but I cannot really find information about this chaining-method... :(

I attach the workflow:
input test.json
(3.63 KiB) Downloaded 368 times
so long,
Thomas
emcodem
Posts: 1811
Joined: Wed Sep 19, 2018 8:11 am

Re: Populating Variables by user-input

Post by emcodem »

OK, no webinterface then hehe...

Sorry i only tried on commandline... that dont work because sending STDOUT to a variable can only work when you don't check "show console". To be honest it is not really foreseen to work that way as ffastrans should run as a background service in production environments, the "show console" is more for debugging purpose i guess. Thats why i wanted you to use a different way than showing a cmd window. I already opened a discussion about ffastrans native support for getting userinputs in jobs internally.

What you can do is to get rid of the write file node and redirect the value directly in the batch:

Code: Select all

%comspec% /C "set /P "barcode=Enter Barcode: " && call echo %^barcode% > "%s_original_path%\%s_original_name%.log""
in batch we use && to write multiple serial commands in one line, as easy as that. and the circumflex ^ is somehow needed for the variable expansion, i just copied the stuff from some stackoverflow page, not a pro in batching myself ;-)
emcodem, wrapping since 2009 you got the rhyme?
ThomasM
Site Admin
Posts: 231
Joined: Wed Feb 22, 2017 6:36 am

Re: Populating Variables by user-input

Post by ThomasM »

That´s it!

works perfectly!

And many thanks for clearing things up with the && and ^.

Mission accomplished

all the best,
tom
Post Reply