Forum Replies Created
-
AuthorPosts
-
Hi Tony,
First thing to do is to modify the NI Driver call in your software, normally in the “AUTOST” program
LOAD BIN “GPIBNI;DEV GPIB0 ISC 7”
“GPIB0” and “ISC7” need to be compatible with what you have in your NIMAX parametersDecember 12, 2024 at 10:11 am in reply to: unexpected error 7 “undefined Function or Subprogram” #9415Hi Paolo,
“htb8dde.csb” is a tool from the MS Office interfaceThe best way may be to ask them directly why you are encountering this unexpected error
I’m interested, what’s new or updated ?
Hi all,
Thanks for the link. I downloaded the last HTBasic version 21.1.015 and the results are indeed differents.
With this new HTB version the program don’t stop now before the end but from L64C64 cell, the reading in the EXCEL file are always empty (Return$=””)
Very mysterious …Hi Ralph,
please could share me the link where I can download the latest HTBasic version ?Thanks PatB for your Tips.
The code display is beautiful now 🙂Hi PatB,
my test results with HTBasic 2021 are not better. The program stops and closes without an error message. According to my displays this happens while it tries to read the values on line 64 but the column seems more random…
Well anyway, I’m going to use the alternative method recommended by Ralph which works whatever the HTBasic version.
I put here my code using EXCEL reading which is defectiveCONFIGURE LONGFILENAMES ON DLL UNLOAD ALL OPTION BASE 1 ! CLEAR SCREEN KEY LABELS OFF ! DIM C$[200] DIM Return$[50] DIM Data$(1:200,1:259)[20] DIM Disque1$[80],Disque2$[80],Disque3$[80] DIM Htb_version$[80] ! LONG Hconvexcel! Excel conversation handle LONG Retval ! Return value for the DLL functions ! !------------------------------------------------ ! Computers configuration !------------------------------------------------ Htb_version$=SYSTEM$("VERSION:HTB") Htb_version$=TRIM$(Htb_version$) ! SELECT Htb_version$ ! CASE "Windows Release 10.0.3" Disque1$="C:\Program Files (x86)\HTBwin10\DLL Toolkit\Samples\HTBDde" ! 22/01/2009 13:32 => Runtime Error : L64C32 (16379) Disque2$="C:\Program Files (x86)\Microsoft Office\root\Office16" ! EXCEL 2010 Disque3$="C:\HP_progs\Progs" ! CASE "Windows Release 10.1.3" Disque1$="C:\Program Files (x86)\HTBwin 10.1\DLL Toolkit\Samples\HTBDde"! 22/01/2009 13:32 => Runtime Error : L64C32 !Disque1$="C:\Program Files (x86)\HTBasic 2021\DLL Toolkit\Samples\HTBDde" ! 14/11/2020 09:44 => Runtime Error : L64C32 Disque2$="C:\Program Files (x86)\Microsoft Office\root\Office16" ! EXCEL 2010 Disque3$="C:\HP_progs\Progs" ! CASE "Windows Release 21.1.009" Disque1$="C:\Program Files (x86)\HTBasic 2021\DLL Toolkit\Samples\HTBDde"! 14/11/2020 09:44 => HTBasic Close : L64C... !Disque1$="C:\Program Files (x86)\HTBwin 10.1\DLL Toolkit\Samples\HTBDde" ! 22/01/2009 13:32 => HTBasic Close : L64C... Disque2$="C:\Program Files (x86)\Microsoft Office\root\Office16" ! EXCEL 2010 Disque3$="C:\HP_progs\Progs" ! END SELECT ! PRINT Htb_version$ PRINT Disque1$ PRINT Disque2$ PRINT Disque3$ PRINT ! !------------------------------------------------ ! HTBDDE dll !------------------------------------------------ MASS STORAGE IS Disque1$ ! Go to DDE Directory ! DLL LOAD "HTBDDE" DLL GET "LONG HTBDDE:Ddeconnect" DLL GET "SHORT HTBDDE:Ddeterminate" DLL GET "LONG HTBDDE:Ddetimeout" DLL GET "SHORT HTBDDE:Ddeexecute" DLL GET "SHORT HTBDDE:Ddepoke" DLL GET "CHARPTR HTBDDE:Dderequest" DLL GET "SHORT HTBDDE:Runexe" ! MASS STORAGE IS Disque3$ ! Return to my Directory ! LIST DLL ! !------------------------------------------- ! Connect to the EXCEL System topic !------------------------------------------- Hconvexcel=0 Hconvexcel=FNDdeconnect("Excel","System") ! IF Hconvexcel=0 THEN ! ! If we couldn't connect, lauch EXCEL and try again ! C$=Disque2$&"\Excel.exe" C$=TRIM$(C$) ! Retval=0 Retval=FNRunexe(C$,1) ! PAUSE ! Very long !!! I prefer to WAIT and [CONTINUE] manually ! ! when EXCEL is open ! Hconvexcel=0 WHILE Hconvexcel=0 Hconvexcel=FNDdeconnect("Excel","System") WAIT .1 END WHILE ! ELSE ! GOTO Exit ! END IF ! !------------------------------------------- ! OPEN selected workbook in DDE Directory !------------------------------------------- Fich$="sample.xlsx" ! C$=Disque1$&"\"&Fich$ C$="[OPEN("""&C$&""")]" C$=TRIM$(C$) ! Retval=0 Retval=FNDdeexecute(Hconvexcel,C$) ! !-------------------------------------------- ! Connexion on the selected Sheet !-------------------------------------------- Hconvexcel=0 Hconvexcel=FNDdeconnect("Excel","Sheet1") ! !-------------------------------------------- ! Read EXCEL Datas !-------------------------------------------- ! => Error after 16379 read (L64C62) ??? !-------------------------------------------- Row$="L" Line_max=200 Column_max=259 ! Total=0 FOR Line=1 TO Line_max FOR Column=1 TO Column_max ! C$="" C$=Row$&VAL$(Line)&"C"&VAL$(Column) C$=TRIM$(C$) Return$="" Return$=FNDderequest$(Hconvexcel,C$) ! Total=Total+1 Data$(Line,Column)=Return$ PRINT Total,C$,Data$(Line,Column) ! !C$="[SELECT("""&C$&""")]" !C$=TRIM$(C$) !Retval=0 !Retval=FNDdeexecute(Hconvexcel,C$) ! NEXT Column NEXT Line ! ! !-------------------------------------------- ! Terminate the connection with EXCEL !-------------------------------------------- Exit: IF Hconvexcel=1 THEN Retval=0 Retval=FNDdeterminate(Hconvexcel)! Terminate EXCEL DDE conversation END IF ! DLL UNLOAD "HTBDDE" ! Unload DDE dll PRINT "Finished" KEY LABELS ON ! ENDHi Ralph,
Thanks a lot for your alternative method. That’s a really good idea that I hadn’t thought of 🙂
Please find below my new code applied …
I note your proposal for the HTBasic 2021 test, I will send you an email very soon
Regards,
LTKPS:
I confirm it’s not easy to paste HTBasic code in the forum.
I’m very curious to know how PatB managed to keep his indentation in his message !CONFIGURE LONGFILENAMES ON
DLL UNLOAD ALL
CLEAR SCREEN
KEY LABELS OFF
!
DIM C$[200]
DIM Data$(1:200,1:259)[20]
DIM Disque1$[80],Disque2$[80],Disque3$[80]
!
Nb1=259*20 ! Nb of values / Lines
Nb2=259-1 ! Nb of separator
Nb3=2 ! Line Terminator [CR]
Nb=Nb1+Nb2+Nb3
!
ALLOCATE Lines$(200)[Nb]
!
LONG Hconvexcel! Excel conversation handle
LONG Retval ! Return value for the DLL functions
!
Pc=1 ! Computer choice
!
!————————————————
! Computers configuration
!————————————————
SELECT Pc
CASE 1 ! HTBasic 10.1
Disque1$=”C:\Program Files (x86)\HTBwin 10.1\DLL Toolkit\Samples\HTBDde”! 22/01/2009 13:32
!Disque1$=”C:\Program Files (x86)\HTBwin 10.1\DLL Toolkit\Samples\HTBDde” ! 14/11/2020 08:44
Disque2$=”C:\Program Files (x86)\Microsoft Office\root\Office16″ ! EXCEL 2010
Disque3$=”C:\HP_progs\Progs”
CASE 2 ! HTBasic 10.0
Disque1$=”C:\Program Files (x86)\HTBwin10\DLL Toolkit\Samples\HTBDde” ! 22/01/2009 13:32
Disque2$=”C:\Program Files (x86)\Microsoft Office\Office14″ ! EXCEL 2010
Disque3$=”C:\HP_progs\Progs”
END SELECT
!
!————————————————
! HTBDDE dll
!————————————————
MASS STORAGE IS Disque1$ ! Go to DDE Directory
!
DLL LOAD “HTBDDE”
DLL GET “LONG HTBDDE:Ddeconnect”
DLL GET “SHORT HTBDDE:Ddeterminate”
DLL GET “LONG HTBDDE:Ddetimeout”
DLL GET “SHORT HTBDDE:Ddeexecute”
DLL GET “SHORT HTBDDE:Ddepoke”
DLL GET “CHARPTR HTBDDE:Dderequest”
DLL GET “SHORT HTBDDE:Runexe”
!
MASS STORAGE IS Disque3$ ! Return to my Directory
!
!——————————————-
! Connect to the EXCEL System topic
!——————————————-
Hconvexcel=0
Hconvexcel=FNDdeconnect(“Excel”,”System”)
!
IF Hconvexcel=0 THEN
!
! If we couldn’t connect, lauch EXCEL and try again
!
C$=Disque2$&”\Excel.exe”
C$=TRIM$(C$)
!
Retval=0
Retval=FNRunexe(C$,1)
!
PAUSE ! Sometime Very long !!! For the moment I prefer to WAIT and [CONTINUE] manually
! ! when EXCEL is open, I will work on it with Taskmanager …
!
Hconvexcel=0
WHILE Hconvexcel=0
Hconvexcel=FNDdeconnect(“Excel”,”System”)
WAIT .1
END WHILE
!
ELSE
!
GOTO Exit
!
END IF
!
!——————————————-
! OPEN selected workbook in DDE Directory
!——————————————-
Fich$=”sample.xlsx”
!
C$=Disque1$&”\”&Fich$
C$=”[OPEN(“””&C$&”””)]”
C$=TRIM$(C$)
!
Retval=0
Retval=FNDdeexecute(Hconvexcel,C$)
WAIT 1
!
!——————————————-
! PURGE csv File if existing …
!——————————————-
Fich$=Fich$[1,POS(Fich$,”.xlsx”)-1]&”.csv”
Fich$=Disque1$&”\”&Fich$
!
ON ERROR GOSUB Err
PURGE Fich$
OFF ERROR
WAIT 1
!
!——————————————-
! SAVE AS csv
!——————————————-
C$=”[Save.As(“””&Fich$&”””,23)]” ! 23 is the file type for csv
C$=TRIM$(C$)
!
Retval=0
Retval=FNDdeexecute(Hconvexcel,C$)
WAIT 1
!
!——————————————-
! CLOSE EXCEL Activ File
!——————————————-
Retval=0
Retval=FNDdeexecute(Hconvexcel,”[File.Close(0)]”)
WAIT 1
!
!——————————————-
! READ csv File with HTBasic
!——————————————-
ASSIGN @Samples TO Fich$;FORMAT ON
FOR Row=1 TO 200
ENTER @Samples;Lines$(Row)
NEXT Row
ASSIGN @Samples TO *
!
Total=0
!
FOR Row=1 TO 200
!
GOSUB Split ! get comma delimited data from Lines
!
FOR Column=1 TO 259
Total=Total+1
PRINT Total,Row,Column,Data$(Row,Column)
NEXT Column
!
NEXT Row
!
PRINT “Total =”;Total
GOTO Exit
!
!
!———————————————
Err: ! ERROR management
!———————————————
ERROR RETURN
!
!
!———————————————
Split: ! Extract delimited values from string
!———————————————
IF POS(Lines$(Row),”,”) THEN C$=”,”
IF POS(Lines$(Row),”;”) THEN C$=”;”
!
J$=””
Column=1
FOR I=1 TO LEN(Lines$(Row))
IF Lines$(Row)[I,I]<>C$ THEN
J$=J$&Lines$(Row)[I,I]
ELSE
Position=I
Data$(Row,Column)=J$
J$=””
Column=Column+1
END IF
NEXT I
Data$(Row,Column)=Lines$(Row)[Position+1,LEN(Lines$(Row))]
RETURN
!
!
!——————————————–
! Terminate the connection with EXCEL
!——————————————–
Exit: IF Hconvexcel=1 THEN
Retval=0
Retval=FNDdeterminate(Hconvexcel)! Terminate EXCEL DDE conversation
END IF
!
DLL UNLOAD “HTBDDE” ! Unload DDE dll
KEY LABELS ON
!
ENDHi PatB,
Thanks for help and test.
I made some modifications in my code according to yours (please find below my complete updated code)
Unfortunatly after a lot of tests on different computers, 2 different EXCEL version, 2 different HTBDDE.dll version, different EXCEL files (including one completely blank EXCEL file) I always have the same error.
My maximum number of read is 16379 (L64C62) …!!!
Please could re-test my last code on your computer and verify on your side ?
Thanks again
Regards,
ZeRiderCONFIGURE LONGFILENAMES ON
!
DLL UNLOAD ALL
!
DIM C$[200]
DIM Return$[50]
DIM Disque1$[80],Disque2$[80],Disque3$[80]
DIM Data$(1:200,1:259)[20]
!
LONG Hconvexcel! Excel conversation handle
LONG Retval ! Return value for the DLL functions
!
Pc=1 ! Computer choice
!
!————————————————
! Computers configuration
!————————————————
SELECT Pc
CASE 1 ! HTBasic 10.1
Disque1$=”C:\Program Files (x86)\HTBwin 10.1\DLL Toolkit\Samples\HTBDde”! 22/01/2009 13:32
!Disque1$=”C:\Program Files (x86)\HTBwin 10.1\DLL Toolkit\Samples\HTBDde”! 14/11/2020 08:44
Disque2$=”C:\Program Files (x86)\Microsoft Office\root\Office16″ ! EXCEL 2010
Disque3$=”C:\HP_progs\Progs”
CASE 2 ! HTBasic 10.0
Disque1$=”C:\Program Files (x86)\HTBwin10\DLL Toolkit\Samples\HTBDde” ! 22/01/2009 13:32
Disque2$=”C:\Program Files (x86)\Microsoft Office\Office14″ ! EXCEL 2010
Disque3$=”C:\HP_progs\Progs”
END SELECT
!
!————————————————
! HTBDDE dll
!————————————————
MASS STORAGE IS Disque1$ ! Go to DDE Directory
!
DLL LOAD “HTBDDE”
DLL GET “LONG HTBDDE:Ddeconnect”
DLL GET “SHORT HTBDDE:Ddeterminate”
DLL GET “LONG HTBDDE:Ddetimeout”
DLL GET “SHORT HTBDDE:Ddeexecute”
DLL GET “SHORT HTBDDE:Ddepoke”
DLL GET “CHARPTR HTBDDE:Dderequest”
DLL GET “SHORT HTBDDE:Runexe”
!
MASS STORAGE IS Disque3$ ! Return to my Directory
!
!——————————————-
! Connect to the EXCEL System topic
!——————————————-
Hconvexcel=0
Hconvexcel=FNDdeconnect(“Excel”,”System”)
!
IF Hconvexcel=0 THEN
!
! If we couldn’t connect, lauch EXCEL and try again
!
C$=Disque2$&”\Excel.exe”
C$=TRIM$(C$)
!
Retval=0
Retval=FNRunexe(C$,1)
!
PAUSE ! Very long !!! I prefer to WAIT and [CONTINUE] manually
! ! when EXCEL is open
!
Hconvexcel=0
WHILE Hconvexcel=0
Hconvexcel=FNDdeconnect(“Excel”,”System”)
WAIT .1
END WHILE
!
ELSE
!
GOTO Exit
!
END IF
!
!——————————————-
! OPEN selected workbook in DDE Directory
!——————————————-
Fich$=”sample.xlsx”
!
C$=Disque1$&”\”&Fich$
C$=”[OPEN(“””&C$&”””)]”
C$=TRIM$(C$)
!
Retval=0
Retval=FNDdeexecute(Hconvexcel,C$)
!
!——————————————–
! Connexion on the selected Sheet
!——————————————–
Hconvexcel=FNDdeconnect(“Excel”,”Sheet1″)
!
!——————————————–
! Read EXCEL Datas
!——————————————–
Row$=”L”
Line_max=200
Column_max=259
!
Total=0
FOR Line=1 TO Line_max
FOR Column=1 TO Column_max
!
C$=””
C$=Row$&VAL$(Line)&”C”&VAL$(Column)
C$=TRIM$(C$)
Return$=””
Return$=FNDderequest$(Hconvexcel,C$)
!
Total=Total+1
Data$(Line,Column)=Return$
PRINT Total,C$,Data$(Line,Column)
!
!C$=”[SELECT(“””&C$&”””)]”
!C$=TRIM$(C$)
!Retval=0
!Retval=FNDdeexecute(Hconvexcel,C$)
!
NEXT Column
NEXT Line
!
PRINT “Finished”
!
!——————————————–
! Terminate the connection with EXCEL
!——————————————–
Exit: IF Hconvexcel=1 THEN
Retval=0
Retval=FNDdeterminate(Hconvexcel)! Terminate EXCEL DDE conversation
END IF
!
DLL UNLOAD “HTBDDE” ! Unload DDE dll
!
END-
This reply was modified 2 years, 3 months ago by
ZeRider.
Do you have made the configuration of the WIN-PRNT print driver in the HTBasic Device Setup ?
I found out why it didn’t work.
The “primary address” of the NI interface was not initialized to 7.
Fixed by changing configuration with NI-MAXI confirme it’s possible to use NI interface (GPIBNI driver) with KEYSIGHT instruments
I used these configuration many time in the past but I will try to install KEYSIGHT VISA as Secondary and re-test …
I keep you informHi Ralph,
I have HTBasic rev 21. Now there is an automatic search when you try to add a new device but nothing is found at the end of the procedure …
I tried to add manually the GPIBNI driver (gpib0) , but when I try the classic Idn? on my instrument (Keysight Analyzer) I have the error “Interface not present”
I can’t add manually the USBS driver because the Agilent I/O libraries aren’t installed-
This reply was modified 2 years, 6 months ago by
ZeRider.
Hi Ralph,
I confirm the button is correctly parameterized by the -1/+1 but no change with the keyboard input.
The default button is always validated par the “ENTER/RETURN”
Thanks for reporting the bug.Hi Ralph,
thank for proposal but seem to not work on my computer (HTBasic 10.1.3 + Windows 11) … 🙁
When I press “ENTER” it’s still like I click on “YES”CLEAR SCREEN
KEY LABELS OFF
CONTROL KBD,7;3
!
!**************
! MESSAGE BOX :
!**************
Btn=0
!
P$(1)=”File Storage ?” ! Button 0=YES / Button 1=NODIALOG “QUESTION”,P$(1),Btn
!
IF Btn=0 THEN PRINT “Storage File : YES”
IF Btn=1 THEN PRINT “Storage File : NO”
!
KEY LABELS ON
CONTROL KBD,7;0
END -
This reply was modified 2 years, 3 months ago by
-
AuthorPosts