Screen Resolution Script
not currently, but maybe a script guru can create one for U 
maybe try this one:
(paste all in empty script and press compile and init, then 'get rez' button)
(paste all in empty script and press compile and init, then 'get rez' button)
Code: Select all
//////////////////////////////:
//////////////////////////
// Extract rez from usine log
/////////////////////////
// declaration
var refresh,textOut : Tparameter;
var Xout, Yout : Tparameter;
var st : TStringList;
// initialisation : create parameters
procedure init;
var i : integer;
begin
refresh := CreateParam('get_rez',ptButton);
SetIsOutPut(refresh,false);
textOut := CreateParam('text',ptTextField);
SetIsInPut(textOut,false);
Xout := CreateParam('X',ptdataField);
SetIsInPut(Xout,false);
Yout := CreateParam('Y',ptdataField);
SetIsInPut(Yout,false);
end;
// read
procedure ReadTextFile;
var all : string;
var line : string;
var position : integer;
begin
st.create;
st.clear;
st.loadfromFile(GetApplicationPath + 'LogUsine.log');
all := st.GetCommaText;
position := pos('Resolution',all);
if(position>0) then begin
position := position+11;
SetStringValue(textOut, copy(all, position, 9));
line := copy (all, position, 4);
SetValue(Xout, strtoint(line));
line := copy (all, position+5, 4);
SetValue(Yout, strtoint(line));
end;
// itrace(position);
st.free;
end;
// Callback
procedure callBack(n:integer);
begin
if n=0
then
ReadTextFile;
end;23fx you are a genius! This is perfect. Exactly what I was thinking! Taking the log that Hollyhock makes and reading the string text directly from it! You are the man!
note that can only work if resolution is set before launching usine, as log is created here,
will not work if changing res while usine is already launched, but maybe possible with sdk im not sure, ill try to have a look.
will not work if changing res while usine is already launched, but maybe possible with sdk im not sure, ill try to have a look.
Hmm...Doesn't seem to want to work anymore. I tried revisiting an old project and got an error on line 6 column 21. Can't make heads or tails of the code. Please help with update?
this code works on:
Code: Select all
//////////////////////////////
//////////////////////////
/////////////////////////
// declaration
var refresh,textOut: Tparameter;
var Xout, Yout : Tparameter;
var st : TStringList;
// initialisation create parameters
procedure init;
var i : integer;
begin
refresh := CreateParam('get_rez',ptButton);
SetIsOutPut (refresh,false);
textOut := CreateParam('text',ptTextField);
SetIsInPut(textOut,false);
Xout := CreateParam('X',ptdataField);
SetIsInPut( Xout,false);
Yout := CreateParam('Y',ptdataField);
SetIsInPut(Yout,false);
end;
// read
procedure ReadTextFile;
var all : string;
var line : string;
var position : integer;
begin
st.create;
st.clear;
st.loadfromFile(GetApplicationPath + 'LogUsine.log');
all := st.GetCommaText;
position := pos('Resolution',all);
if (position>0) then
begin
position := position+11;
SetStringValue(textOut, copy(all, position, 9));
line := copy (all, position, 4);
SetValue(Xout, strtoint(line));
line := copy (all, position+5, 4);
SetValue(Yout, strtoint(line));
end;
st.free;
end;
// Callback
procedure callBack(n : integer);
begin
if n=0
then ReadTextFile;
end;
Olivier Sens
www.brainmodular.com
www.brainmodular.com
Thank you very much Senso! Very slight correction to your code:
st.loadfromFile(GetApplicationPath + 'LogUsine.log');
should be
st.loadfromFile(GetApplicationPath + '/LogUsine.log');
the format was a bit off and was spitting back an error.
Quick follow up question: is there any way to just simply print the GetApplicationPath?
st.loadfromFile(GetApplicationPath + 'LogUsine.log');
should be
st.loadfromFile(GetApplicationPath + '/LogUsine.log');
the format was a bit off and was spitting back an error.
Quick follow up question: is there any way to just simply print the GetApplicationPath?
what do you mean by "print"?
Olivier Sens
www.brainmodular.com
www.brainmodular.com
i would like to use the PC path that usine is on as a string text to call up and execute .bat files. So instead of resolution, I get "C:/Program Files/Usine Hollyhock/". Then I am able to add the .bat file that is in one of the folders and execute that way by calling up the path and then inserting the command. Hope that helps...
not sure to understand,maybe you could take a look on
https://www.brainmodular.com/manuals/hh ... usine-path
https://www.brainmodular.com/manuals/hh ... usine-path
Olivier Sens
www.brainmodular.com
www.brainmodular.com
Who is online
Users browsing this forum: No registered users and 18 guests
