Posts: 3
Threads: 1
Joined: Mar 2014
Noobie here, non-programmer.
Please help me understand my error in this macro. It is intended to produce the current date with format 2014-0303. Thank you!
str s
s.timeformat("{yyyy-MMdd}")
s ;; output date as 2014-0405
The error message says
Error in yyyy-MMdd: syntax.
-------
EDIT: Ok, now I realize that the error is in the third line. So my new question is "How can I output the formatted date (or any string variable) as text?"
-------
EDIT 2: Got it (condensing the last two lines into one):
paste s.timeformat("{yyyy-MMdd}")
Posts: 25
Threads: 12
Joined: Aug 2012
by use F to format the string then enclosing the string in {}
Macro
Macro4
str f
f = "fox"
out F"What does the {f} say"
Posts: 3
Threads: 1
Joined: Mar 2014
j0nezn Wrote:by use F to format the string then enclosing the string in {}
What function is F? I can't find it in the help file.
Also, my specific need was to output the string variable as text. Thus I needed "paste" instead of "out".
Posts: 763
Threads: 261
Joined: Jul 2012
You can find more info about the operator 'F' in the help.
Using the 'help search':
Strings with variables
Or navigating to it manually:
Variables, constants, numbers, strings >>
Strings with variables
The 'out' was to show that the '{f}' contents => "fox"
You can put everything after the 'out' in a variable.
Once have the desired contents in you variable, in this case 'f' you can do pretty much anything with it.
If you want to paste:
Macro
Macro37
;; Placed a 3 second pause if you wanted to run this macro
;; It gives you time to put the mouse pointer/cursor on a desired location
3
;;The output has been put in a variable 's'
str y
y="fox"
str s=F"What does the {y} say"
;; Two examples of 'pasting' using "paste" or "setsel"
paste s
s.setsel
Posts: 3
Threads: 1
Joined: Mar 2014
r0n: Thanks very much for the expanded explanation more suitable for a noobie such as myself. QM has a pretty steep learning curve for non-programmers; nearly everything in the Help file or this forum assumes significant background knowledge, so it is difficult to break in.
If anyone can recommend a simple introduction to the general task of programming (that is, starting from the very basics such as terminology and foundational concepts) I'd be grateful.