Search found 1174 matches

by Seymour Clufley
Wed Nov 19, 2025 6:57 am
Forum: Feature Requests and Wishlists
Topic: VectorParagraphWidth
Replies: 0
Views: 73

VectorParagraphWidth

This would be a very useful function. It would return the width of the widest line after the given text has been wrapped to the given width. Obviously, the flags from VectorTextWidth() should be supported.
by Seymour Clufley
Fri Sep 26, 2025 4:39 am
Forum: Bugs - Windows
Topic: [Done] PB 6.30B2 SetGadgetItemText has length limit with WebViewGadget
Replies: 2
Views: 1204

[Done] PB 6.30B2 SetGadgetItemText has length limit with WebViewGadget

There seems to be a length limit, so that trying to load a very long HTML string doesn't work. You can tell this because the HTML onload event (an alert box) doesn't occur.

This bug can be worked around by saving the HTML to file and loading that in the gadget using SetGadgetText, but still.

This ...
by Seymour Clufley
Sun Aug 10, 2025 3:41 am
Forum: Tricks 'n' Tips
Topic: PureTelegram (framework for using the Telegram API)
Replies: 102
Views: 34421

Re: PureTelegram (framework for using the Telegram API)

Just a small update (link in OP).
Added: EditMessageLiveLocation()
Added: StopMessageLiveLocation()
Added: ForwardMessages()
Added: CopyMessages()
Changed: posting functions now accept a TelegramOptions structure instead of various separate parameters
by Seymour Clufley
Wed Jun 11, 2025 3:47 pm
Forum: Tricks 'n' Tips
Topic: Posting on Twitter/X
Replies: 11
Views: 4814

Re: Posting on Twitter/X

Thanks, but hopefully there won't be much need for me to keep hacking at it, once the API is stabilised. There's really not much you can do with the free version of it, which is what I have.

The only future change I'm waiting for is the ability to post articles.
by Seymour Clufley
Tue Jun 10, 2025 8:28 pm
Forum: Coding Questions
Topic: Sending file data within JSON
Replies: 9
Views: 1116

Re: Sending file data within JSON

Apparently you would use Base64 and that's how it is integrated into the JSON. But I've found a different way - multi-part form-data - which doesn't use JSON at all.
by Seymour Clufley
Tue Jun 10, 2025 8:27 pm
Forum: Tricks 'n' Tips
Topic: Posting on Twitter/X
Replies: 11
Views: 4814

Re: Posting on Twitter/X

Updated again. For images, use Twitter_UploadImageFile() or Twitter_UploadPBImage(). For videos and gifs, use Twitter_UploadMediaFileChunked(), which can also handle image files and is "preferred" by X to the single-call uploads done by the other two procedures.
by Seymour Clufley
Sun Jun 08, 2025 7:16 am
Forum: Coding Questions
Topic: Sending file data within JSON
Replies: 9
Views: 1116

Re: Sending file data within JSON

The "media_data" field was in v1.1 but deprecated with v2. This tutorial is for v1.1. This is the v2 doc.

When I try to call "APPEND" using a multi-part form data request instead of using JSON, I get this error response:

{"errors":[{"message":"Request body is not valid JSON."}],"title":"Invalid ...
by Seymour Clufley
Sat Jun 07, 2025 5:31 pm
Forum: Coding Questions
Topic: Sending file data within JSON
Replies: 9
Views: 1116

Re: Sending file data within JSON

Infratec,

Yes, that's good to know. However, that Python script is 9 years old and the X API has been changed (recently).

I still can't work out how to send raw data inside JSON. In Python, it would look like this:

chunk = file.read(4*1024*1024)

json = {
'segment_index': segment_id
'media ...
by Seymour Clufley
Fri Jun 06, 2025 7:42 am
Forum: Coding Questions
Topic: Sending file data within JSON
Replies: 9
Views: 1116

Re: Sending file data within JSON

Yes, I am doing that.

The issue is definitely in the "total file size". The Base64 segments never add up to that - at least, the way the X server is handling them.

But I can't see a way to include data within JSON except Base64...
by Seymour Clufley
Thu Jun 05, 2025 12:00 pm
Forum: Coding Questions
Topic: how to make a mp3 file from the output of my morse code program?
Replies: 8
Views: 1569

Re: how to make a mp3 file from the output of my morse code program?

You would probably need to use a utility like SoX or FFMPEG. I wrote a library for using SoX with PB.
by Seymour Clufley
Thu Jun 05, 2025 8:46 am
Forum: Coding Questions
Topic: Sending file data within JSON
Replies: 9
Views: 1116

Sending file data within JSON

X have changed their API for uploading media files. Their endpoint for receiving a file in chunks now requires everything to be inside a JSON block. The process is to call the initialize endpoint (stating the file's total size), then to send each chunk to the append endpoint, then to call the ...
by Seymour Clufley
Sat Apr 12, 2025 12:09 am
Forum: General Discussion
Topic: Newbie Question
Replies: 4
Views: 1925

Re: Newbie Question

Print "The results of the calculation found a possible ";particle;" number out of a possible ";samplesize.

OpenConsole("myconsole")
samplesize.d = 9999
particle.d = 99
PrintN("The results of the calculation found a possible "+Str(particle)+" number out of a possible "+Str(samplesize)+".")
Input ...
by Seymour Clufley
Wed Apr 02, 2025 10:20 am
Forum: Tricks 'n' Tips
Topic: Convert a string to title case
Replies: 22
Views: 2372

Re: Convert a string to title case



My method uses FindString, not StringField.

@Seymour Clufley: Did you even read your code? Just do a search for 'StringField' in your code or even just search for 'String'.
Of course it uses that earlier on, because I didn't change that bit. I was referring specifically to my method for ...
by Seymour Clufley
Tue Apr 01, 2025 7:06 am
Forum: Tricks 'n' Tips
Topic: Convert a string to title case
Replies: 22
Views: 2372

Re: Convert a string to title case

Quin wrote: Mon Mar 31, 2025 12:54 pmVery nice! Only reason I didn't do it this way is because I don't like how slow StringField is, but a linked list is probably overkill, I could probably make it a static array.
My method uses FindString, not StringField.
by Seymour Clufley
Mon Mar 31, 2025 4:48 am
Forum: Tricks 'n' Tips
Topic: Convert a string to title case
Replies: 22
Views: 2372

Re: Convert a string to title case

As a single procedure:

Procedure$ Capitalize(String$)
Protected.i i, Count
Protected Res$, Word$, FirstCharacter$, WordTail$
excl_arr.s = "|a|an|the|and|but|or|for|nor|on|at|to|by|of|in|up|with|as|"
Count = CountString(String$, " ") + 1
For i = 1 To Count
Word$ = StringField(String$, I ...