Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Using parameter passed from external program
#1
Forgive my ignorance, but I am new to QM and programming in general.

anyway now for my question. i have an external software running which passes a parameter in the format %1, to be used in msdos batch files. The %1 is actually the full path to a file the software has created e.g C:\downloads\filelist.txt.

Is there any way I can import/use this parameter within QM. I would like to set a macro to take the value of %1 and move that file to a dfferent folder.
#2
Hi,

I use a program called Zentimo that can launch programs on USB disk connection.

Here is one which looks like what you look for:

In Zentimo, i put as application to launch -> "c:\program files (x86)\quick macros\qmcl.exe" M "MyFunction" "MyParameter"

In QM, I use a function called "MyFunction", and I get "MyParameter" from Zentimo using QM _command internal variable

It looks like

run "C:\Program Files (x86)\programtolaunch.exe" F" {_command} "

Hope this help.
#3
Thank you for the suggestion Iddarrambide. But I don't understand how I could use this.

I think I posted my question without expaining it too well. The software i need to intercept is "FileWatcher" by Datamystic. This software watches any combination of folders or files for changes/deletions etc when it detects changes it can send output to a msdos batch file or vbs script. For example a batch file such as:

@echo off
echo File %1 has arrived and is ready for processing

pause

Would pop up a cmd window displaying the new or changed file.

What I would like to achieve is use and manipulate the %1 output in QM instead of a batch file.
#4
1. Make a macro named "HandleFilename"
2. In FileWatcher, put as application (instead of batch program): "c:\program files (x86)\quick macros\qmcl.exe" M "HandleFilename" "%1"
3. In macro "HandleFilename", write the code

mes F" {_command} "
out F" {_command} "

Mes is a message box, out writes in the bottom box of code lines.

Not tested as i don't own FileWatcher, but it's a general framework for this.

BTW, function HandleFilename can be triggered by a folder monitoring event and
gives directly file modified, no 3rd party hassle. Look into properties (ctrl+P), trigger of the function, choose file and fill as needed.
You'll have code done automagically by QM like

\
function event $name [$newname]
event: 1 added, 2 removed, 4 renamed, 8 modified -> choose when act
out F"{event} {name}" -> say filename in bottom window

mes F" {name} " (added by me, you can use the filename as wished)


{name} is the filename you can use for action..

HTH
#5
Thank you so much ldarrambide Big Grin , I just had to change the parameter from %1 to %FILE% and your solution works just perfect. I can carry on now and complete the remainder of the macro.

Thank you also for the additional info, As you suggested I already intended to have QM replace FileWatcher totally, once I learn a bit more about it.
#6
Thanks for your kind words.

But Kudos goes first to Gintaras, for making that wonderful toy that QM is,
and don't fear to ask any question here, community is helpful and Gintaras support
awesome.

Good luck for your coding.
#7
Apologies to Gintaras, :oops: no offence intended, I was just grateful for your timely help with which I have now managed to render FileWatcher defunct.

As I said in my original post I am just a beginner with QM, but I am amazed at the ability of this software and the skill of Gintaras.


Forum Jump:


Users browsing this thread: 2 Guest(s)