1.

Solve : Batch file that i can run and paste text from?

Answer»

I have tried searching for this but have come up wtih nothing. I have to update tickets at my job with the current date and time like this:: Ticket RECEIVED from company to company at 18 JAN 07 @ 12:15:01. I need to enter this info about 100 times a day and i was wondering if there was a batch file i could run that would allow me to click on it and then go into my program and paste and it would give me the line with the current date and time. does anyone know how i could do this?? Much appreciated.Batch scripts cannot do this, even vbscript wont, a program that can interact with the clipboard is what you need

GrahamHello... I'd create a short macro by using a low cost macro creator/compiler and create a macro such as TimePaste.exe, then you dont need a batch.

An affordable reliable macro recorder that I use is JitBit at http://www.jitbit.com/macrorecorder.aspx

With little work needed to create the macro and compile it, you can make this repetitious task a macro such as naming it TimePaste.exe and save it to your hard drive and reference by a shortcut from your desktop -or- launch the exe directly from your desktop.

When the macro has been created, all you have to do is double-click it and sit back for a second while the macro takes control of your keyboard and mouse.

*** One tip for making a successful macro is to make sure that your macro always starts with the same desktop application environment. Such as if you have your program that needs the Date/Time pasted to it and you have another window for some reason opened above it and the focus is on the different application that that of which is suppose to take the commands from the macro, the macro does not know any better and just moves the mouse to X and Y coordinates and right or left clicks as preprogrammed to do so, no matter what state your system is at when teh macro is launched. Most common problems are if the window position was to change or if referencing to desktop shortcuts or paths that might change in X and Y coordinates when a new file or folder is created or removed and it wants to select X=100 and Y=135, and now the item to launch is at coordinates X=100 Y=65 or something like that. So you might have to recreate and compile a new macro if any changes like that were to happen or go through the complex method of manually editing the macro routine.

This might sound like it will be hard, but it should be easy as long as everything stays the same and processes dont change that affect your macro.

I am guessing that you would PERFORM the following:

1.) Your program will already be launched that requires the date/time passed to it.
2.) You launch your created TimePaste.EXE macro

And the Macro will then do this:

1.) Copy the Date time from the location that you grabbed it from
2.) Paste the Date Time from the clipboard to the program or application requiring the info passed to it.
3.) Then the Macro will end.

You will then have your keyboard and mouse back at this point to continue on.



Quote

I have tried searching for this but have come up wtih nothing. I have to update tickets at my job with the current date and time like this:: Ticket received from company to company at 18 JAN 07 @ 12:15:01. I need to enter this info about 100 times a day and i was wondering if there was a batch file i could run that would allow me to click on it and then go into my program and paste and it would give me the line with the current date and time. does anyone know how i could do this?? Much appreciated.


I could use a batch file and a free utility program to create and write to a text file with the date and time in just about any format, including the one you've asked for.

But, like gpl said, I don't know a way to automate getting it into the clipboard.

You'd have to open that text file with something like Notepad. Highlight, and click Copy. Then you could paste away.

If doing it this way is of any use to me, let me know and I'll show you. Nothing to it.

Got it. - A way to do it by clicking on a batch file.

It works under Win98SE.

You need two free utility programs and a batch file to run them.

1.) Go here: http://www.ferg.org/fdate/
Download Fdate - fdate16a.zip

2.) Go here: http://home.mnet-online.de/horst.muc/wbat32.htm
Download ClipText 1.3 - cliptext.zip

3.) Make a unique folder and unzip them both in it.


4. ) Use the following to make a batch file, and put it in that folder too.

Code: [Select]@echo off
rem Writes output of fdate to text file named datetime.txt
rem Example : 19 Jan 07 @ 12:05:54
rem If datetime.txt already exists, it will be overwritten

fdate /Ff /C"~~D ~n ~y @ ~H:~U:~S" > datetime.txt


rem execute cliptext.exe - have it read datetime.txt to the clipboard
cliptext from datetime.txt



Name the batch file datetime.bat , or whatever you want.



Double click the batch file to run it.
Now try pasting.
Did it work?

Hope so. All I can say is that it worked for me. No guarantees.



Edit: There are extensive docs and examples with Fdate. It can do a lot of different things. There are very short docs with Cliptext. It appears to be a very simple program with only a couple options.

Well then is there a way that i could have an application that i could just open and it would have a line in there that would generate the current time so that i could just highlight it everything and then go in and paste it into my application. If so, does anyone know the command.Quote
Well then is there a way that i could have an application that i could just open and it would have a line in there that would generate the current time so that i could just highlight it everything and then go in and paste it into my application. If so, does anyone know the command.


See above.
That batch file, running fdate with that command line, will create a file named
datetime.txt .

In it is one line.
Example: 19 Jan 07 @ 14:04:21

You could open datetime.txt with Notepad, hightlight, copy, then paste.

But FIRST, you should try using that batch file as written, with cliptext.
It worked fine for me.
Every time I double clicked the batch file, my clipboard was updated so that I could paste the date and time in the above format.... which is what I thought you wanted to be able to do.



Thanks, that worked great. I have one more question. I need to have ticket say: TICKET RECEIVED FROM COMPANY TO COMPANY ON CURRENT DATE @ CURRENT TIME. Let me know if you know where to put that on your code. Anyways thank you very much for that i have been trying to find this for a while.





Quote
Quote
Well then is there a way that i could have an application that i could just open and it would have a line in there that would generate the current time so that i could just highlight it everything and then go in and paste it into my application. If so, does anyone know the command.


See above.
That batch file, running fdate with that command line, will create a file named
datetime.txt .

In it is one line.
Example: 19 Jan 07 @ 14:04:21

You could open datetime.txt with Notepad, hightlight, copy, then paste.

But first, you should try using that batch file as written, with cliptext.
It worked fine for me.
Every time I double clicked the batch file, my clipboard was updated so that I could paste the date and time in the above format.... which is what I thought you wanted to be able to do.



Quote
Thanks, that worked great. I have one more question. I need to have ticket say: TICKET RECEIVED FROM COMPANY TO COMPANY ON CURRENT DATE @ CURRENT TIME. Let me know if you know where to put that on your code. Anyways thank you very much for that i have been trying to find this for a while.


I'm not 100% sure of what you are asking. You need to rephrase it.

In the meantime, if you comment out the fdate line in that batch file, and
use:
Code: [Select]fdate /Ff /C"~~D ~n ~y @ ~H:~U:~S" /P"TICKET RECEIVED FROM COMPANY O COMPANY ON " > datetime.txt

You'll get :
TICKET RECEIVED FROM COMPANY TO COMPANY ON 19 Jan 07 @ 15:00:33

when you paste.
Just a very newbie to this site, thought I'd though a little addition to your batch problem:

At the end of the batch, you can add this line so batch file will open the text file in notepad for you:

start notepad datetime.txtAll of this worked great, I thank you all for your help.

JuppeQuote
All of this worked great, I thank you all for your help.

Juppe


Great!

I thought we'd want to work on that "COMPANY TO COMPANY" part next. But if it good the way it is, that's fine too.



I went in and edited that part of it and figured it out. i just needed to know how to do the date.

JuppeQuote
I went in and edited that part of it and figured it out. i just needed to know how to do the date.

Juppe

Great!

I was expecting that the "company" part would not be a constant. If those were changing, that you'd need to find a way to easily substitute for them.

I'm glad you got it going. I hope it saves you time.








Discussion

No Comment Found