Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Make Autotext timestamp better?
#1
Hi, I use an Autotext command to put a timestamp in the text I am working with. It works super. However when I am next to characters and not one space away it will not work. For example Taskts01 (that should of produced “Task1909031438”) will not work, but Task ts01 (it will produce Task 1909031442) does work. How could I make it where It works anywhere next to other text? Thanks


code for Autotext:

Code:
Copy      Help
Autotext [b]Autotext[/b] [help1][/help1]
Trigger [b]$t[/b] [help2][/help2]
[code]/b/i/c
ts01 :mac "MainTS"
ts02 :mac "BasicTS"
[/code]
code for Timestamp:
Code:
Copy      Help
Macro [b]MainTS[/b] [help1][/help1]
[code]DateTime t.FromComputerTime
str sf=t.ToStrFormat("{yyMMdd}{HHmm}")
key (sf)
[/code]
#2
Taskts01 will not work if autotext line is ts01
you can however do a couple things

First, all your code can be put into subfunctions of the autotext list .No external macro or function are needed.
 In the example below i have given you a couple of options.

taskts01 will work when  that is typed fully. Will remove ts01 and replace with the time stamp.

[32]ts01 will work when you type any text then hit spacebar followed by ts01(example: Task ts01 becomes Task1909031902).
the space and ts01 will be replaced with the timestamp.
The [32] means space.

Autotext Autotext
Trigger $t     Help - how to add the trigger to the macro
Code:
Copy      Help
/b/i/c
taskts01 :sub.MainTS2 ;;typed fully then ts01 is removed and replaced with timestamp
[32]ts01 :sub.MainTS ;;timestamp output with no space
ts02 :sub.BasicTs ;; add code to #sub BasicTs below
;ts01 sub.MainTS ;;timestamp output only works with ts01 as text

#sub MainTS
DateTime t.FromComputerTime
str sf=t.ToStrFormat("{yyMMdd}{HHmm}")
paste+ sf

#sub BasicTs
;add code here ts02

#sub MainTS2
str userText;TriggerInfoAutotext userText 0 0
DateTime t.FromComputerTime
str sf=t.ToStrFormat("{yyMMdd}{HHmm}")
userText.replacerx("ts.+" "")
sf- userText
paste+ sf
#3
Hi thanks for the replay. I don't want Taskts01 I want ts01 to work when it is next to another character. I see what you did and I am getting something to work but it still does not work when next to another character. I was only typing Task as the other text it will not flow next to (see vid). Thanks

http://pctechtv.com/extra/forum/quickmac...Better.mp4
#4
I understand what your desire is but it wont work when there is text before the autotext trigger. That's why i showed you the alternatives 
Your best bet is to used this [32]ts01
then you type whatever then spacebar then ts01 and choose option 1.


Autotext Autotext
Trigger $t     Help - how to add the trigger to the macro
Code:
Copy      Help
b/i/c
[32]ts01 :sub.MainTS ;;timestamp output removes space and ts01
ts02 :sub.BasicTs ;; add code to #sub BasicTs below
ts01 :sub.MainTS ;;timestamp output only works with ts01 as text

#sub MainTS
DateTime t.FromComputerTime
str sf=t.ToStrFormat("{yyMMdd}{HHmm}")
paste+ sf

#sub BasicTs
;add code here ts02
#5
Quote:... but it wont work when there is text before the autotext trigger.
OK I figured that could be the problem. I see now with [32] in front that is a good solution. Super helpful, Thank You Smile


Forum Jump:


Users browsing this thread: 1 Guest(s)