(in-package :custom) (use-package :oli) (sd-defdialog 'tp_text_suchen :toolbox-button nil :dialog-title "Text suchen" ; :dialog-control :parallel :variables '( (tp_text :value-type :string :title "Text" :prompt-text "Gib den zu suchenden Text ein" :after-input (progn (tp_text_suchen_los) ; (setf tp_text nil) (sd-set-variable-status 'tp_next_pos :enable t) ) ) ("-") (tp_text1 :value-type :string ; :initial-value "4.4" :title "Text NEU" :prompt-text "Gib den zu neuen Text ein" :after-input (progn ) ) (tp_ersetzen :title "ersetzen" :initial-visible t :initial-enable nil :toggle-type :wide-toggle :push-action (progn (if tp_txt_list1 (progn (setf tp_tmp_txt1 (sd-string-downcase(first (sd-am-inq-text-strings (first tp_txt_list1))))) (if (search (sd-string-downcase tp_text) tp_tmp_txt1) (progn (setq tp_start_pos (search (sd-string-downcase tp_text) tp_tmp_txt1)) (setq tp_end_pos (length tp_text)) (setq tp_txt_new (replace tp_tmp_txt1 tp_text1 :start1 tp_start_pos :end1 (+ tp_start_pos tp_end_pos))) (sd-call-cmds (am_mod_text_edit (nth 0 tp_txt_list1) tp_txt_new)) )) (setf tp_txt_list1 (remove-nth 0 tp_txt_list1)) (sd-set-variable-status 'tp_ersetzen :enable nil) ));;ende if ) ) ("-") (tp_anzahl :value-type :display-only :initial-value 0 :title "Anzahl" ) (tp_status :value-type :display-only :title "Status" ) (tp_next_pos :title "weiter" :initial-visible t :initial-enable nil :toggle-type :wide-toggle :push-action (progn (if tp_pos_list1 (progn (sd-set-variable-status 'tp_ersetzen :enable t) (setf tp_txt_pos (first tp_pos_list1)) (setf tp_nummern (sd-string-split tp_txt_pos ",")) (docu_generic_window_vp (make-gpnt2d :x (- (sd-read-from-string (first tp_nummern)) 20) :y (+ (sd-read-from-string (second tp_nummern)) 20)) (make-gpnt2d :x (+ 20 (sd-read-from-string (first tp_nummern))) :y (- (sd-read-from-string (second tp_nummern)) 20)) ) (update_screen) (setf tp_pos_list1 (remove-nth 0 tp_pos_list1)) (setf tp_anzahl (+ 1 (length tp_pos_list1))) ));ende if (if (= (length tp_pos_list1) 0) (progn (sd-set-variable-status 'tp_next_pos :enable nil) ; (sd-set-variable-status 'tp_ersetzen :enable nil) ));;ende if ) ) ) ;; ende Variablen :ok-action '(progn ) :local-functions '( (tp_text_suchen_los () (setf tp_all_text (sd-call-cmds (get_selection :FOCUS_TYPE *sd-anno-text-seltype* :select :by_sheet_docu_rest (sd-am-inq-curr-sheet)))) (sd-am-inq-curr-sheet) (setf tp_nummern nil) (setf tp_txt_pos nil) (setf tp_pos_list1 '()) (setf tp_txt_list1 '()) (dolist (tp_txt_tmp tp_all_text) (setf tp_txt1 (sd-string-downcase(first (sd-am-inq-text-strings tp_txt_tmp)))) ; (setf tp_txt2 (concatenate 'string "*" tp_txt1 "*")) ; (if (string= tp_txt1 tp_text) (if (search (sd-string-downcase tp_text) tp_txt1) ; (if (sd-string-match-pattern-p tp_txt1 tp_text) (progn ; (setf tp_txt_pos (sd-get-annotator-position :object tp_txt_tmp)) (setf tp_pos_list1 (cons (sd-get-annotator-position :object tp_txt_tmp) tp_pos_list1)) (setf tp_txt_list1 (cons tp_txt_tmp tp_txt_list1)) ));ende if ) (if tp_pos_list1 (progn (setf tp_anzahl (length tp_pos_list1)) (setf tp_txt_pos (first tp_pos_list1)) (setf tp_nummern (sd-string-split tp_txt_pos ",")) (docu_generic_window_vp (make-gpnt2d :x (- (sd-read-from-string (first tp_nummern)) 20) :y (+ (sd-read-from-string (second tp_nummern)) 20)) (make-gpnt2d :x (+ 20 (sd-read-from-string (first tp_nummern))) :y (- (sd-read-from-string (second tp_nummern)) 20)) ) (update_screen) (setf tp_status "Gefunden") (setf tp_pos_list1 (remove-nth 0 tp_pos_list1)) ) (progn (setf tp_status "Nichts gefunden") (setf tp_anzahl 0) ) );ende if (if (> (length tp_pos_list1) 1) (progn (sd-set-variable-status 'tp_next_pos :enable t) (sd-set-variable-status 'tp_ersetzen :enable t) ));;ende if ; (sd-get-annotator-position ; :object delete-start) ) ;; ende tp_text_suchen_los ) ;; ende local-functions );;ende Dialog (defun remove-nth (n list) (declare (type (integer 0) n) (type list list)) (if (or (zerop n) (null list)) (cdr list) (cons (car list) (remove-nth (1- n) (cdr list)))))