Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Run different variables accordingly
#2
You can make just single macro. It woul pick these filenames/bframes/eframes from a list. Then I need to know in what media and format is (or will be) the list? Is it a text file, Excel sheet, ... ? Or you would like to enter these values in a dialog at the run time? Or ...

Of course, you can create multiple macros, but then better would be to place the code in a function. Then each macro would be only single line. Or, you could place all in single menu or toolbar. Create function Maxbear_1 and paste this code using menu Edit -> Other formats -> Paste escaped:

Code:
Copy      Help
;/
function str'filename str'bframe str'eframe

;Space and slash at the beginning prevents the function from executing if you accidentally press the Run button. This function only can be called from a macro or function.
;filename, bframe and eframe are local string variables that are populated when the function is called.


spe -1 ;;set speed to the default macro speed

;In QM, variables cannot be inserted directly into quoted strings like in php.
;Instead, are used str functions "format" or "from" to create the final string. You can use the Text dialog (select "Text with variables").


str s1 s2 ;;create two string variables
s1.format("--load G:\files\av\divx\%s --begin %s --end %s" filename bframe eframe) ;;format is better when there are many variables and text between. %s in the first string are replaced with values of the variables.
s2.from("Avidemux 2 " filename) ;;from is easier to use, and is better to join two or three strings, although can be used to join more strings and numeric values.

run "F:\Program Files\Avidemux\avidemux2.exe" s1
wait 15
act win(s2 "gdkWindowToplevel")
'Cs
5 win("Select file to save " "gdkWindowToplevel")
'(filename)DTTTY ;;here string variable can be inserted by enclosing in ()
ifa win("GDK client window" "gdkWindowToplevel")
,'RY
ifa win("Q Factor (set 4)" "gdkWindowToplevel")
,'RB3TTY
wait 0 WV "GDK client window"
'Y
lef 358 21 win(s2 "gdkWindowToplevel")
'Cq

Each macro would look like this:

Code:
Copy      Help
Maxbear_1 "test.txt" "abc" "xyz"

Instead of using multiple macros, you could use single menu or toolbar, like this:

Code:
Copy      Help
test :Maxbear_1 "test.txt" "abc" "xyz"
test2 :Maxbear_1 "test2.txt" "abc2" "xyz2"
test3 :Maxbear_1 "test3.txt" "abc3" "xyz3"


Messages In This Thread

Forum Jump:


Users browsing this thread: 3 Guest(s)