hosyn Posted July 26, 2013 Share Posted July 26, 2013 I need to code lisp for picking by mouse the text and it's saved in the clipboard:ouch: Thanx for Any suggestion. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted July 26, 2013 Share Posted July 26, 2013 I recommend building a program utilising these clipboard functions by MP: http://www.theswamp.org/index.php?topic=21764.msg263322#msg263322 I have been using them successfully for a long time implemented as coding shortcuts. Quote Link to comment Share on other sites More sharing options...
hosyn Posted July 27, 2013 Author Share Posted July 27, 2013 Dear Lee mac I get code from MP it's: (defun _SetClipBoardText ( text / htmlfile result ) ;; Caller's sole responsibility is to pass a ;; text string. Anything else? Pie in face. ;; Attribution: Reformatted version of ;; post by XShrimp at theswamp.org. ;; ;; See http://tinyurl.com/2ngf4r. (setq result (vlax-invoke (vlax-get (vlax-get (setq htmlfile (vlax-create-object "htmlfile")) 'ParentWindow ) 'ClipBoardData ) 'SetData "Text" text ) ) (vlax-release-object htmlfile) text ) and i dont know how i can use it . I know for Lisp file that begin with C: (defun c:aaaa()) ... and i run the name command after c:. but about the above code I dont know the name of command ?? and at this situation i usually add a new line with the define name i choose for it . Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted July 27, 2013 Share Posted July 27, 2013 MP's _SetClipBoardText function is not a full program which may be called at the command-line as a command; this is a function (just like built-in AutoLISP functions), requiring a single argument representing a string to copy to the clipboard. As stated in my earlier post, you will need to build a program to call this function with the text content that is to be copied to the clipboard; the function I have suggested is the core engine of such a program, you will need to write the calling program. Quote Link to comment Share on other sites More sharing options...
hosyn Posted July 27, 2013 Author Share Posted July 27, 2013 Dear Lee mac I usually convert this function to self command file by: [color=seagreen](defun c:LLL()[/color] The above code [color=seagreen])[/color] And generally it became okey.But now don't act well. What's wrong in my way?? Quote Link to comment Share on other sites More sharing options...
neophoible Posted July 27, 2013 Share Posted July 27, 2013 hosyn, I forget whether you are trying to learn to code or not. For now, I will assume you are. You need to pass the text value to that function, which means you need to extract it from the text object, which can generally be done using the DXF code 1 for text value. Of course the user has to be prompted to select the object first, then you go from there. Quote Link to comment Share on other sites More sharing options...
hosyn Posted July 27, 2013 Author Share Posted July 27, 2013 Dear neophoible Indeed I eagerly wanna learn the codes and I attempt so much . but sometimes I feel that i'm in the end point and i cannot go more .same that above code . I understand your talking but i don't know how i can use them i know that this function need to argumant but i don't know how i can write the codes for it:cry: Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted July 27, 2013 Share Posted July 27, 2013 hosyn, Pretend that you have never seen the code for the _SetClipBoardText function or that you don't have access to the source code (just as you don't have access to the source code for the getstring function). Without access to the source code, the only thing you know is that the function requires a single string argument and will copy the supplied string to the Windows clipboard before returning the value of the supplied string: ([font=Courier New][color=blue]_SetClipBoardText[/color][/font] "your string here") => "your string here" Consider that you don't have access to the source code for the getstring function, or any other built-in AutoLISP function for that matter, and yet you are still able to use these functions in your programs by knowing their required arguments, expected behaviour, and the value they return. How would you proceed? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.