path for writing to file script
-
woodslanding
- Member
- Posts: 1327
- Contact:
I'm using the write to file script, and it's insisting on writing to the root of G: Which it can't find, although I do have a g drive at the moment. but it's nowhere I want to write the file.....
Is there a way to point it to the home directory of HH, rather than using an absolute path?
Like to read and write to/from the HH directory somewhere, preferably within CONFIG.....
Is there a way to point it to the home directory of HH, rather than using an absolute path?
Like to read and write to/from the HH directory somewhere, preferably within CONFIG.....
Custom Ryzen 5900x MATX build, Win10, Fireface UFX, touchscreen
Custom 2 manual midi keyboard
Usine, Kontakt, Reaktor, Synthmaster, Byome, Arturia, Soundtoys, Unify
Custom 2 manual midi keyboard
Usine, Kontakt, Reaktor, Synthmaster, Byome, Arturia, Soundtoys, Unify
function GetApplicationPath:string; //give the absolute path of the current Usine's folder
It's in the wiki under declarations and references. There is a file section.
You could just concat the remaining CONFIG to the directory.
It's in the wiki under declarations and references. There is a file section.
You could just concat the remaining CONFIG to the directory.
"Every act of creation is first an act of destruction." -Picasso
ive notice while back sometimes on windows had to run usine as admin also to get authorisations to write in some special folders, to usine subs shouldn't be a problem
your right 23fx23,
I've also run into that same problem.
I've had other oddities besides file writing putting Usine in my program files folders too.
Since then I've always ran direct desktop, at the root in a folder, or on an external drive.
Another side-note is that if you raise the administrative privileges you run into drag and drop problems between applications.
-s
I've also run into that same problem.
I've had other oddities besides file writing putting Usine in my program files folders too.
Since then I've always ran direct desktop, at the root in a folder, or on an external drive.
Another side-note is that if you raise the administrative privileges you run into drag and drop problems between applications.
-s
"Every act of creation is first an act of destruction." -Picasso
there's a script example that tackle this :
//////////////////////////
// write text File
/////////////////////////
// declaration
const filenameDefault = 'c:speak.txt';
var fname,input : Tparameter;
var st : TStringList;
// save
procedure SaveToTextFile;
begin
st.create;
st.add(GetStringValue(input));
st.SaveToFile(GetStringValue(fname));
st.free;
end;
// Callback
procedure callBack(n:integer);
begin
SaveToTextFile;
end;
// initialisation : create parameters
procedure init;
var i : integer;
begin
Input := CreateParam('in',ptTextField);
SetIsOutPut(Input,false);
fname := CreateParam('file name',ptTextField);
SetStringValue(fname,filenameDefault);
SetIsOutPut(fname,false);
end;
//////////////////////////
// write text File
/////////////////////////
// declaration
const filenameDefault = 'c:speak.txt';
var fname,input : Tparameter;
var st : TStringList;
// save
procedure SaveToTextFile;
begin
st.create;
st.add(GetStringValue(input));
st.SaveToFile(GetStringValue(fname));
st.free;
end;
// Callback
procedure callBack(n:integer);
begin
SaveToTextFile;
end;
// initialisation : create parameters
procedure init;
var i : integer;
begin
Input := CreateParam('in',ptTextField);
SetIsOutPut(Input,false);
fname := CreateParam('file name',ptTextField);
SetStringValue(fname,filenameDefault);
SetIsOutPut(fname,false);
end;
http://oli-lab.org
Win11 Ryzen9/32GB RAM - RME MADIFACE - SSL alpha link 4-16 - OSC capable interfaces
follow OLI_LAB adventures on Mastodon
@olivar_premier@mastodon.social
Win11 Ryzen9/32GB RAM - RME MADIFACE - SSL alpha link 4-16 - OSC capable interfaces
follow OLI_LAB adventures on Mastodon
@olivar_premier@mastodon.social
-
woodslanding
- Member
- Posts: 1327
- Contact:
Yes, that's what I started with. But it uses a hard coded file path, which is not helpful at all.
To be clear, before I disappear down this rabbit hole, is there no way to store string data per preset using the existing usine preset system?
I tried with the basic text widgets, but their text data is not stored with the preset.
Hmmm, maybe a list where the preset recalls the line associated with that preset.....??
might end up being more complicated than scripting, with a number of different text elements.....
To be clear, before I disappear down this rabbit hole, is there no way to store string data per preset using the existing usine preset system?
I tried with the basic text widgets, but their text data is not stored with the preset.
Hmmm, maybe a list where the preset recalls the line associated with that preset.....??
might end up being more complicated than scripting, with a number of different text elements.....
Custom Ryzen 5900x MATX build, Win10, Fireface UFX, touchscreen
Custom 2 manual midi keyboard
Usine, Kontakt, Reaktor, Synthmaster, Byome, Arturia, Soundtoys, Unify
Custom 2 manual midi keyboard
Usine, Kontakt, Reaktor, Synthmaster, Byome, Arturia, Soundtoys, Unify
-
woodslanding
- Member
- Posts: 1327
- Contact:
Okay, so not a rabbit hole. In fact, I'll be storing a ton of data this way, I think, unless there is some big cpu penalty or something.....
Here's a more useful script than the default, which will try to write to a folder you probably don't have permission for, which makes it a poor example!
thanks all!!
Here's a more useful script than the default, which will try to write to a folder you probably don't have permission for, which makes it a poor example!
thanks all!!
Code: Select all
//////////////////////////
// write text File, eric moon remix
/////////////////////////
// declaration
const filenameDefault = 'writeFileText.txt';
var filenameIN,folderIN,textIN : Tparameter;
var st : TStringList;
var filename : string;
// initialisation : create parameters
procedure init;
var i : integer;
begin
textIN := CreateParam('text',ptTextField);
SetIsOutPut(textIN,false);
folderIN := CreateParam('folder',ptTextField);
SetIsOutPut(folderIN,false);
filenameIN := CreateParam('file name',ptTextField);
SetStringValue(filenameIN,getApplicationPath + filenameDefault);
SetIsOutPut(filenameIN,false);
end;
// save
procedure SaveToTextFile;
begin
st.create;
st.add(GetStringValue(textIN));
st.SaveToFile(filename);
st.free;
end;
// Callback
procedure callBack(n:integer);
begin
if ((n = filenameIN) or (n = folderIN)) then begin
filename := getApplicationPath() + 'config'
+ getStringValue(folderIN) + ''
+ GetStringValue(filenameIN) + '.txt';
end
else if (n = textIN) then begin
SaveToTextFile;
end;
end;Custom Ryzen 5900x MATX build, Win10, Fireface UFX, touchscreen
Custom 2 manual midi keyboard
Usine, Kontakt, Reaktor, Synthmaster, Byome, Arturia, Soundtoys, Unify
Custom 2 manual midi keyboard
Usine, Kontakt, Reaktor, Synthmaster, Byome, Arturia, Soundtoys, Unify
textfield do save and recall their text with presets actually, man just have to check 'saved in preset' on module properties wich is off by default.woodslanding wrote:Yes,
To be clear, before I disappear down this rabbit hole, is there no way to store string data per preset using the existing usine preset system?
I tried with the basic text widgets, but their text data is not stored with the preset.
text pannel don't, but alternatively, as text is array, adding an array display or set out of any text element will be saved/recall in preset
Who is online
Users browsing this forum: No registered users and 76 guests
