Hello i used this code for years, but with new version of windows 11 23H2 this macro dont work i dont know what to do, becaue with old version 22H2 work perfect, but my company wants update my system and cant because needed this for work
[PCOMM SCRIPT HEADER]
LANGUAGE=VBSCRIPT
DESCRIPTION=
[PCOMM SCRIPT SOURCE]
OPTION EXPLICIT
autECLSession.SetConnectionByName(ThisSessionName)
REM This line calls the macro subroutine
subSub1_
sub subSub1_()
dim pdv
dim itmi
dim cx
dim x, a
dim fim
dim finded
dim lista(5000000,3)
Dim oFSO, sFile, oFile, sText, objxls
Set oFSO = CreateObject("Scripting.FileSystemObject")
sFile = "C:\Program Files (x86)\IBM\Personal Communications\private\dadosMEA.txt"
REM' dados para teste, estes dados deverão de entrar diretamente de uma BD
REM' *******************************************************************************************
'************************DESCRICOES ************************
lista(1109954,1) = "LIMAO CL 3/5 ARG VNC C 2 "
'" "
'************************FILIAIS ************************
lista(1109954,2) = "043"
'************************FAMILIAS ************************
lista(1109954,3) = "405"
If oFSO.FileExists(sFile) Then
Set oFile = oFSO.OpenTextFile(sFile, 1)
Do While Not oFile.AtEndOfStream
sText = oFile.ReadLine
If Trim(sText) <> "" Then
a = sText
End If
REM' Entrada de dados manual para teste
a = Split(a,",")
pdv = a(0)
itmi = a(1)
cx = a(2)
REM' *******************************************************************************************
REM' *******************************************************************************************
autECLSession.autECLPS.SetCursorPos 10,21 REM' colocar o cursor para carregar o PDV
autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys pdv
autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[ENTER]"
autECLSession.autECLPS.SendKeys "[ENTER]"
autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SetCursorPos 20,66 REM' colocar o cursor para carregar a filial e familia
autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys lista(itmi,2) REM' BUGFIX - 22072016 - Allow to use all branches
autECLSession.autECLPS.SendKeys lista(itmi,3) REM' carregar familia
autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[ENTER]"
autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLOIA.WaitForInputReady
fim = "false"
do while fim <> "FIN DE LISTE" REM' loop do while para precorrer as paginas disponiveis
REM' ciclo para correr as linhas de cada pagina
for x = 7 to 18
REM' carregar em "finded" o conteudo dos 30 caracteres da linha
finded = autECLSession.autECLPS.GetText(x, 5, 30)
if finded = lista(itmi,1) then
REM' comparar a linha com o que se está a procurar
autECLSession.autECLPS.SetCursorPos x,54 REM' se encontrar a string certa carregar o valor
autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLOIA.WaitForInputReady
REM implementar função para detetar se já há algum valor na linha
autECLSession.autECLPS.SendKeys cx
autECLSession.autECLPS.SendKeys "[ENTER]"
autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLOIA.WaitForInputReady
fim = "FIN DE LISTE"
end if
next
fim = autECLSession.autECLPS.GetText(21, 2, 12) REM procurar e carregar em "fim" a string que aparece quando é a ultima pagina
autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[pf8]"
autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLOIA.WaitForInputReady
loop
autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[pf3]"
autECLSession.autECLPS.SendKeys "[pf11]"
loop
End If
end sub
[PCOMM SCRIPT HEADER]
LANGUAGE=VBSCRIPT
DESCRIPTION=
[PCOMM SCRIPT SOURCE]
OPTION EXPLICIT
autECLSession.SetConnectionByName(ThisSessionName)
REM This line calls the macro subroutine
subSub1_
sub subSub1_()
dim pdv
dim itmi
dim cx
dim x, a
dim fim
dim finded
dim lista(5000000,3)
Dim oFSO, sFile, oFile, sText, objxls
Set oFSO = CreateObject("Scripting.FileSystemObject")
sFile = "C:\Program Files (x86)\IBM\Personal Communications\private\dadosMEA.txt"
REM' dados para teste, estes dados deverão de entrar diretamente de uma BD
REM' *******************************************************************************************
'************************DESCRICOES ************************
lista(1109954,1) = "LIMAO CL 3/5 ARG VNC C 2 "
'" "
'************************FILIAIS ************************
lista(1109954,2) = "043"
'************************FAMILIAS ************************
lista(1109954,3) = "405"
If oFSO.FileExists(sFile) Then
Set oFile = oFSO.OpenTextFile(sFile, 1)
Do While Not oFile.AtEndOfStream
sText = oFile.ReadLine
If Trim(sText) <> "" Then
a = sText
End If
REM' Entrada de dados manual para teste
a = Split(a,",")
pdv = a(0)
itmi = a(1)
cx = a(2)
REM' *******************************************************************************************
REM' *******************************************************************************************
autECLSession.autECLPS.SetCursorPos 10,21 REM' colocar o cursor para carregar o PDV
autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys pdv
autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[ENTER]"
autECLSession.autECLPS.SendKeys "[ENTER]"
autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SetCursorPos 20,66 REM' colocar o cursor para carregar a filial e familia
autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys lista(itmi,2) REM' BUGFIX - 22072016 - Allow to use all branches
autECLSession.autECLPS.SendKeys lista(itmi,3) REM' carregar familia
autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[ENTER]"
autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLOIA.WaitForInputReady
fim = "false"
do while fim <> "FIN DE LISTE" REM' loop do while para precorrer as paginas disponiveis
REM' ciclo para correr as linhas de cada pagina
for x = 7 to 18
REM' carregar em "finded" o conteudo dos 30 caracteres da linha
finded = autECLSession.autECLPS.GetText(x, 5, 30)
if finded = lista(itmi,1) then
REM' comparar a linha com o que se está a procurar
autECLSession.autECLPS.SetCursorPos x,54 REM' se encontrar a string certa carregar o valor
autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLOIA.WaitForInputReady
REM implementar função para detetar se já há algum valor na linha
autECLSession.autECLPS.SendKeys cx
autECLSession.autECLPS.SendKeys "[ENTER]"
autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLOIA.WaitForInputReady
fim = "FIN DE LISTE"
end if
next
fim = autECLSession.autECLPS.GetText(21, 2, 12) REM procurar e carregar em "fim" a string que aparece quando é a ultima pagina
autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[pf8]"
autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLOIA.WaitForInputReady
loop
autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[pf3]"
autECLSession.autECLPS.SendKeys "[pf11]"
loop
End If
end sub