Jump to content

Recommended Posts

Posted

How could I change this:

 

Quote

(setq Website (strcat "https://websoilsurvey.nrcs.usda.gov/app/WebSoilSurvey.aspx?location=((" LONG " " LAT "," LONG3 " " LAT3 "))"))
(command "_browser" Website) ;;;;How can I get the above address to be copied to the clip board?

 

Instead of opening the browser to the website, just copy the link to a clip board?

 

There are some users that like to use either chrome, firefox, or what not. I figured they could paste it in whatever browser.

 

(defun c:soil (/ COORDS LONGLAT LONG LAT PROJDEST PROJSRC COORDS2 LONGLAT2 LONG2 LAT2 COORDS3 LONGLAT3 LONG3 LAT3 COORDS4 LONGLAT4 LONG4 LAT4 )
(setq PROJSRC (ade_projgetwscode))
(if (/= (getvar "ctab") "Model") (command "_mspace"))
(ade_projsetsrc PROJSRC)
(ade_projsetdest "LL84")
(setq COORDS (getpoint "\nPick the Bottom Left Corner of Area of Interest within Modelspace: "))
(setq LONGLAT (ade_projptforward COORDS))
(setq LONG (car LONGLAT))
(setq LONG (rtos LONG 2 6))
(setq LAT (car (cdr LONGLAT)))
(setq LAT (rtos LAT 2 6)) 
(setq PROJDEST (ade_projgetinfo "LL84" "description"))
(princ (strcat
"\n X,Y: " (rtos (car COORDS) 2 6) "," (rtos (cadr COORDS) 2 6)
"\n Projection SOURCE :  " PROJSRC
"\n Projection CIBLE(Target) :  " PROJDEST
"\n Longitude,Latitude: " LONG "," LAT
"\n"))
(setq COORDS3 (getpoint "\nPick the Top Right Corner of Area of Interest within Modelspace: "))
(setq LONGLAT3 (ade_projptforward COORDS3))
(setq LONG3 (car LONGLAT3))
(setq LONG3 (rtos LONG3 2 6))
(setq LAT3 (car (cdr LONGLAT3)))
(setq LAT3 (rtos LAT3 2 6)) 
(setq PROJDEST (ade_projgetinfo "LL84" "description"))
(princ (strcat
"\n X,Y: " (rtos (car COORDS3) 2 6) "," (rtos (cadr COORDS3) 2 6)
"\n Projection SOURCE :  " PROJSRC
"\n Projection CIBLE(Target) :  " PROJDEST
"\n Longitude,Latitude: " LONG3 "," LAT3
"\n"))
(setq Website (strcat "https://websoilsurvey.nrcs.usda.gov/app/WebSoilSurvey.aspx?location=((" LONG " " LAT "," LONG3 " " LAT3 "))"))
(command "_browser" Website) ;;;;How can I get the above address to be copied to the clip board?
(princ))

thanks for the direction.

Posted

Have you done a search? Copy to clipboard has been answered many times before.

Posted

thank you ronjonp.

 

I found code that leemac posted. 

 

I am guessing i would need to (LM:copytoclipboard "setq Website (strcat "https://websoilsurvey.nrcs.usda.gov/app/WebSoilSurvey.aspx?location=((" LONG " " LAT "," LONG3 " " LAT3 "))")")

 

;; Copy to Clipboard  -  Lee Mac
;; Using the same method as MP demonstrates here: http://bit.ly/170kacW
(defun LM:copytoclipboard ( str / clp htm par )
    (if (setq htm (vlax-create-object "htmlfile"))
        (progn
            (vl-catch-all-apply
               '(lambda ( )
                    (setq par (vlax-get htm 'parentwindow)
                          clp (vlax-get par 'clipboarddata)
                    )
                    (vlax-invoke clp 'setdata "Text" str)
                )
            )
            (foreach obj (list clp par htm)
                (if (= 'vla-object (type obj))
                    (vlax-release-object obj)
                )
            )
            str
        )
    )
)

(vl-load-com) (princ)


(defun c:soil (/ COORDS LONGLAT LONG LAT PROJDEST PROJSRC COORDS2 LONGLAT2 LONG2 LAT2 COORDS3 LONGLAT3 LONG3 LAT3 COORDS4 LONGLAT4 LONG4 LAT4 )
(setq PROJSRC (ade_projgetwscode))
(if (/= (getvar "ctab") "Model") (command "_mspace"))
(ade_projsetsrc PROJSRC)
(ade_projsetdest "LL84")
(setq COORDS (getpoint "\nPick the Bottom Left Corner of Area of Interest within Modelspace: "))
(setq LONGLAT (ade_projptforward COORDS))
(setq LONG (car LONGLAT))
(setq LONG (rtos LONG 2 6))
(setq LAT (car (cdr LONGLAT)))
(setq LAT (rtos LAT 2 6)) 
(setq PROJDEST (ade_projgetinfo "LL84" "description"))
(princ (strcat
"\n X,Y: " (rtos (car COORDS) 2 6) "," (rtos (cadr COORDS) 2 6)
"\n Projection SOURCE :  " PROJSRC
"\n Projection CIBLE(Target) :  " PROJDEST
"\n Longitude,Latitude: " LONG "," LAT
"\n"))
(setq COORDS3 (getpoint "\nPick the Top Right Corner of Area of Interest within Modelspace: "))
(setq LONGLAT3 (ade_projptforward COORDS3))
(setq LONG3 (car LONGLAT3))
(setq LONG3 (rtos LONG3 2 6))
(setq LAT3 (car (cdr LONGLAT3)))
(setq LAT3 (rtos LAT3 2 6)) 
(setq PROJDEST (ade_projgetinfo "LL84" "description"))
(princ (strcat
"\n X,Y: " (rtos (car COORDS3) 2 6) "," (rtos (cadr COORDS3) 2 6)
"\n Projection SOURCE :  " PROJSRC
"\n Projection CIBLE(Target) :  " PROJDEST
"\n Longitude,Latitude: " LONG3 "," LAT3
"\n"))
(LM:copytoclipboard "setq Website (strcat "https://websoilsurvey.nrcs.usda.gov/app/WebSoilSurvey.aspx?location=((" LONG " " LAT "," LONG3 " " LAT3 "))")")
;;(command "_browser" Website) ;;;;How can I get the above address to be copied to the clip board?
(princ))

 

Posted
3 hours ago, rcb007 said:

thank you ronjonp.

 

I found code that leemac posted. 

 

I am guessing i would need to (LM:copytoclipboard "setq Website (strcat "https://websoilsurvey.nrcs.usda.gov/app/WebSoilSurvey.aspx?location=((" LONG " " LAT "," LONG3 " " LAT3 "))")")

 


;; Copy to Clipboard  -  Lee Mac
;; Using the same method as MP demonstrates here: http://bit.ly/170kacW
(defun LM:copytoclipboard ( str / clp htm par )
    (if (setq htm (vlax-create-object "htmlfile"))
        (progn
            (vl-catch-all-apply
               '(lambda ( )
                    (setq par (vlax-get htm 'parentwindow)
                          clp (vlax-get par 'clipboarddata)
                    )
                    (vlax-invoke clp 'setdata "Text" str)
                )
            )
            (foreach obj (list clp par htm)
                (if (= 'vla-object (type obj))
                    (vlax-release-object obj)
                )
            )
            str
        )
    )
)

(vl-load-com) (princ)


(defun c:soil (/ COORDS LONGLAT LONG LAT PROJDEST PROJSRC COORDS2 LONGLAT2 LONG2 LAT2 COORDS3 LONGLAT3 LONG3 LAT3 COORDS4 LONGLAT4 LONG4 LAT4 )
(setq PROJSRC (ade_projgetwscode))
(if (/= (getvar "ctab") "Model") (command "_mspace"))
(ade_projsetsrc PROJSRC)
(ade_projsetdest "LL84")
(setq COORDS (getpoint "\nPick the Bottom Left Corner of Area of Interest within Modelspace: "))
(setq LONGLAT (ade_projptforward COORDS))
(setq LONG (car LONGLAT))
(setq LONG (rtos LONG 2 6))
(setq LAT (car (cdr LONGLAT)))
(setq LAT (rtos LAT 2 6)) 
(setq PROJDEST (ade_projgetinfo "LL84" "description"))
(princ (strcat
"\n X,Y: " (rtos (car COORDS) 2 6) "," (rtos (cadr COORDS) 2 6)
"\n Projection SOURCE :  " PROJSRC
"\n Projection CIBLE(Target) :  " PROJDEST
"\n Longitude,Latitude: " LONG "," LAT
"\n"))
(setq COORDS3 (getpoint "\nPick the Top Right Corner of Area of Interest within Modelspace: "))
(setq LONGLAT3 (ade_projptforward COORDS3))
(setq LONG3 (car LONGLAT3))
(setq LONG3 (rtos LONG3 2 6))
(setq LAT3 (car (cdr LONGLAT3)))
(setq LAT3 (rtos LAT3 2 6)) 
(setq PROJDEST (ade_projgetinfo "LL84" "description"))
(princ (strcat
"\n X,Y: " (rtos (car COORDS3) 2 6) "," (rtos (cadr COORDS3) 2 6)
"\n Projection SOURCE :  " PROJSRC
"\n Projection CIBLE(Target) :  " PROJDEST
"\n Longitude,Latitude: " LONG3 "," LAT3
"\n"))
(LM:copytoclipboard "setq Website (strcat "https://websoilsurvey.nrcs.usda.gov/app/WebSoilSurvey.aspx?location=((" LONG " " LAT "," LONG3 " " LAT3 "))")")
;;(command "_browser" Website) ;;;;How can I get the above address to be copied to the clip board?
(princ))

 

Not quite .. see below. You should use the VLIDE when editing code .. the color coding really helps point out snafu's.

;; NO GOOD
(LM:copytoclipboard "setq Website (strcat "https://websoilsurvey.nrcs.usda.gov/app/WebSoilSurvey.aspx?location=((" LONG " " LAT "," LONG3 " " LAT3 "))")")
;; TRY THIS
(LM:copytoclipboard  (strcat "https://websoilsurvey.nrcs.usda.gov/app/WebSoilSurvey.aspx?location=((" LONG " " LAT "," LONG3 " " LAT3 "))")))

Visual of how I trouble shot this:

image.thumb.png.064416cb8e87340da8b456055f9ef4b4.png

Posted

ah.... so sorry! thank you for the guide! lol. What is it... close but no cigar.

Posted
2 minutes ago, rcb007 said:

ah.... so sorry! thank you for the guide! lol. What is it... close but no cigar.

No worries .. just giving you some pointers so you can troubleshoot this stuff for yourself. 🍻

Posted

Checked out Browser did not know about it learn something new everyday. Anyway the answer, just need to sort your string out.

 

(setvar 'filedia 0)
(setq loc "https://www.google.com.au/maps/place/Bennelong Point, Sydney NSW 2000")
(command "browser" loc)

 

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...