Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Juanjogomez

Pages: [1] 2 3 ... 8
1
Try something like this:

Code: QB64: [Select]
  1. Print "FOO: "; format$("###.###", "123.456789")
  2. Print format$("###,.##", "123456789.987654321")
  3.  
  4.  
  5. Function format$ (template As String, text As String)
  6.     d = _Dest: s = _Source
  7.     n = _NewImage(80, 80, 0)
  8.     _Dest n: _Source n
  9.     Print Using template; Val(text)
  10.     For i = 1 To 79
  11.         t$ = t$ + Chr$(Screen(1, i))
  12.     Next
  13.     If Left$(t$, 1) = "%" Then t$ = Mid$(t$, 2)
  14.     format$ = _Trim$(t$)
  15.     _Dest d: _Source s
  16.     _FreeImage n

Pass it the same format string you'd use with PRINT USING, and then the STR$ value of your number.  It'll return a string formatted just as PRINT USING would do.

Very original, simple and effective

2
QB64 Discussion / Re: BEEP makes program load faster
« on: February 18, 2022, 02:31:37 pm »
Thanks for the information. I did not know, I did not know it.

3
QB64 Discussion / Re: BEEP makes program load faster
« on: February 18, 2022, 01:36:48 am »
One thing to keep in mind with the Beep command is that if the program is run on a desktop computer that doesn't have speakers, it will fail and crash. This is because windows disables the sound card when it doesn't detect speakers.
That problem drove me crazy back in the day (why the program worked fine on some computers and not on others) and in the end I had to remove them all.
Regards

4
QB64 Discussion / Re: Error downloading file from dropbox
« on: February 12, 2022, 02:40:52 pm »
Thanks for answering.

I apologize for the insistence, but until now I have always had answers to the questions I have had.

First of all say that I am very grateful for the efforts of all those who are developing QB64. I had a program that had been outdated in QB45, and now with QB64 and the possibilities it has to work with SQL databases, remote connection, use of laser printers, etc, etc, etc. they have made it possible to completely renew it.

On the specific subject of this post, it all started when I asked for help to see how I could download files from dropbox so that my program would update automatically. SpriggsySprigss gave me a program that worked perfectly and I was able to use and adapt (from here my thanks to him), and you yourself told me that I should change the link ending from d=0 to d=1 so that it could be downloaded (thanks also for aid).

The problem arises when, for a few days, that program does not work and gives me the error "Error : HTTPQueryInfo". Since I don't know how the program that SpriggsySpriggs told me works
 (my knowledge of QB64 is limited on that subject) that's why I asked for help again thinking that something had changed so that the program no longer works. I don't think the Dropbox community can tell me where the problem is with a program written in QB64.

I am sorry to have bothered you with my insistence.

Greetings

5
QB64 Discussion / Re: Error downloading file from dropbox
« on: February 12, 2022, 05:48:48 am »
Can anyone help me?

6
QB64 Discussion / Re: Error downloading file from dropbox
« on: February 07, 2022, 07:21:09 am »
Does anyone know anything about this error?
So far the program that SpriggsySpriggs gave me has worked fine.

7
QB64 Discussion / Error downloading file from dropbox
« on: February 06, 2022, 03:43:45 am »
Hi all,
Until now, I was using a utility to update my clients' programs using a program pointed out to me by SpriggsySpriggs and SmcNeil at this link: https://qb64forum.alephc.xyz/index.php?topic=4454.0;prev_next=prev#new
All I had to do was change the final dl=0 to dl=1.
Everything was going fine until yesterday, when the program did not download the file and gave an error: "Error : HTTPQueryInfo" and the program closed. Do you know if there has been any change in Dropbox that makes it not possible to download the files in this way?
Thank you and regards

8
QB64 Discussion / Re: Download files
« on: December 26, 2021, 03:11:15 am »
@SpriggsySpriggs MERRY CHRISTMAS!! Thanks for your help

9
QB64 Discussion / Re: Download files
« on: December 25, 2021, 06:33:14 am »
Thanks to all

10
QB64 Discussion / Re: Download files
« on: December 25, 2021, 04:40:57 am »
I have tried it again and I have seen that when the 0 is changed to a 1, the program downloads perfectly.
With this link it does not work:

https://www.dropbox.com/s/t6y91q4yjys35j7/ALTERAN.exe?dl=0

And changing the final figure, it downloads it perfectly:

https://www.dropbox.com/s/t6y91q4yjys35j7/ALTERAN.exe?dl=1

I do not know why

11
QB64 Discussion / Re: Download files
« on: December 25, 2021, 04:25:32 am »
I just tried it and it only downloaded 58 Kb, when the original has 2,758 Kb, what could be the problem? Thanks

12
QB64 Discussion / Download files
« on: December 25, 2021, 01:48:44 am »
Hello everyone and Merry Christmas.

I have tried continuing this thread, but I think it is closed. https://qb64forum.alephc.xyz/index.php?topic=4411.msg138383#msg138383

I keep trying how to download files and with the examples that you gave me in the other thread, I still can't get it.


I'm trying to download a file from my dropbox with this code, but nothing is downloading.

Code: QB64: [Select]
  1. DEFINT A-Z
  2.  
  3. CrLf$ = CHR$(13) + CHR$(10) ' carriage return + line feed ASCII characters
  4.  
  5. Host = _OPENHOST("TCP/IP:319")
  6. IF Host THEN
  7.     PRINT "> Server started succesfully."
  8.  
  9.     '// Change this to the file's public link
  10.     IP_File$ = "www.dropbox.com/s/t6y91q4yjys35j7/ALTERAN.exe?dl=0" 'a Drop Box link
  11.  
  12.     URL$ = LEFT$(IP_File$, INSTR(IP_File$, "/") - 1)
  13.     Path$ = MID$(IP_File$, INSTR(IP_File$, "/"))
  14.     Client& = _OPENCLIENT("TCP/IP:80:" + URL$)
  15.     IF Client& THEN
  16.         Request$ = "GET " + Path$ + " HTTP/1.1" + CrLf$ + "Host:" + URL$ + CrLf$ + CrLf$
  17.         PRINT Request$
  18.         PUT #Client&, , Request$
  19.         DO: _LIMIT 20 '              load response header
  20.             GET #Client&, , Dat$
  21.             Header$ = Header$ + Dat$
  22.         LOOP UNTIL INSTR(Header$, CrLf$ + CrLf$) ' Loop until 2 CRLFs (end of HTML header) are found
  23.         PRINT "Header Done."
  24.         PRINT Header$
  25.  
  26.         ' Get file size from header
  27.         SizePos = INSTR(UCASE$(Header$), "CONTENT-LENGTH:") + 16
  28.         SizeEnd = INSTR(SizePos, Header$, CrLf$)
  29.         FileSize& = VAL(MID$(Header$, SizePos, (SizeEnd - SizePos) + 1))
  30.         PRINT "File size is"; FileSize&; "bytes"
  31.         EndPos = INSTR(Header$, CrLf$ + CrLf$) + 4
  32.         Response$ = MID$(Header$, EndPos) ' get data after header already downloaded
  33.  
  34.         start = 1 '// Get file name from original URL path if necessary
  35.         DO '// Change this to destination local file name and path...
  36.             posit = INSTR(start, IP_File$, "/")
  37.             IF posit THEN lastpos = posit: start = posit + 1
  38.         LOOP UNTIL posit = 0
  39.         File$ = MID$(IP_File$, lastpos + 1) 'beware of tag suffixes
  40.         OPEN File$ FOR BINARY AS #1
  41.         DO: _LIMIT 20
  42.             PUT #1, , Response$
  43.             GET #Client&, , Response$
  44.         LOOP UNTIL LOF(1) >= FileSize&
  45.         PRINT "File download completed!"
  46.         CLOSE #1
  47.     ELSE
  48.         PRINT "Failed to connect."
  49.     END IF
  50.     PRINT "Failed to create server connection..."

Could someone pass me some code to download that file or another, just renaming?

Thanks in advance.



13
How about being able to output direct to a PDF file? I did try playing around with that but failed miserably.
I think the same. It would be very useful

14
QB64 Discussion / Re: How to download file
« on: November 24, 2021, 01:10:51 pm »
Thanks, i will try this.
This forum is wonderful and QB64 too

15
QB64 Discussion / Re: How to download file
« on: November 24, 2021, 12:53:38 pm »
There's a simple download routine in our wiki at http://www.qb64.org/wiki/Downloading_Files

Notice it won't work over secure https connection though, but it can still be useful. It's the same base code we use in the IDE to download wiki pages and update information, as well as the same code InForm uses for its installer/autoupdater, so you know it works.
Thanks FellipeHeitor,
I will try everything you have told me

I do have code for downloading HTTPS files and for FTP but it's been a while. Are you on Windows? If so, then it could be useful. Otherwise, no.

Yes, I use Windows.
I would appreciate if you could pass me the code. See if I can do it.

Pages: [1] 2 3 ... 8