I’m programming with Xojo for a couple of months now, and I would consider myself not a beginner anymore. During the time, from the beginning with Xojo until today, I discovered that more sophisticated questions pop up while I code my software.
Not only questions about programming, but also questions concerning the Xojo IDE itself and especially Xojo-specific programming concepts.
It would be a great help, if someone could answer my questions. I don’t expect very long answers to each question. A short hint, a reference link or short explanation is totally enough.
Does a portable Xojo compiler as CLI binary file exist? Where can I find it?
If there is no compiler binary, can I compile Xojo source code out of my own application?
If question 1 and 2 are answered negative, how can I compile source code out of my own application?
How can I protect my software against reverse engineering or decompiling?
There are many ways to implement a licensing system, which one do you recommend? And which one do you consider as safest?
Is there an IDE extension similar to Copilot from GitHub for Xojo?
Where can I find IDE extensions for Xojo?
Programs that I compile for Windows usually come with a lot of separate .DLL files. Is there a way to put all the .DLL files somehow in an executable file?
In which case would I use remote debug hosts and for what?
When would I use a Timer or Threads? Can you give me an example? And what is a Semaphore?
When would I use a Worker? Could you give me an example use case?
For what can I use the class XojoScript? What is the use case?
What are delegates? For what can I use them?
Can you give me an use case for IPCSocket?
When do I use MemoryBlocks? Can you give me a use case?
How can I programatically take a screenshot?
What is Insert → Report? And for what can I use it?
You can with 3rd party software, but this make your app slow to launch and other problems. It is better is you make an installer, for example with inno setup
To debug an app in a different desktop from the one you are developping. this is helpfull for example when compiling for a different OS
…
My app works for macOS (intel and ARM), Win7/Win10, Linux Mint, and Raspberry Pi.
In the case of Windows and Linux, I run these inside VMs on my Mac. I reach those VMs using remote debugging. Same for the Pi, except I use real hardware there.
My app (an email client) has lots of threads and timers in it, so the user can look at mail and do other things while email downloads.
You are ignoring Xojoscript. This isn’t completely true - yes it’s not possible to compile a new application from within one you create, but you can load and run Xojo code with Xojoscript
The easiest way for compiling is to use the IDE Communicator. The project is in the examples. I use it to make apps, helper apps and a dmg or pkg for 4 different app versions.
Problem with current coding is, you can no longer alter the GUI elements from within a thread directly.
That is, Textfield.text=“Write this” no longer works from inside a thread.
Instead of, the Thread needs to alter a variable, app.ToWriteThisString = “Write this”,
and the Timer reads this variable recurrent. Within the Timer, the code is
Textfield.Text=app.ToWriteThisString
You have to use timers/threads to make a modern interface. Progress bars are needed for tasks that take longer. For which you need a thread which makes nice spaghetti code. Sending emails for instance also needs a thread.
With a thread you can use ThreadSafeMBS methods from MBS to make a bit less spaghetti. Just don’t use a global variable if you don’t use the ThreadSafeMBS methods.
Note it’s not Xojo’s fault, as altering the GUI from threads isn’t supported by operating systems.
It used to be that it would work on certain cases, but that was just coincidences.
And I’ve seen odd behaviours. like entire white windows, because of trying to do UI things from threads; debugging that wasn’t straightforward.
Well, there are LOTS of threads in this forum about that. try the Search function with things like obfuscation, encription, hack, decompile erc. Then if you have a specific question, create another thread for that.
With IDE scripting it’s possible to copy files, add codesign etc. The IDE communicator can open, build and save multiple apps. I can change values like the Bundle ID, the architecture, the version.
Here is the start of my IDE communicator script:
dim MaxVersion as String = "0"
if MaxVersion = "" then MaxVersion = "0"
dim MajorVersion as string = "6"
dim MinorVersion as String = "2"
dim BugVersion as String = "0"
dim BetaVersion as String = "b1"
dim theCommand, theResult as string
dim userHome as String = DoShellCommand("echo $HOME")
userHome = Trim(ShellEncode(userHome))
dim Architecture as integer = 16
'9 universal
'16 intel
'24 arm
dim basePath as string = userHome + "/Documents/Development/Mail\ Archiver/"
'delete old apps and dmg
theCommand = "osascript " + basePath + "code\ current/ide\ communicator/delete\ old\ builds.scpt"
theResult = DoShellCommand(theCommand)
'scheduler: : only for normal, pro and pro admin
if MaxVersion = "0" or MaxVersion = "1" or MaxVersion = "3" then
openfile(basePath + "code\ current/max\ scheduler.xojo_xml_project")
ConstantValue("App.kMaxVersion") = MaxVersion
if ConstantValue("App.kMaxVersion") = "0" then
PropertyValue("App.Application Identifier") = "com.mothsoftware.mailarchiverx-helper"
PropertyValue("App.MacOSXAppName") = "Mail Archiver X Scheduler"
elseif ConstantValue("App.kMaxVersion") = "1" then
PropertyValue("App.Application Identifier") = "com.mothsoftware.mailarchiverxpro-helper"
PropertyValue("App.MacOSXAppName") = "Mail Archiver X Pro Scheduler"
elseif ConstantValue("App.kMaxVersion") = "3" then
PropertyValue("App.Application Identifier") = "com.mothsoftware.mailarchiverxproadmin-helper"
PropertyValue("App.MacOSXAppName") = "Mail Archiver X Pro Admin Scheduler"
else
print ConstantValue("App.kMaxVersion")
end if
makeVersion(MajorVersion, MinorVersion, BugVersion, BetaVersion)
if BuildApp(Architecture) = "" then
return
else
DoCommand "SaveFile"
DoCommand("CloseWindow")
end if
end if
Hi Alexander, to see examples on the use of Timer, Thread and Worker, search the forum topic “Looking for unique number of Base X” and download the attached examples.
Greetings
You’re right, meanwhile, there is a different way to do stuff like this.
But I forgot, so to read up on this topic again, could you please point me to?