Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to output str variable as text?
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!

Copy      Help
str s
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):
Copy      Help
paste s.timeformat("{yyyy-MMdd}")
by use F to format the string then enclosing the string in {}

Macro Macro4
Copy      Help
str f
f = "fox"
out F"What does the {f} say"
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".
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
Copy      Help
;; 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

;;The output has been put in a variable 's'
str y
str s=F"What does the {y} say"

;; Two examples of 'pasting' using "paste" or "setsel"
paste s
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.

Forum Jump:

Users browsing this thread: 1 Guest(s)