Page 1 of 1
Posted: 24 Nov 2018, 17:14
by dmitriyc
Hey all.
Was wondering if there was a script or something to get my current screen resolution and preferably spit it out as a numerical output?
Posted: 26 Nov 2018, 20:12
by nay-seven
not currently, but maybe a script guru can create one for U

Posted: 26 Nov 2018, 23:55
by 23fx23
maybe try this one:
(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;
Posted: 27 Nov 2018, 18:14
by dmitriyc
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!
Posted: 27 Nov 2018, 22:33
by 23fx23
cool if usefull

Posted: 28 Nov 2018, 07:51
by rlgsbt
GREAT ! thanks 23fx
Posted: 28 Nov 2018, 12:19
by 23fx23
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.
Re: Screen Resolution Script
Posted: 19 Mar 2021, 03:58
by dmitriyc
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?
Re: Screen Resolution Script
Posted: 19 Mar 2021, 19:53
by senso
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;
Re: Screen Resolution Script
Posted: 31 Mar 2021, 23:17
by dmitriyc
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?
Re: Screen Resolution Script
Posted: 01 Apr 2021, 09:37
by senso
what do you mean by "print"?
Re: Screen Resolution Script
Posted: 14 Apr 2021, 23:28
by dmitriyc
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...
Re: Screen Resolution Script
Posted: 16 Apr 2021, 20:50
by senso
not sure to understand,maybe you could take a look on
https://www.brainmodular.com/manuals/hh ... usine-path