Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email
?
May 29, 2021, 06:28:37 AM
Home
Forum Rules
Active Topics
Login
Register
Plugin World
»
Macro Library
»
Macro/Command Development
(Moderator:
Lancelot
) »
ScriptInterface
« previous
next »
Print
Pages: [
1
]
2
Topic: ScriptInterface (Read 13935 times)
ScriptInterface
«
on:
May 10, 2011, 03:08:53 AM »
Homes32
Code Baker
Chef
Date Registered: Dec 2010
Posts: 177
following discussion here:
http://theoven.org//index.php?topic=94.msg1878#msg1878
features previously provided by GetInterface, WriteInterface, and ShowComponent have been merged into Interface command allowing for greater flexibility, multiple interface support, less complex syntax, and speed improvements.
new syntax:
ScriptInterface,Read,%VarResult%,Filename,ComponentName[,Position][,Interface]
ScriptInterface,Write,NewValue,Filename,ComponentName[,Position][,Interface]
ScriptInterface,State,ComponentName[,State][,Filename][,RefreshInterface][,Interface]
ScriptInterface HELP.zip
(4.61 kB - downloaded 289 times.)
Common_Api.script
(250.07 kB - downloaded 339 times.)
«
Last Edit: May 14, 2011, 01:03:01 AM by Homes32
»
Re: _Interface
«
Reply #1 on:
May 10, 2011, 03:09:46 AM »
Homes32
Code Baker
Chef
Date Registered: Dec 2010
Posts: 177
Download in 1st post.
«
Last Edit: May 13, 2011, 04:54:03 PM by Homes32
»
Re: _Interface
«
Reply #2 on:
May 10, 2011, 03:17:16 AM »
Homes32
Code Baker
Chef
Date Registered: Dec 2010
Posts: 177
can somebody test getInterface I seem to be having trouble getting it to return the value.
the correct information is being set to #1 but the value is never returned to the calling script.
I think its because the value of %varResult% is being passed instead of the variable name itself. removing %% does not make any difference.
also what are thoughts on keeping _Interface,State command as same things can be done with _Interface_Write ?? is it worth it in this case to have around?
Re: _Interface
«
Reply #3 on:
May 10, 2011, 04:40:57 AM »
Galapo
Gena Baker
Grand Chef
Location: Australia
Date Registered: Sep 2010
Posts: 2207
Hi Homes32,
Thanks for working on this!
Here's a working [_Interface_Get] section. For scripts to be compatible with 077rc2 'ComponentType' needs to be specified because NTRIM is not a recognised function.
Code:
[Select]
[_Interface_Get]
// _Interface,Get,%VarResult%,Filename,ComponentName,[ComponentType],[Position]
// Read the value of an interface element from a different script than the currently executing one.
// #1=%VarResult% #2=FileName #3=ComponentName #4=ComponentType #5=Position
If,#2,Equal,,Set,#2,%ScriptFile%
IniRead,#2,Main,Interface,%_Interface_%
If,%_Interface_%,Equal,,Set,%_Interface_%,Interface
IniRead,#2,%_Interface_%,#3,%_Component_%
If,#4,Equal,,Begin
StrFormat,LTRIM,#3,1,%_CpntName_%
StrFormat,NTRIM,%_CpntName_%,%_CpntName_%
End
Else,Set,%_CpntName_%,#4
If,#5,Bigger,0,StrFormat,SPLIT,"%_Component_%",#$c,#5,%tVar%
Else,Begin
Select_Case,%_CpntName_%,"TextBox|TextLabel|NumberBox|CheckBox|ScrollBox|RadioGroup|Image|TextFile|Button|WebLabel|RadioButton|FileBox|Bevel|CheckList","8|1|8|8|1|8|1|1|8|8|8|1|2|1"
StrFormat,SPLIT,"%_Component_%",#$c,%Case%,%tVar%
If,%_CpntName_%,EQUAL,RadioGroup,Begin
StrFormat,SPLIT,"%_Component_%",#$c,0,#9
StrFormat,SPLIT,"%_Component_%",#$c,#9,%tVar%
StrFormat,LEFT,%tVar%,2,#8
If,#8,Equal,__,Begin
StrFormat,DEC,#9,1
StrFormat,SPLIT,"%_Component_%",#$c,#9,%tVar%
End
End
End
StrFormat,CTRIM,#1,#$p,%t%
Set,%%t%%,%tVar%
Regards,
Galapo.
Re: _Interface
«
Reply #4 on:
May 10, 2011, 02:00:40 PM »
Homes32
Code Baker
Chef
Date Registered: Dec 2010
Posts: 177
that works much better, thanks.
I'll leave it up to you on weather or not to retire _Interface,State/ShowComponent
To my knowledge nobody has ever used it and the same thing can easily be done with _Interface,Write
Re: _Interface
«
Reply #5 on:
May 10, 2011, 02:34:08 PM »
Lancelot
Moderator, Gena Baker
Grand Chef
Date Registered: Sep 2010
Posts: 10350
Homes32,
maybe we should retire GetInterface, ShowComponents, WriteInterface before anybody start to use, untill they are improved to fitu multiinterface etc. things we talked (written) before. ?
Re: _Interface
«
Reply #6 on:
May 10, 2011, 03:11:56 PM »
Homes32
Code Baker
Chef
Date Registered: Dec 2010
Posts: 177
_Interface updated to work with multiple interfaces! :)
Re: _Interface
«
Reply #7 on:
May 10, 2011, 05:59:14 PM »
Lancelot
Moderator, Gena Baker
Grand Chef
Date Registered: Sep 2010
Posts: 10350
ups again....
I will check when I get home and free time.... (I do not have much times as before these days....)
Re: _Interface
«
Reply #8 on:
May 11, 2011, 01:19:55 AM »
Galapo
Gena Baker
Grand Chef
Location: Australia
Date Registered: Sep 2010
Posts: 2207
I've updated the code so that it now works when ComponentType isn't given but when ComponentName has been renamed (side benefit is that code is now backwards compatible with 077rc2, a definite advantage as we know).
Code:
[Select]
[_Interface]
// Parent Command for Interface Operations
// _Interface,Command[,Parms]
Run,%API%,_Interface_#1,#2,#3,#4,#5,#6,#7,#8,#9
[_Interface_Get]
// _Interface,Get,%VarResult%,Filename,ComponentName,[ComponentType],[Position]
// Read the value of an interface element from a different script than the currently executing one.
// #1=%VarResult% #2=FileName #3=ComponentName #4=ComponentType #5=Position
If,#2,Equal,,Set,#2,%ScriptFile%
IniRead,#2,Main,Interface,%_Interface_%
If,%_Interface_%,Equal,,Set,%_Interface_%,Interface
IniRead,#2,%_Interface_%,#3,%_Component_%
If,#4,Equal,,Begin
StrFormat,SPLIT,"%_Component_%",#$c,3,%_CpntName_%
If,%_CpntName_%,Equal,0,Set,%_CpntName_%,Textbox
If,%_CpntName_%,Equal,1,Set,%_CpntName_%,TextLabel
If,%_CpntName_%,Equal,2,Set,%_CpntName_%,NumberBox
If,%_CpntName_%,Equal,3,Set,%_CpntName_%,CheckBox
If,%_CpntName_%,Equal,4,Set,%_CpntName_%,ScrollBox
If,%_CpntName_%,Equal,14,Set,%_CpntName_%,RadioGroup
If,%_CpntName_%,Equal,5,Set,%_CpntName_%,Image
If,%_CpntName_%,Equal,6,Set,%_CpntName_%,TextFile
If,%_CpntName_%,Equal,8,Set,%_CpntName_%,Button
If,%_CpntName_%,Equal,10,Set,%_CpntName_%,WebLabel
If,%_CpntName_%,Equal,11,Set,%_CpntName_%,RadioButton
If,%_CpntName_%,Equal,12,Set,%_CpntName_%,Bevel
If,%_CpntName_%,Equal,13,Set,%_CpntName_%,FileBox
If,%_CpntName_%,Equal,9,Set,%_CpntName_%,CheckList
End
Else,Set,%_CpntName_%,#4
If,#5,Bigger,0,StrFormat,SPLIT,"%_Component_%",#$c,#5,%tVar%
Else,Begin
Select_Case,%_CpntName_%,"TextBox|TextLabel|NumberBox|CheckBox|ScrollBox|RadioGroup|Image|TextFile|Button|WebLabel|RadioButton|FileBox|Bevel|CheckList","8|1|8|8|1|8|1|1|8|8|8|1|2|1"
StrFormat,SPLIT,"%_Component_%",#$c,%Case%,%tVar%
If,%_CpntName_%,EQUAL,RadioGroup,Begin
StrFormat,SPLIT,"%_Component_%",#$c,0,#9
StrFormat,SPLIT,"%_Component_%",#$c,#9,%tVar%
StrFormat,LEFT,%tVar%,2,#8
If,#8,Equal,__,Begin
StrFormat,DEC,#9,1
StrFormat,SPLIT,"%_Component_%",#$c,#9,%tVar%
End
End
End
StrFormat,CTRIM,#1,#$p,%t%
Set,%%t%%,%tVar%
[_Interface_State]
// _Interface,State,ComponentName[,State][,Filename][,RefreshInterface]
// State=0(Hide) or 1(Visible) (If State is empty it is set to 1)
// Filename=If empty it is set to %ScriptFile%
// RefreshInterface=True or False
// Ex: ShowComponent,CheckBox_Ram,0,,True
// #1=ComponentName #2=State #3=FileName #4=Refresh?
If,Not,#2,Equal,0,Set,#2,1
If,#3,Equal,,Set,#3,%ScriptFile%
IniRead,#3,Main,Interface,%_Interface_%
If,%_Interface_%,Equal,,Set,%_Interface_%,Interface
IniRead,#3,%_Interface_%,#1,%_Component_%
StrFormat,SPLIT,%_Component_%,#$c,1,%Cpnt1%
StrFormat,Len,%Cpnt1%,%_LenCpnt1_%
StrFormat,POS,%Cpnt1%,#$s,#9
If,#9,Bigger,0,Begin
If,#9,Smaller,%_LenCpnt1_%,Set,%Cpnt1%,#$q%Cpnt1%#$q
StrFormat,Inc,%_LenCpnt1_%,2
End
StrFormat,Inc,%_LenCpnt1_%,2
StrFormat,LTRIM,%_Component_%,%_LenCpnt1_%,%RightResult%
IniWrite,#3,%_Interface_%,#1,"%Cpnt1%#$c#2%RightResult%"
If,#4,Equal,True,System,REFRESHINTERFACE
[_Interface_Write]
// _Interface,NewValue,Filename,ComponentName[,Type][,Position]
// #1=NewValue #2=FileName #3=ComponentName #4=ComponentType #5=ComponentPosition
If,#2,Equal,,Set,#2,%ScriptFile%
Set,%Pos_End%,0
StrFormat,Len,#1,%_Len1_%
StrFormat,POS,#1,#$s,#9
If,#9,Bigger,0,Begin
If,#9,Smaller,%_Len1_%,Set,#1,#$q#1#$q
End
IniRead,#2,Main,Interface,%_Interface_%
If,%_Interface_%,Equal,,Set,%_Interface_%,Interface
IniRead,#2,%_Interface_%,#3,%_Component_%
If,#4,Equal,,Begin
StrFormat,SPLIT,"%_Component_%",#$c,3,%_CpntName_%
If,%_CpntName_%,Equal,0,Set,%_CpntName_%,Textbox
If,%_CpntName_%,Equal,1,Set,%_CpntName_%,TextLabel
If,%_CpntName_%,Equal,2,Set,%_CpntName_%,NumberBox
If,%_CpntName_%,Equal,3,Set,%_CpntName_%,CheckBox
If,%_CpntName_%,Equal,4,Set,%_CpntName_%,ScrollBox
If,%_CpntName_%,Equal,14,Set,%_CpntName_%,RadioGroup
If,%_CpntName_%,Equal,5,Set,%_CpntName_%,Image
If,%_CpntName_%,Equal,6,Set,%_CpntName_%,TextFile
If,%_CpntName_%,Equal,8,Set,%_CpntName_%,Button
If,%_CpntName_%,Equal,10,Set,%_CpntName_%,WebLabel
If,%_CpntName_%,Equal,11,Set,%_CpntName_%,RadioButton
If,%_CpntName_%,Equal,12,Set,%_CpntName_%,Bevel
If,%_CpntName_%,Equal,13,Set,%_CpntName_%,FileBox
If,%_CpntName_%,Equal,9,Set,%_CpntName_%,CheckList
End
Else,Set,%_CpntName_%,#4
If,#5,Equal,"",Begin
Select_Case,%_CpntName_%,"TextBox|TextLabel|NumberBox|CheckBox|ScrollBox|RadioGroup|Image|TextFile|Button|WebLabel|RadioButton|FileBox|Bevel|CheckList","8|1|8|8|1|8|1|1|8|8|8|1|2|1"
Set,#5,%Case%
If,%_CpntName_%,EQUAL,RadioGroup,Begin
StrFormat,SPLIT,%_Component_%,#$c,0,#5
StrFormat,SPLIT,%_Component_%,#$c,#5,#7
StrFormat,LEFT,#7,2,#8
If,#8,Equal,__,StrFormat,DEC,#5,1
End
End
StrFormat,LEN,%_Component_%,%_LENComponent_%
StrFormat,SPLIT,%_Component_%,#$c,1,%Cpnt1%
StrFormat,SPLIT,%Cpnt1%,#$q,0,%_Quote%
StrFormat,Len,%Cpnt1%,%_LenCpnt1_%
StrFormat,POS,%Cpnt1%,#$s,#9
If,#9,Bigger,0,Begin
If,#9,Smaller,%_LenCpnt1_%,Set,%Cpnt1%,#$q%Cpnt1%#$q
StrFormat,Inc,%_LenCpnt1_%,2
End
If,#5,Bigger,1,Begin
StrFormat,Inc,%_LenCpnt1_%,1
StrFormat,LTRIM,%_Component_%,%_LenCpnt1_%,%_Component2_%
StrFormat,Dec,#5,1
Set,%Pos_End%,%_LenCpnt1_%
Loop,%API%,GetPos,1,#5,%_Component2_%
If,%Pos_Star%,Equal,0,Set,%LeftResult%,""
Else,StrFormat,LEFT,%_Component_%,%Pos_Start%,%LeftResult%
If,%Pos_End%,Bigger,%Pos_Start%,Begin
StrFormat,Dec,%Pos_End%,1
StrFormat,LTRIM,%_Component_%,%Pos_End%,%RightResult%
End
Else,Set,%RightResult%,""
IniWrite,#2,%_Interface_%,#3,"%LeftResult%#1%RightResult%"
End
Else,Begin
If,%_Quote%,Bigger,2,StrFormat,Inc,%_LenCpnt1_%,%_Quote%
StrFormat,LTRIM,%_Component_%,%_LenCpnt1_%,%RightResult%
IniWrite,#2,%_Interface_%,#3,#1%RightResult%
End
Regards,
Galapo.
Re: _Interface
«
Reply #9 on:
May 11, 2011, 02:05:53 AM »
Homes32
Code Baker
Chef
Date Registered: Dec 2010
Posts: 177
nice.
do we need to have the option for specifying a component type then? does it serve any purpose?
Re: _Interface
«
Reply #10 on:
May 11, 2011, 02:25:13 AM »
Galapo
Gena Baker
Grand Chef
Location: Australia
Date Registered: Sep 2010
Posts: 2207
True, ComponentType would now be redundant.
Regards,
Galapo.
Re: _Interface
«
Reply #11 on:
May 11, 2011, 11:23:09 AM »
Lancelot
Moderator, Gena Baker
Grand Chef
Date Registered: Sep 2010
Posts: 10350
Hi Homes32,
just one cosmetic comment ;) underscore is not nice (not classy, you know.....), why not without underscore.....
Interface,Get,%VarResult%,Filename,ComponentName,[ComponentType],[Position][,Interface]
Interface,Write,NewValue,Filename,ComponentName[,Type][,Position][,Interface]
Interface,State,ComponentName[,State][,Filename][,RefreshInterface][,Interface]
I feel, after your last touchs + adding wand, it is ready , Thanks to you and Galapo.
I updated capi removing (comment out) Getinterface, ShowComponent, WriteInterface + also from main.jpg.
so all up to final api name decision, + last touch + wand.....--> adding to api.
(ps: Max had told me : main.jpg - Gimp - Font: Segoe Print - Size: 9px)
I did not update revision and did not write history notes, leaving further history notes to you
ex: History25rev79=Homes32 new api <blabla> - Getinterface, ShowComponent, WriteInterface removed (absolute).
Re: _Interface
«
Reply #12 on:
May 11, 2011, 05:57:01 PM »
Homes32
Code Baker
Chef
Date Registered: Dec 2010
Posts: 177
updated 1st post with syntax and
I updated the 2nd post adding galapo's changes (his revision did not have the multi-interface support) and removed the redundant ComponentType option.
I tested all functions but not with all component types
main reason I used _ was to keep winbulider from confusing the api command section with the CAPI script [interface] section
I am not attached to _interface as opposed to just plain Interface either way works fine. in Autoit it is common practice to prefix api-like/user defined functions with _ to make them stand out as being part of a collection. I will leave the decision to you or galapo
for history something like
History25rev79=Homes32 added new api <blabla> - Getinterface, ShowComponent, WriteInterface removed (depreciated).
is fine.
Re: _Interface
«
Reply #13 on:
May 11, 2011, 08:36:52 PM »
Lancelot
Moderator, Gena Baker
Grand Chef
Date Registered: Sep 2010
Posts: 10350
Hi homes32,
I meant the api name (not section) ex: "CopyProgram"
for sections I feel [_Interface] [_Interface_Get] etc. are ok, but to be more safe side maybe [_Intface] [_Intface_Get] .. final decision is yours
for api name, I like "Interface" more than "_Interface", or any other idea ???
latest capi on both Gena and Win7PE SE dev server, if you can implement and attach mediafire etc. it would be easier......
Re: _Interface
«
Reply #14 on:
May 12, 2011, 05:15:23 PM »
Homes32
Code Baker
Chef
Date Registered: Dec 2010
Posts: 177
changes
-removed _ from command name
-added magic wand syntax
-changed command Interface,Get to Interface,Write
-some final code cleanups and bug fix with button retrieval
I will update the help files when I get a free moment.
helpfiles attached for paragliders .chm (stylesheet not included)
regards,
Homes32
«
Last Edit: May 13, 2011, 04:51:59 PM by Homes32
»
Re: _Interface
«
Reply #15 on:
May 13, 2011, 02:32:23 AM »
Lancelot
Moderator, Gena Baker
Grand Chef
Date Registered: Sep 2010
Posts: 10350
Hi homes32,
Sorry for late response, I was quite bussy.....
now I understand the trouble with Interface ;) apisubdef wand fails.... and you added *
I changed to _ but neither * nor _ looks nice on wand since there is no special case for that api... (it is general api for all)
what you think IntFace api, rest same, I mean:
Intface=Run,%API%,_Interface
For now, I uploaded capi with minor changes following you to Gena server.... waiting your response.....
Quote from: Homes32 on May 12, 2011, 05:15:23 PM
helpfiles attached for paragliders .chm (stylesheet not included)
I do not know chm files, and I do not have access to paragliders .chm (it's paragliders)
overall paraglider's chm
, but there are missings etc. in paragliders chm.......
for now I made a Common_Api_Addon.script, it would be nicer if it contains a chm compiler that creates chm in the end (something like that.... I hope you understand), I feel this way more contributions can be obtained to better chm..... can you help on that ?
Re: Interface
«
Reply #16 on:
May 13, 2011, 05:04:16 AM »
Galapo
Gena Baker
Grand Chef
Location: Australia
Date Registered: Sep 2010
Posts: 2207
Or 'ScriptInterface' for the name?
Regards,
Galapo.
Re: Interface
«
Reply #17 on:
May 13, 2011, 04:24:21 PM »
Homes32
Code Baker
Chef
Date Registered: Dec 2010
Posts: 177
ScriptInterface sounds fine and makes logical sense.
@lancelot
I know little about .chm files except that they are constructed from .html pages. I will post the stylesheet later and then the help files can be used on the CAPI script interface links. (like Unpack, etc.) and if paraglider wants to update his .chm the files are available for him.
Re: ScriptInterface
«
Reply #18 on:
May 13, 2011, 04:56:51 PM »
Homes32
Code Baker
Chef
Date Registered: Dec 2010
Posts: 177
ok, changed syntax to ScriptInterface,CMD,...
this should get rid of any conflicts.
also the documentation has been updated along with the stylesheet and is included in the 1st post.
Re: ScriptInterface
«
Reply #19 on:
May 13, 2011, 11:36:25 PM »
ChrisR
XPE Baker
Grand Chef
Date Registered: Mar 2011
Posts: 3494
Hi Homes32,
Thanks for working on scriptinterface
1st test on scipt post1,
There are 2 sections ScriptInterface
If I rename with Run,%API%,_ScriptInterface and Run,%API%,_ScriptInterface_#1,...
and corresponding section it works for my Images.script.
In ScriptInterface-Write.html example, pTextBox1 is missing
Write the value "Interface Write Test" to the pTextBox1 textbox interface element in the Hijackthis script.
ScriptInterface,Write,"Interface Write Test",%ProjectDir%\Apps\HijackThis!.script,
pTextBox1
Print
Pages: [
1
]
2
« previous
next »
Plugin World
»
Macro Library
»
Macro/Command Development
(Moderator:
Lancelot
) »
ScriptInterface
Powered by
EzPortal