Screen Resolution Script
- nay-seven
- Site Admin
- Posts: 5684
- Location: rennes France
- Contact:
not currently, but maybe a script guru can create one for U 
-
23fx23
- Member
- Posts: 2545
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;- senso
- Site Admin
- Posts: 4434
- Location: France
- Contact:
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
-
dmitriyc
- Member
- Posts: 84
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?
- senso
- Site Admin
- Posts: 4434
- Location: France
- Contact:
what do you mean by "print"?
Olivier Sens
www.brainmodular.com
www.brainmodular.com
-
dmitriyc
- Member
- Posts: 84
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...
- senso
- Site Admin
- Posts: 4434
- Location: France
- Contact:
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
