Author Topic: How to disappeared second dialog  (Read 1706 times)

0 Members and 1 Guest are viewing this topic.

Adesu

  • Guest
How to disappeared second dialog
« on: December 15, 2007, 12:51:19 AM »
I got problem to disappeared second dialog (attach 3), if repeat button (attach 2) just hit and then first (attach 1) dialog should display

Code: [Select]
; sfnc is stand for Search File Name Completed
;        Design by  : Adesu <Ade Suharna>
;        Email      : mteybid@yuasabattery.co.id
;        Homepage   : http://www.yuasa-battery.co.id
;        Website    : http://cadesu.multiply.com
;        Create     : 14 December 2007
;        Program no.: 0687/12/2007
;        Edit by    : Adesu 14/12/2007   1).

(defun c:sfnc (/ dcl_id file_folder all_file_name name lst ans sf nf xf ?f file)
  (setq dfn (load_dialog "Display File Name.dcl"))
  (if
    (not (new_dialog "dfn" dfn))
    (exit)
    ) ; if
  (vl-load-com)
  (setq file_folder "D:/YBI/Program/AutoLisp/Lisp program/My Alls Program")
  (setq all_file_name (cddr (vl-directory-files file_folder)))
  (setq all_file_name
(mapcar '(lambda (x)(nth x all_file_name))
(vl-sort-i all_file_name '<)))
  (foreach file_name all_file_name                                       
    (setq name (cons (substr file_name 6 50) name))
    ) ; foreach
  (setq lst (acad_strlsort (reverse name)))
  (start_list "lb")
  (mapcar 'add_list lst)    
  (end_list)
  (mode_tile "lb" 2)
  (action_tile
    "lb"
    "(setq data_name (nth (atoi $value) lst)) ")
  (action_tile "accept" "(done_dialog 1)")
  (action_tile "cancel" "(done_dialog 0)")
  (setq ans (start_dialog))
  (unload_dialog dfn)
  (if
    (= ans 1)
    (progn
      (setq sf data_name)
      (foreach x all_file_name
(setq nf x)
(setq xf (vl-string-right-trim sf nf))
(setq ?f (vl-string-left-trim xf nf))
(if
  (= ?f sf)
  (setq file nf)
  )  ; if
)    ; foreach
      )      ; progn
    )        ; if
   (setq dfnc (load_dialog "Display File Name Completed.dcl"))
   (if
      (not (new_dialog "dfnc" dfnc))
      (exit)
      ) ; if
   (start_list "lba")
   (mapcar 'add_list lst)
   (end_list)   
   (start_list "lbb")
   (mapcar 'add_list (list file))
   (end_list)   
   (action_tile
      "rtn"
      "(if
      (new_dialog \"dfnc\" dfnc)
      (unload_dialog dfnc)
      ) ; if
      (c:sfnc)")   ; 1).
   (action_tile "ext" "(exit)")     ; 1).
   (setq ans (start_dialog))
   (unload_dialog dfnc)
   (princ)
   ) ; defun

Adesu

  • Guest
Re: How to disappeared second dialog
« Reply #1 on: December 15, 2007, 02:21:23 AM »
Oops,sorry I just get solution,here new that code.
Code: [Select]
(defun c:test (/ dcl_id file_folder all_file_name name lst ans sf nf xf ?f file)
   (setq dfnc (load_dialog "Display File Name Completed-1.dcl"))
   (if
      (not (new_dialog "dfnc1" dfnc))
      (exit)
      ) ; if
   (vl-load-com)
   (setq file_folder "D:/YBI/Program/AutoLisp/Lisp program/My Alls Program")
   (setq all_file_name (cddr (vl-directory-files file_folder)))
   (setq all_file_name
           (mapcar '(lambda (x)(nth x all_file_name))
                   (vl-sort-i all_file_name '<)))
   (foreach file_name all_file_name
      (setq name (cons (substr file_name 6 50) name))
      ) ; foreach
   (setq lst (acad_strlsort (reverse name)))
   (start_list "lba")
   (mapcar 'add_list lst)
   (end_list)
   (mode_tile "lba" 2)
   (action_tile
      "lba"
      "(setq data_name (nth (atoi $value) lst)) ")
   (action_tile
      "rtn"
      "(c:test)")   ; 1).
   (action_tile "ext" "(exit)")
   (setq ans (start_dialog))
   (unload_dialog dfn)
   (if
      (= ans 1)
      (progn
         (setq sf data_name)
         (foreach x all_file_name
            (setq nf x)
            (setq xf (vl-string-right-trim sf nf))
            (setq ?f (vl-string-left-trim xf nf))
            (if
               (= ?f sf)
               (setq file nf)
               )  ; if
            )    ; foreach
         )      ; progn
      )        ; if
   (setq dfnc (load_dialog "Display File Name Completed-1.dcl"))
   (if
      (not (new_dialog "dfnc1" dfnc))
      (exit)
      ) ; if
   (start_list "lba")
   (mapcar 'add_list lst)
   (end_list)
   (start_list "lbb")
   (mapcar 'add_list (list file))
   (end_list)
   (action_tile
      "rtn"
      "(c:test)")   ; 1).
   (action_tile "ext" "(exit)")
   (action_tile
      "chk"
      "(start_list \"lba\")
      (mapcar 'add_list lst)
      (end_list)
      (start_list \"lbb\")
      (mapcar 'add_list (list file))
      (end_list)")
   (setq ans (start_dialog))
   (unload_dialog dfnc)
   (princ)
   ) ; defun