Sharing some things I've learned

Mac OSX specific forum
User avatar
Piero
Enthusiast
Enthusiast
Posts: 325
Joined: Sat Apr 29, 2023 6:04 pm
Location: Italy

Sharing some things I've learned

Post by Piero »

If you cannot sign your PureBasic apps (not an Apple certified developer) but want to publish them for download, you better advise that:
— For Silicon apps they may need to open Terminal and write or paste xattr -cr ~/Downloads/YourApp.app (then press Return)
…they can also paste "xattr -cr " then drop the app on Terminal and press Return…
— For Intel apps they may need to open it using control-click —> open

When posting code on this Forum, replace the opening code tag [code] with [code=purebasic]

Code: Select all

Debug "Hello World!"
 
That's All! (for now…)
Noob Piero :mrgreen:
User avatar
Piero
Enthusiast
Enthusiast
Posts: 325
Joined: Sat Apr 29, 2023 6:04 pm
Location: Italy

PureBasic code in Html

Post by Piero »

If you need to publish your PureBasic code (and not only!) on a web page, I suggest Highlight
Image
User avatar
Piero
Enthusiast
Enthusiast
Posts: 325
Joined: Sat Apr 29, 2023 6:04 pm
Location: Italy

Screen Space!

Post by Piero »

If you want/need a LOT more screen space (with native resolution, but you can also set up an enormous virtual screen)
I suggest BetterDisplay
It still works when trial ends! (trial is only for the "pro" features)
Be SURE you have set up zoom on system preferences/accessibility before using it!!!
Last edited by Piero on Thu May 04, 2023 10:57 am, edited 1 time in total.
User avatar
Piero
Enthusiast
Enthusiast
Posts: 325
Joined: Sat Apr 29, 2023 6:04 pm
Location: Italy

If you want to run an Applescript…

Post by Piero »

I'm kidding!
This is a joke for mk-soft!

P.S.: THANK YOU!
Last edited by Piero on Thu May 04, 2023 10:55 am, edited 1 time in total.
benubi
Enthusiast
Enthusiast
Posts: 115
Joined: Tue Mar 29, 2005 4:01 pm

Re: Sharing some things I've learned

Post by benubi »

I don't own a Mac but I didn't know the code tag trick.
Thank you!
User avatar
Piero
Enthusiast
Enthusiast
Posts: 325
Joined: Sat Apr 29, 2023 6:04 pm
Location: Italy

Re: Sharing some things I've learned

Post by Piero »

benubi wrote: Wed May 03, 2023 7:14 pm Thank you!
You are very welcome!
In case you may need it, there are Highlight "versions" for other OSs; it's not only for Mac!
User avatar
Demivec
Addict
Addict
Posts: 4091
Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA

Re: Sharing some things I've learned

Post by Demivec »

You can also use [code-pb] to do the same thing.
User avatar
Piero
Enthusiast
Enthusiast
Posts: 325
Joined: Sat Apr 29, 2023 6:04 pm
Location: Italy

Only for AppleScripters?

Post by Piero »

This script uses BBEncoder and must be launched from script menu (or another "global launcher" like FastScripts) because it copies selection (must be an app that copies in RTF text, like Safari or Script Editor) and formats the clipboard in BBcode so you can paste on this Forum:

on findAndReplaceInText(theText, theSearchString, theReplacementString)
       set AppleScript's text item delimiters to theSearchString
       
set theTextItems to every text item of theText
       
set AppleScript's text item delimiters to theReplacementString
       
set theText to theTextItems as string
       
set AppleScript's text item delimiters to ""
       
return theText
end findAndReplaceInText

property dspc : (ASCII character 202) & (ASCII character 202) -- in case use 160

tell application "System Events"
       set currapp to path to frontmost application as text
       
keystroke "c" using command down
       
delay 0.2
       
tell application "BBEncoder" to launch
       
tell application "BBEncoder" to activate
       
tell process "BBEncoder"
              if value of checkbox "Enclose in code tags." of window "BBEncoder" is 1 then tell checkbox "Enclose in code tags." of window "BBEncoder" to perform action "AXPress"
              
if value of checkbox "Replace tabs with 4 spaces" of window "BBEncoder" is 0 then tell checkbox "Replace tabs with 4 spaces" of window "BBEncoder" to perform action "AXPress"
              
set value of text area 1 of scroll area 1 of window "BBEncoder" to ""
              
set focused of text area 1 of scroll area 1 of window "BBEncoder" to true
              
keystroke "v" using command down
              
delay 0.2
              
set c to value of text area 1 of scroll area 2 of window "BBEncoder" as text
              
set c to my findAndReplaceInText(c, {"[left]", "[/left]"}, "")
              set c to my findAndReplaceInText(c, "    ", dspc & dspc)
              set c to my findAndReplaceInText(c, "[size=", "[size=10")
              
set the clipboard to c
       end tell
       
activate application currapp
       
quit application "BBEncoder"
end tell
Last edited by Piero on Sun May 07, 2023 2:27 am, edited 2 times in total.
User avatar
Kiffi
Addict
Addict
Posts: 1358
Joined: Tue Mar 02, 2004 1:20 pm
Location: Amphibios 9

Re: Only for AppleScripters?

Post by Kiffi »

Piero wrote: Fri May 05, 2023 9:45 am[...] so you can paste on this Forum:
But that's quite a lot of overhead. ~ 10 KB (your version) against 2 KB ('normal' code tags)
Hygge
User avatar
Piero
Enthusiast
Enthusiast
Posts: 325
Joined: Sat Apr 29, 2023 6:04 pm
Location: Italy

Re: Only for AppleScripters?

Post by Piero »

Kiffi wrote: Fri May 05, 2023 10:20 am But that's quite a lot of overhead. ~ 10 KB (your version) against 2 KB ('normal' code tags)
Is there an applescript code tag? I tried some but they didn't work :(
Anyway with that script you can also copy e.g. portions of web pages...
Last edited by Piero on Sun May 07, 2023 2:22 am, edited 1 time in total.
AZJIO
Addict
Addict
Posts: 1360
Joined: Sun May 14, 2017 1:48 am

Re: Sharing some things I've learned

Post by AZJIO »

User avatar
Piero
Enthusiast
Enthusiast
Posts: 325
Joined: Sat Apr 29, 2023 6:04 pm
Location: Italy

Re: Sharing some things I've learned

Post by Piero »

AZJIO wrote: Fri May 05, 2023 11:05 am Piero, look at this.
viewtopic.php?t=39499&start=45
viewtopic.php?p=591608#p591608
Thanks! Interesting!
PS:
But isn't that only for the IDE?
If not, forgive me! I will read it all later when I'm less busy!
User avatar
Piero
Enthusiast
Enthusiast
Posts: 325
Joined: Sat Apr 29, 2023 6:04 pm
Location: Italy

Re: Sharing some things I've learned

Post by Piero »

AZJIO wrote: Fri May 05, 2023 11:05 am Piero, look at this.
I now saw, and, as I already said, it's interesting!
But from my point of view (at least for now: I'm a PB noob) it's easier for me to find a solution like passing thru RTF (as you saw)
You have no idea of what I did with "syntax stuff" in TextMate...

You made me remember this; I hope you will find it interesting:
https://morioh.com/p/7720382fffb8

PS: Thanks!
AZJIO
Addict
Addict
Posts: 1360
Joined: Sun May 14, 2017 1:48 am

Re: Sharing some things I've learned

Post by AZJIO »

Piero wrote: Fri May 05, 2023 6:27 pm RTF
I also wrote programs with RTF, but in a different language. Binding to Windows is less interesting to me now, in this regard, Scintilla is free and cross-platform. For example, using RTF, I made regular expression highlighting in RegExp, as well as congratulatory texts with a spectral gradient (RTFtoBBCode, RTFtoHTML), as well as a program for creating code highlighting themes.
I can convert code to html in many ways using Notepad++ plugin and AkelPad plugin
User avatar
Piero
Enthusiast
Enthusiast
Posts: 325
Joined: Sat Apr 29, 2023 6:04 pm
Location: Italy

Re: Sharing some things I've learned

Post by Piero »

AZJIO wrote: Fri May 05, 2023 7:49 pm Binding to Windows is less interesting to me now
It's generally easy to find "console/unix" tools, like code highlighters etc…
What I suggest you from my experience is:
First, "install the installers" with homebrew https://brew.sh (like pip environment etc...)
THEN make your experiments!
Or you can end up with a mess!
I was very concise, believing you will understand me ;)
Locked