Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding macros to application and saving for future use

Status
Not open for further replies.

tippo

Technical User
Mar 2, 2002
9
US
I have a application i use every day and i find that there are several hot key i need daily so is there a way to save them in the application for future use(foxpro 2.6 windows)
 
Are you asking as an application user or as an application developer?

If as a user, then the application will need to be modified to accept the user's input in some manner and to store it away for use during subsequent times of usage. The program can be modified to have ON KEY LABEL and/or ON KEY commands used to allow the user's stored entries to be executed (typically via Function keys).


As a developer you can use the
Program | Macros....
from the top level menu to record your keystrokes which will be executed when the assigned Function key is used.

Good Luck,
jrbbldr
jrbbldr@yahoo.com
 
I am saking as a user & programmer, since i make up my own Applications. how ever I can not find the way to save macroes in an Application so I have to re install them every time i use the Application Which is every day now..so do i need to go back to the .SCX screen and start over to get them in the Application...also while I,m here how do you use the Emoticons/Smilleys & Process TGML..
 
You can define your macros using the menu selection:
Program->Macros
Then select the 'Save' button to save them to a file say, MyMacs.FKY. When you want to use them again, either from the command window or from a program, you can issue the command:
RESTORE MACROS FROM MyMacs.FKY

To use the emoticons, look them up from the 'Preview Post' hyper link that says " click Here for the full list of Emoticons/Smileys". Then put in the word next to the one you want to use including the brackets:

Code:
[smile]
will put in a [smile].

Dave S.
 
My original perspective was to programmatically support allowing your users (not just yourself) to save and subsequently use their own "macros" within your application. If that perspective "misses the mark" on your question, I apologize.

If only for yourself during your programming sessions, then the Program->Macros... Save method will work fine.

If also for your users....
Create a means (perhaps a separate screen or not) where the keystrokes can be entered by the user. Then save these keystrokes off to a separate data table along with the User ID.

Then when that same user comes back into the program, their unique keystrokes can be retrieved from the data table and re-assigned via issuing the appropriate ON KEY LABEL or ON KEY command within the program.

If these macros need to be different from screen to screen, then the screen name also needs to be saved as part of the "macro" definition and used appropriately when re-assigning to Function keys.

Programming the capture, save, and re-assignment of the "macro" keystrokes is not the difficult part. Architecting the program to easily allow the users to perform this operation is the key. Will they typically only do this once? Or will they be doing this often? Will it be done differently on different screens or not? Etc. These questions are where to start and then move on towards the specific code required to make it happen.

Best of luck to you,
jrbbldr
jrbbldr@yahoo.com

 
I have tried making macros and saving them to a file that is no problem, how ever when running the Application that i made there is no place i can issue the command restore maros from, since there are no command windows in the Application.while in the Application i can (shift+f10) and make a macro but no way to save it. and when i go out of the APPLICATION I loose that marco.Is there something I for got to do when I was generating it. [censored]
 
Within the application you can issue the command:
SAVE MACROS TO somefile.FKY and also,
RESTORE MACROS FROM somefile.FKY.

Dave S.
 
You say that you can issue a command within an appication, ie! save or restore ().KFY how is that done if you do not have a command window..could it be that when generating the Application I don't have the right info in the screen..
[pc3] Could I send you the Application so you could tell me what i did wrong.
 
As to the application user's Macros........

If everyone of your users all needed the same single Macro, then all you would need to do is to either add an ON KEY LABEL ..... to the beginning of your screen which would allow the users to hit the appropriate FKey which would then execute your RESTORE MACRO command or you could add a button (or more) to the screen which, when the user's clicked on it, would do the same thing.

However, if each user might need to have their own separate set of Macros then you would need to take a different approach. By adding a new UsrMacro data table you could save each user's individual Macros for each instance that
they might be needed. In order to "capture" the user's Macros, you could approach it in a variety of manners.

One way would be to again use an ON KEY LABEL.... which would execute a small program to capture the user's keystroke input and save it away to the UsrMacro table. And then another ON KEY LABEL to restore from the UsrMacro table and execute the macros.

Another way would be to create a unique screen to capture the user's macros to the UsrMacro table. Again, within the screen, an ON KEY LABEL.... or a new button could Restore the macro(s) and execute them.

Good Luck,
jrbbldr
jrbbldr@yahoo.com


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top