I need to build a batch file in Xojo so that I can dynamically change some of the strings that go in the commands. How do you create a batch file in Xojo from variables that you can then execute using the shell? Thanks!
@Tim Hare
I need to build a batch file in Xojo so that I can dynamically change some of the strings that go in the commands. How do you create a batch file in Xojo from variables that you can then execute using the shell? Thanks!
@Tim Hare
create a text file
write all the commands you want to a text file
compose the commands you want using string concatenation
then run the batch file you just wrote
Create a text file using TextOutputStream?
And I suppose you just name the folderitem with a .bat extension?
Thanks.
yes to both
@Norman Palardy how do I manually specify the folderitem path so I can name the file? I am using code that gets my exe location based on debugBuild or not and setting a string var with it.
How can I use my path variable strAppPath to set the name of the text file I created?
Dim f As FolderItem = Documents.Child("Sample.txt")
I need Dim f As FolderItem = strAppPath.Child(“Sample.bat”) somehow?
try App.ExeFile.NativePath
I use this code to get set strAppPath:
' Set application path
if DebugBuild Then
strAppPath = App.ExecutableFile.Parent.Parent.AbsolutePath
else
strAppPath = App.ExecutableFile.Parent.AbsolutePath
end
I need to do something like this:
Dim fPath As FolderItem = strAppPath
Dim f As FolderItem
f = fPath.Child("Test.bat")
Thanks but unless I am using it in the wrong place App.ExeFile.NativePath said App has no member named ExeFile.
Found the answer I was looking for here:
https://forum.xojo.com/15138-creating-then-writing-to-a-text-file
Dim f As FolderItem
#if DebugBuild
f = getfolderitem("").Parent.Child("Test.bat")
#else
f = getfolderItem("Test.bat")
#endif