×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Mapkey to copy a text.
2

Mapkey to copy a text.

Mapkey to copy a text.

(OP)
How to create a mapkey which can copy a selected text? E.g. say I have xyz.asm as active model, Mapkey should do following tasks. File->Rename-> Copy Highlighted text(in New Name TextBox which will be "xyz")->Cancel button.      File->Open->Change the type to Drawing(.drw)->paste already copied text(i.e. xyz)->Open button.

I guess this is very difficult. But I think it is possible, I'm trying with different options like using Windows batch file to copy and paste, not lucky so far. Hope to receive some of your responses.
 

RE: Mapkey to copy a text.

Try looking at VB Script for windows.  It can be run from the command line or dos bat file.  If I remember correctly there were commands to access the clipboard contents.

You can also lookup Windows Script Host (WSH).  

Stephen Seymour, PE
Seymour Engineering & Consulting Group
www.seymourecg.com

RE: Mapkey to copy a text.

(OP)
Even though this is not something I had in mind,(basically I wanted to figure out the way to trigger copy/paste using windows right click through ProE) but what you have presented is extremely innovative way to deal with some situation like example in my question. But I still believe there must be a way to trigger windows copy/paste option using bat file/vb script/java script.

Learned something new today,thanks Mehit!!!

RE: Mapkey to copy a text.

(OP)
Looks like there are not much options but I could achieve it using sendkey with VBScript, but still it is bit complicated as it is difficult to combine VBS and Mapkey, One of the reasons is pausing  mapkey as and when required to run VBScript completely.
Even though this is not robust programming method, but works well in some cases.

This one will open the drawing of current model.



File name: OpenDrawing.vbs

Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.SendKeys "%{TAB}", True
WshShell.SendKeys "%w"
WshShell.SendKeys "a"
WshShell.SendKeys "%f"
WshShell.SendKeys "r"
WshShell.SendKeys "^c"
WshShell.SendKeys "%{F4}"
WshShell.SendKeys "%f"
WshShell.SendKeys "O"
WshShell.SendKeys "^v"
WshShell.SendKeys ".drw"
WshShell.SendKeys "{ENTER}"

Mapkey to Run VBS file:-
mapkey(continued) @SYSTEM\@ echo off\nC:\\users\\xxx\\OpenDrawing.vbs\nexit;
 

RE: Mapkey to copy a text.

Could you break your mapkey into two parts and then have the VB Script execute the second half of the mapkey.  So for instance, your 1st mapkey does everything you need it to do up to and including the point where the vbscript file is launched.  Then at the tail end of your vbscript file you could try executing a second mapkey using the sendkeys to complete the rest of the tasks you need.

Keep in mind that on problem with the sendkeys method is that the focus to the program you are sending the keystrokes to can be lost.  This typically happens when MS Outlook pops up a message or something.  I believe there is an app activate function in VB Script you can call ( I know this funciton is in VB6 and VB.net) to help maintain the focus of the proe window.

Stephen Seymour, PE
Seymour Engineering & Consulting Group
www.seymourecg.com

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources