;** Pesq_SC ********************************************************************
;*  Relacao de Script's                                                        *
;*******************************************************************************
;Autor           : Vise Informatica (VISERP)
;Desenvolvido    : 28/04/2015 por Bruno Carvalho
;Ultima Alteracao:   /  /     por 
;Motivo Alteracao: 

; Se a Coluna TABELA tiver a palavra PLAY, ‚ porque aquele SCRIPT d  play a outro SCRIP 
; Se a Coluna TABELA tiver a palavra OUTROS, ‚ porque aquele SCRIPT ‚ usado em algum outro SCRIPT
; Se a Coluna TABELA tiver com o nome de uma tabela do sistema "M_" ‚ porque o script esta ali referenciado

;*******************************************************************************
;*  Rotina para mostrar as horas                                               *
;*******************************************************************************
Proc Tempohrs(tini)
private tini,hrs,seg,h,m,s, tfim

tfim=ticks()
if tfim<tini
   then seg=(86400000-tini)
        seg=(seg+tfim)/1000
   else seg=(tfim-tini)/1000
endif

h=seg/3600
m=(h-int(h))*60
s=(m-int(m))*60

hrs=AlinhM(StrVal(int(h)),2)+":"+
    AlinhM(StrVal(int(m)),2)+":"+
    AlinhM(StrVal(Round(s,0)),2)
return hrs
Endproc ; (Tempohrs)

;*******************************************************************************
;* MASCARA                                                                     *
;*******************************************************************************
Proc Mascara()
@ 04,3 ?? "                 0                       50                        100% "
@ 05,3 ?? "                +----------------------------------------------------+  "
@ 06,3 ?? "        Pastas: İİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİ  "
@ 07,3 ?? "                +----------------------------------------------------İ  "
@ 08,3 ?? "       Scripts: İİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİ  "
@ 09,3 ?? "                +----------------------------------------------------+  "
@ 12,3 ?? "+ Tempo -+      +----------------------------------------++ Script --+  "
@ 13,3 ?? "İ00:00:00İ      İ                                        İİ          İ  "
@ 14,3 ?? "+--------+      +----------------------------------------++----------+  "
Array Porcent[3]
Array Coluna[3]
EndProc

Proc Limpa_Pasta(wl,wa)
@ wl,20 ?? "İİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİİ"
Porcent[wa]=0
Coluna[wa] =20
EndProc

Proc barra(wl,wa,vc,vt)
While Porcent[wa]<=Int(((vc/vt)*100))
  Coluna[wa]=Coluna[wa]+1
  @ wl, Coluna[wa] ?? "İ"
  Porcent[wa]=Porcent[wa]+2
EndWhile

EndProc    ; (Mascara)

;*******************************************************************************
; Rotina Restruturacao                                                         *
;*******************************************************************************
Proc Verifica(PARAM)
Private PARAM

@ 06,8 ?? Format("W2,AR",StrVal((DynArraySize(PESQ_ARRAY)+1)-1))            

wc = 0
Mascara()
Limpa_Pasta(08,1)
For wi From 1 To DynArraySize(PESQ_ARRAY)
  TEMP_ARQ = Upper(Rtrim(SubStr(PESQ_ARRAY[wi],31,8)))
  TEMP_DIR = Upper(Rtrim(SubStr(PESQ_ARRAY[wi],1,30))+TEMP_ARQ)+".SC"
       
  If Upper(SubStr(TEMP_ARQ,1,3)) = "BIB" Or Upper(SubStr(TEMP_ARQ,1,4)) = "PESQ" Or
     (MODO = "Menu" And Upper(TEMP_ARQ)="MENUPRI")
     Then Loop
  EndIf     
                           
  Aguarde("Aguarde, Verificando o Scripts "+TEMP_ARQ)
  Limpa_Pasta(08,3)
  
  If Caminho <> Rtrim(SubStr(PESQ_ARRAY[wi],1,30))
     Then Caminho=Rtrim(SubStr(PESQ_ARRAY[wi],1,30))
          If DirExists(Caminho)=0 Then Loop EndIf
          SetDir Caminho
          Comando="del *.bak"
          @ 22,0 Run NoRefresh Comando
  EndIf   
      
  NR = DynArraySize(PESQ_ARRAY)
  @ 08,7 ?? Format("W2,AR",StrVal(DynArraySize(PESQ_ARRAY)))
  @ 08,7
   
  @ 5,5 ?? spaces(2)
  @ 12,20 ?? " Pasta ["+StrVal(wi)+"] -----------------------"
  @ 13,20 ?? Completa(Caminho,40," ")

  @ 13,63 ?? Completa(TEMP_ARQ,8," ")

  If TEMP_ARQ<>"PESQ_PAL" And TEMP_ARQ<>"SAVEVARS"
     Then Editor Open TEMP_DIR
          If SysMode()="Script"
             Then Switch
                    Case PARAM = "Play" :
                      Editor Find PALAVRA
                      If RetVal
                         Then While True
                                Extrair_Linha()
                                AUX = STrim(SubStr(Elinha,1,Len(Elinha)-1))
                                POS = Search(Upper(PALAVRA),Upper(AUX))
                                If POS > 0
                                   Then AUX = Ltrim(SubStr(AUX,POS+Len(PALAVRA),Len(AUX)))
                                        If SubStr(AUX,1,1) = "\""
                                           Then AUX = SubStr(AUX,2,Len(AUX))
                                                POS = Search("\"",Upper(AUX))
                                                If POS > 0
                                                   Then AUX = SubStR(AUX,1,POS-1)
                                                        wc=wc+1
                                                        PESQ_PLAY[wc]=Format("W8",TEMP_ARQ) + Upper(AUX)   
                                                EndIf
                                        EndIf 
                               EndIf
                               Editor Find PALAVRA
                               If Not RetVal
                                  Then QuitLoop
                               EndIf
                             EndWhile
                      EndIf          
                  EndSwitch              
                  Menu {Cancel} {Yes}
             Else Mensagem("N„o pode ser aberto este arquivo -> "+[Name])
          EndIf
  EndIf  
  @ 13,04 ?? Tempohrs(tini)
Endfor
Do_It!
ClearAll
@ 13,63 ?? Completa("Ok !",8," ")

EndProc ;Verifica()                          

;*******************************************************************************
; Rotina Restruturacao                                                         *
;*******************************************************************************
Proc Verifica_PesPal()
tini=ticks()

{Ask} {\\Sistemas\\Utilitar\\Pesq_Sc} 
Moveto [Diretorio] Check
Moveto [Script   ] Check
Moveto [Tabela   ] TypeIn "Not Blank" 
Do_it!
ClearAll 

Sort "Answer" On "Diretorio","Script"

DynArray PESQ_PLAY[]
DynArray PESQ_ARRAY[]
CONT_ARRAY = 0
View "Answer"
Scan
  CONT_ARRAY = CONT_ARRAY + 1
  PESQ_ARRAY[CONT_ARRAY] = Format("W30",DIR+"\\Sistemas\\"+[Diretorio]+"\\")+Format("W8",[Script]) 
EndScan
ClearAll   

Caminho = "***"
PALAVRA = "Play"
Verifica("Play")

If DynArraySize(PESQ_PLAY) > 0
   Then Coedit "\\Sistemas\\Utilitar\\Pesq_Sc"
        For iu From 1 To DynArraySize(PESQ_PLAY)
          TEMP_SCR  = SubStr(PESQ_PLAY[iu],1,8)
          TEMP_PLAY = Upper(Ltrim(Rtrim(SubStr(PESQ_PLAY[iu],9,Len(PESQ_PLAY[iu])))))
          
          Moveto [Script]
          Locate TEMP_PLAY
          If RetVal
             Then While True
                   If [Tabela] = ""
                      Then [Tabela   ] = "PLAY"
                           [Descricao] = "SCRIPT  DE  ORIGEM: "+TEMP_SCR
                   EndIf   
                   Skip
                   If Eot() Then QuitLoop EndIf
                   Locate Next TEMP_PLAY
                   If Not RetVal
                      Then QuitLoop
                   EndIf
                 EndWhile     
          EndIf
        EndFor
EndIf

ClearAll
LimpAguarde()
EndProc ;Verifica_PesPal()

;*******************************************************************************
; Rotina pegar posicao da linha                                                *
;*******************************************************************************
Proc Posicao()
Home
Editor Info to InfoArray
ci=InfoArraY["CHARPOS"]

End
Editor Info to InfoArray
cf=InfoArraY["CHARPOS"]

Editor Select ci cf
Editor Extract to ELinha
EndProc           ; (Posicao)

;*******************************************************************************
;*                                                                             *
;*******************************************************************************
Proc Lista_Arquivo(Param,Extensao)
Private Param,Extensao,wc,y,MSG_INFORMA

Aguarde("Aguarde, Verificando Scripts")
wc=0                           

If IsAssigned(Array_Lista_Arquivos)
   Then Release Vars Array_Lista_Arquivos
EndIf

DynArray Array_Lista_Arquivos[]

FileWrite        PrivDir()+"Dir.INI" From "[EXECDIRF] \n"
FileWrite Append PrivDir()+"Dir.INI" From "Path_Origem="+Param+" \n"
FileWrite Append PrivDir()+"Dir.INI" From "Path_Destino="+PrivDir()+"Dir.Txt \n"

ExecVise("DirF "+ PrivDir()+" "+Extensao)
     
Sleep(1000)
Editor Open PrivDir()+"Dir.txt"
While True
  Extrair_Linha()
  If IsBlank(Elinha)
     Then QuitLoop
  EndIf
  wc=wc+1
  Array_Lista_Arquivos[wc]=STrim(SubStr(Elinha,1,Len(Elinha)-1))
EndWhile
Do_It!

LimpAguarde()
Return wc
EndProc    ; (Lista_Arquivo)

;*******************************************************************************
;*                                                                             *
;*******************************************************************************
Proc Verifica_Arquivo()

DIR        = SubStr(Directory(),1,2)
Extensao   = "*.DB"
PASTA      = DIR + "\\Sistemas\\CADASTRO"
CONT_ARQ = 0
DynArray ARQUIVO[]
SetDir PASTA
If DirExists(PASTA)>0
   Then Lista_Arquivo(PASTA,Extensao)
        For ii From 1 To DynArraySize(Array_Lista_Arquivos)
          ARQ = Array_Lista_Arquivos[ii]
          If Upper(SubStr(ARQ,1,2))="M_"
             Then View SubStr(ARQ,1,Len(ARQ)-3)
                  Scan
                    If Upper([Comando]) = Upper(VSDG_SCRIPT)
                       Then If Not IMPRIMIR
                               Then IMPRIMIR = True
                            EndIf   
                            CONTADOR = CONTADOR + 1
                            If CONTADOR = 1
                               Then Cabecalho()
                            EndIf   
                            LINHA    = LINHA + 1
                            Print File ARQIMP Spaces(2)+Format("W08",Upper(SubStr(ARQ,1,Len(ARQ)-3)))
                            Print File ARQIMP Spaces(1)+Format("W25",Upper([Diretorio]))
                            Print File ARQIMP Spaces(1)+Format("W40",Upper([Descricao]))
                            Print File ARQIMP "\n"
                            
                            If LINHA >= 64
                               Then Print File ARQIMP "\f"
                                    Cabecalho()
                            EndIf        
                    EndIf   
                  EndScan 
                  CleaRAll
          EndIf   
        EndFor
EndIf

EndProc ;Verifica_Arquivo()

;*******************************************************************************
;*                                                                             *
;*******************************************************************************
Proc Diretorios()
Private wc

Aguarde("Aguarde, Verificando Pastas")
DynArray Diretorio[]

Lista_Diretorio(DIR+"\\Sistemas\\")
wc = 0
While wc<DynArraySize(Array_Lista_Diretorios)
  wc = wc+1
  Aguarde("Aguarde, Verificando Pastas "+Upper(Array_Lista_Diretorios[wc]))
  Diretorio[wc] = Upper(Array_Lista_Diretorios[wc])
EndWhile

Release Vars Array_Lista_Diretorios
EndProc ;Diretorios()
                                        
;*******************************************************************************
;*                                                                             *
;*******************************************************************************
Proc Verifica_Script2()
Private DIRET,PASTA

Tabela=Cria_Temp(PrivDir())
Copy "\\Sistemas\\Utilitar\\Pesq_sc" Tabela

For i From 1 To DynArraySize(Diretorio)
   Aguarde("Aguarde, Verificando o diretorio "+Diretorio[i])
   DIRET = Diretorio[i]
   PASTA = DIR + "\\Sistemas\\" + Diretorio[i] + "\\"
   If DirExists(PASTA)>0
      Then {Tools} {Info} {Inventory} {Scripts} TypeIn PASTA Enter
           ClearAll                                                  
           If Not IsEmpty("List")
              Then {Ask} {List}
                   Moveto [Name] Example "Scr"
                   {Ask} TypeIn Tabela Enter TypeIn "Insert" 
                   Moveto [Diretorio] TypeIn "~DIRET"
                   Moveto [Script   ] TypeIn "_Scr"
                   Do_It!
                   CleaRAll
           EndIf        
   EndIf          
EndFor

{Ask} TypeIn Tabela Enter TypeIn "Delete" Enter
Moveto [Script] TypeIn "\"RC_\".. Or \"RP_\".. Or \"RR_\".. Or \"RO_\".. Or \"PD_\".. Or \"PB_\".. Or \"EB_\".. Or \"CP_\".. Or \"CH_\".. Or \"CB_\".."
Do_It!
ClearAll

{Ask} TypeIn Tabela Enter TypeIn "Delete" Enter
Moveto [Script] TypeIn "\"OR_\".. Or \"OE_\".. Or \"OC_\".. Or \"NP_\".. Or \"NF_\".. Or \"EV_\".. Or \"ET_\".. Or \"ED_\".. Or \"EC_\".. Or \"BIB\".." 
Do_It!
ClearAll

If Not IsEmpty(Tabela)
   Then Array_Registro2()
   Else Mensagem("Erro!")
EndIf                  

EndProc ;Verifica_Script2()

;*******************************************************************************
;*                                                                             *
;*******************************************************************************
Proc Array_Registro2() 
Private Tabela2

Tabela2 = Cria_Temp(PrivDir())
PASTA = DIR + "\\Sistemas\\CADASTRO"

Coedit Tabela 
Scan
  [Script] = Upper([Script])
EndScan
Do_It!
ClearAll

SetDir PASTA
If DirExists(PASTA)>0
   Then {Tools} {Info} {Inventory} {Tables} TypeIn PASTA Enter
        ClearAll 
        If Not IsEmpty("List")
           Then {Ask} {List}
                Moveto [Name] Check TypeIn "M.."
                Do_It!
                ClearAll
        EndIf
        If Not IsEmpty("Answer") 
           Then View "Answer"
                While True
                  NOME_TAB = [Name]
                  If SubStr(NOME_TAB,1,2) <> "M_"
                     Then Skip
                          If Eot() Then QuitLoop EndIf
                          Loop 
                  EndIf                                 
                  Aguarde("Aguarde, Ajustando COMANDO da tabela "+NOME_TAB)
                  Copy NOME_TAB Tabela2
                  
                  Coedit Tabela2
                  While True
                    If [Tipo de Comando]="S"
                       Then [Comando] = Upper([Comando])
                    EndIf
                    Skip
                    If Eot() Then QuitLoop EndIF   
                  EndWhile
                  Do_It!
                  ClearAll
                  
                  Coedit Tabela2
                  Scan
                    Aguarde("Aguarde, Ajustando Dados")
                    PosI = Search("SISTEMAS",Upper([Diretorio]))
                    If PosI > 0
                       Then PosI = PosI+9
                            DIRET = Upper(SubStr([Diretorio],PosI,Len([Diretorio])))
                            If SubStr(Rtrim(DIRET),Len(DIRET),1)="\\"
                               Then DIRET = SubStr(Rtrim(DIRET),1,Len(DIRET)-1)
                            EndIf
                            [Diretorio] = DIRET  
                    EndIf
                  EndScan
                  Do_It!
                  ClearAll
                  
                  {Ask} TypeIn Tabela2 Enter
                  Moveto [Comando        ] TypeIn "_Scr"
                  Moveto [Diretorio      ] TypeIn "_Dir"
                  Moveto [Tipo de Comando] TypeIn "S"
                  Moveto [Descricao      ] TypeIn "_Des"
                  {Ask} TypeIn Tabela Enter
                  Moveto [Script         ] TypeIn "_Scr"
                  Moveto [Diretorio      ] TypeIn "_Dir"   
                  Moveto [Tabela         ] Typein "Changeto ~NOME_TAB"
                  Moveto [Descricao      ] TypeIn "Changeto _Des"
                  Do_It!
                  ClearAll
                  View "Answer"
                  Moveto [Name]
                  Locate NOME_TAB
                  Skip
                  If Eot() Then QuitLoop EndIf
                EndWhile    
        EndIf
EndIf                  

Add Tabela "\\Sistemas\\Utilitar\\Pesq_Sc"
IMPRIREL("\\Sistemas\\Utilitar\\Pesq_Sc","R")
ClearAll  
      
ConfGeral("Deseja verificar os SCRIPTS que d„o PLAY a outros SCRIPTS ?")
If OK="S"
   Then Verifica_PesPal()
        Do_It!
        ClearAll
        IMPRIREL("\\Sistemas\\Utilitar\\Pesq_Sc","R")
        
        ConfGeral("Ainda existem SCRIPTS n„o localizados, deseja for‡ar a sua localiza‡Æo?")
        If OK="S"
           Then If Verifica_Script_Outros()
                   Then Do_It!
                        ClearAll
                        IMPRIREL("\\Sistemas\\Utilitar\\Pesq_Sc","R")
                EndIf        
                Do_It!
                ClearAll
        EndIf
EndIf                 

EndProc ;Array_Registro2()

;*******************************************************************************
;*                                                                             *
;*******************************************************************************
Proc Verifica_Script_Outros()

{Ask} {\\Sistemas\\Utilitar\\Pesq_Sc} Check
Moveto [Tabela] TypeIn "Blank"
Do_it!
ClearAll

CONT_ARRAY = 0
DynArray PESQ_SC[]

If IsEmpty("Answer")
   Then Return False
EndIf

View "Answer"
Scan
  CONT_ARRAY = CONT_ARRAY + 1
  PESQ_ARRAY[CONT_ARRAY] = Format("W30",DIR+"\\Sistemas\\"+[Diretorio]+"\\")+Format("W8",[Script]) 
EndScan
ClearAll   

Release Vars PESQ_PLAY
DynArray PESQ_PLAY[]

PALAVRA = "Play"
Caminho = "***"  
Verifica("Play")

If DynArraySize(PESQ_PLAY) > 0
   Then Coedit "\\Sistemas\\Utilitar\\Pesq_Sc"
        For iu From 1 To DynArraySize(PESQ_PLAY)
          TEMP_SCR  = SubStr(PESQ_PLAY[iu],1,8)
          TEMP_PLAY = Upper(Ltrim(Rtrim(SubStr(PESQ_PLAY[iu],9,Len(PESQ_PLAY[iu])))))
          
          AUX = TEMP_PLAY
          POS = Search("\\",AUX)
          If POS > 0
             Then While True
                    AUX = SubStr(AUX,POS+1,Len(AUX))
                    POS = Search("\\",AUX) 
                    If POS = 0
                       Then TEMP_PLAY = AUX 
                            QuitLoop   
                    EndIf
                  EndWhile 
          EndIf   
          
          Moveto [Script]
          Locate TEMP_PLAY
          If RetVal
             Then While True
                   If [Tabela] = ""
                      Then [Tabela   ] = "OUTROS"
                           [Descricao] = "SCRIPT  DE  ORIGEM: "+TEMP_SCR
                   EndIf   
                   Skip
                   If Eot() Then QuitLoop EndIf
                   Locate Next TEMP_PLAY
                   If Not RetVal
                      Then QuitLoop
                   EndIf
                 EndWhile     
          EndIf
        EndFor
EndIf
 
Return True

EndProc ;Verifica_Script_Outros()

;*******************************************************************************
;* Cabe‡alho                                                                   *
;*******************************************************************************
Proc Cabecalho()

Print File ARQIMP Chr(27)+Chr(120)+Chr(48)+Chr(18)
Print File ARQIMP "\n\n"
Print File ARQIMP Spaces(2)+Fill("-",77)+"\n"
Print File ARQIMP Spaces(2)+Format("W77,AC","LOCALIZACAO DO SCRIPT "+VSDG_SCRIPT)+"\n"
Print File ARQIMP Spaces(2)+Fill("-",77)+"\n\n"
Print File ARQIMP Spaces(2)+"TABELA   DIRETORIO                 DESCRICAO                               "+"\n"
Print File ARQIMP Spaces(2)+"-------- ------------------------- ----------------------------------------"+"\n"

LINHA = 7

EndProc ;Cabecalho()

;*******************************************************************************
;*                                                                             *
;*******************************************************************************
Proc SD_Dialog(Disparo,Campo,Evento,Elemento)
Temp=True
MSG_CAMPO=""
TECLA=""
If Disparo="OPEN"  Then AoCriarShowDialog() EndIf
If Disparo="EVENT" And Evento["Type"]="KEY" Then
   Switch
     Case Evento["KeyCode"] = 9: Temp=False
     Case Evento["KeyCode"] = -59: 
     Case Evento["KeyCode"] =  27:
          Temp=False
          Switch
            Case Campo="TG_SC"             : Campo="NO"
            Case Campo="YES" Or Campo="NO" : Campo="TG_SC"
          EndSwitch
     Case (Evento["KeyCode"] <= -104 And Evento["KeyCode"] >= -113) Or 
           Evento["KeyCode"]  = -139 Or  Evento["KeyCode"]  = -140:
           SYS_TECLA_ACIONADA=Evento["KeyCode"]
           Seta_Tecla_Acionada()
           CancelDialog
     Case Evento["KeyCode"] = 13: 
          Temp=False
          If Checa_TAG()
             Then Switch
                    Case Campo="TG_SC"  : Campo="YES"
                         If VSDGSC=1
                            Then VSDG_SCRIPT = ControlValue("TG_SC")
                                 If IsBlank(VSDG_SCRIPT)  
                                    Then Campo="TG_SC"
                                         Mensagem("O Script deve ser informado!")
                                 EndIf        
                         EndIf   
                  EndSwitch
          EndIf
          RefreshDialog
   EndSwitch
EndIf
Monta_Prompt(MSG_CAMPO,TECLA)
Return Temp
EndProc

;*******************************************************************************
;* ROTINA PRINCIPAL                                                            *
;*******************************************************************************
AutoLib="\\Sistemas\\Cadastro\\Bib_Show,\\Sistemas\\Cadastro\\Bibliot"
LimpAguarde()
SYS_VALOR()

If NOMEMPRESA=""
   Then MODO = "Interno" 
   Else MODO = "Menu"
EndIf   

PassWord("s01avclvi")
PassWord("FechaSys")
PassWord("t01avivcl")

ARQIMP = PrivDir()+"Diretor.Txt"
If IsFile(ARQIMP)
   Then Deleta_Arquivo(ARQIMP)
EndIf

DIR         = SubStr(Directory(),1,2)
CONTADOR    = 0  
VSDG_DIR    = ""
VSDG_SCRIPT = ""

While True
  PAG = 0
  Echo Normal
  Echo Off
  ShowDialog "[Script's] do Sistema" Proc "SD_Dialog"
  Trigger "OPEN","ARRIVE"
  Key "F1","ENTER","ESC","TAB",
    -104, -105, -106, -107, -108, -109, -110, -111, -112, -113, -139, -140  
    @ 05,12   Height 08 Width 50
    
    RadioButtons @ 01,02 Height 4 Width 46
      "Localizar Script                     ",
      "Localizar Script's em desuso/inativos" 
    Tag "TG_SC"
    To VSDGSC  

    Pushbutton @ 04,10 width 11 "~O~k"      OK     Default Value "Ok" Tag "YES" To BottonValue
    Pushbutton @ 04,24 width 11 "~C~ancela" CANCEL                    Tag "NO"  To BottonValue
  EndDialog
  If Not RetVal Then QuitLoop EndIf  

  If VSDGSC=1
     Then VSDG_SCRIPT = ""
          ClearAll
          ShowDialog "Verifica SCRIPT" Proc "SD_Dialog"
          Trigger "OPEN","ARRIVE"
          Key "F1","ENTER","ESC","TAB",
            -104, -105, -106, -107, -108, -109, -110, -111, -112, -113, -139, -140  
            @ 05,12   Height 07 Width 40
            
            Label  @ 00,00 "Script" For "TG_SC"
            Accept @ 01,01 Width 10 "A8"  Picture "!*!" Tag "TG_SC" To VSDG_SCRIPT
        
            Pushbutton @ 03,07 width 11 "~O~k"      OK     Default Value "Ok" Tag "YES" To BottonValue
            Pushbutton @ 03,21 width 11 "~C~ancela" CANCEL                    Tag "NO"  To BottonValue
        
          EndDialog
          If Not RetVal Then QuitLoop EndIf 
          
          IMPRIMIR = False
          Verifica_Arquivo()
          
          PDFZEBRA=False             
          DISPOSITIVO_OPCAO="V"     
          ImpriArq(ARQIMP)
          
    Else ;----- Localizar Script em Desuso/Inativo ------------------------------------------------     
         If Not IsTable("\\Sistemas\\Utilitar\\Pesq_Sc")
            Then Mensagem("N„o foi localizado a tabela Pesq_Sc no diret¢rio UTILITAR")
                 Return 
         EndIf
         Empty "\\Sistemas\\Utilitar\\Pesq_Sc"
         DISPOSITIVO()
         Diretorios()
         Verifica_Script2()
         Do_It!
         
         SetDir "\\Sistemas\\Cadastro"
         ClearAll       
  EndIf 
EndWhile
Release Vars All
Release Procs All