CatScript - Copy string to clipboard
CatScript - Copy string to clipboard
(OP)
Is there any option to copy a string value to clipboard.
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS Come Join Us!Are you an
Engineering professional? Join Eng-Tips Forums!
*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail. Posting GuidelinesJobs |
CatScript - Copy string to clipboard
|
CatScript - Copy string to clipboardCatScript - Copy string to clipboard(OP)
Is there any option to copy a string value to clipboard.
Red Flag SubmittedThank you for helping keep Eng-Tips Forums free from inappropriate posts. Reply To This ThreadPosting in the Eng-Tips forums is a member-only feature.Click Here to join Eng-Tips and talk with other members! |
ResourcesThe world has changed considerably since the 1980s, when CAD first started displacing drafting tables. Download Now
Prototyping has always been a critical part of product development. Download Now
As the cloud is increasingly adopted for product development, questions remain as to just how cloud software tools compare to on-premise solutions. Download Now
Engineering-centric businesses face a number of challenges today, but unmanageable design and change processes don’t need to be counted among them. Download Now
|
RE: CatScript - Copy string to clipboard
CODE -->
Sub Copy_to_Clipboard() sString = "Paste To Clipboard" Set WshShell = CreateObject("WScript.Shell") Set oExec = WshShell.Exec("clip") Set oWrite = oExec.stdIn oWrite.WriteLine sString oWrite.Close End Sub______
Alex ,
RE: CatScript - Copy string to clipboard
http://files.engineering.com/getfile.aspx?folder=f...
Sub CATMain ()
Dim CATProdDoc As ProductDocument
Copy_to_Clipboard()
End Sub
Sub Copy_to_Clipboard()
sString = "Paste To Clipboard"
Set WshShell = CreateObject("WScript.Shell")
Set oExec = WshShell.Exec("clip")
Set oWrite = oExec.stdIn
oWrite.WriteLine sString
oWrite.Close
End Sub
RE: CatScript - Copy string to clipboard
Sub CATMain ()
Dim CATProdDoc 'As ProductDocument
Copy_to_Clipboard()
End Sub
Sub Copy_to_Clipboard()
sString = "Paste To Clipboard"
Set WshShell = CreateObject("WScript.Shell")
Set oExec = WshShell.Exec("clip")
Set oWrite = oExec.stdIn
oWrite.WriteLine sString
oWrite.Close
End Sub
RE: CatScript - Copy string to clipboard
Because I'm to lazy to right click, go in Properties and copy in clipboard from different workbenches and then paste what is in clipboard where I need, I've adapted the upper code to my needs (I need only names of different types of documents or text/dimension values in drawings).
CODE --> CATScript
Sub CATMain() Set oPartDocument = CATIA.ActiveDocument Set oSelection = oPartDocument.Selection oSelection.Clear Dim oInputType(0) Dim oStatus Dim MySelection3 As Object Set MySelection3 = oPartDocument.Selection Dim inputObjectType(0) As Variant InputObjectType(0) = "AnyObject" Dim Result As String Result = MySelection3.SelectElement2(InputObjectType, "Select a dimesion/text in 2D, or a Body/CATPart/CATProduct in 3D ", False) Set mySelection = oSelection.Item(1).Value Dim s 'As String Dim strToLeft 'As String s = mySelection.Name strToLeft = Split(s,".")(0) Set mySelection = oSelection.Item(1).Value ' Put it back to the clipboard Set WshShell = CreateObject("WScript.Shell") Set oExec = WshShell.Exec("clip") Set oIn = oExec.stdIn If strToLeft = "Dimension" Then oIn.WriteLine mySelection.GetValue.Value oIn.Close ElseIf strToLeft = "Text" Then oIn.WriteLine mySelection.Text oIn.Close ElseIf TypeName(MySelection3.Item(1).Value) = "Part" Then oIn.WriteLine mySelection.Name oIn.Close ElseIf TypeName(MySelection3.Item(1).Value) = "Product" Then oIn.WriteLine mySelection.Name oIn.Close ElseIf TypeName(MySelection3.Item(1).Value) = "Body" Then oIn.WriteLine mySelection.Name oIn.Close ElseIf TypeName(MySelection3.Item(1).Value) = "Document" Then oIn.WriteLine mySelection.Name oIn.Close End If End SubRegards
Fernando
https://picasaweb.google.com/102257836106335725208
https://picasaweb.google.com/103462806772634246699...