API functions inside WB's Magic Wand
#26
Posted 16 January 2009 - 03:33 PM
I assume that when one clicks on a API command it will also add the expected work syntax.
Guess the tough part now will be documenting the API commands to ease the life of developers when it comes to figure what each function does.
#27
Posted 16 January 2009 - 03:36 PM
You have to read my posts more carefullyI assume that when one clicks on a API command it will also add the expected work syntax.
And of course -not visible here- it inserts the code into the CodeBox or current script resp.
Peter
#28
Posted 16 January 2009 - 03:38 PM
I actually had to read it again line per line until I found the part you've quoted and there it was!
Guess I'm in danger of needing to use some glasses..
#29
Posted 16 January 2009 - 05:22 PM
Just a bump:In CodeBox as first line there is necessary:
AddVariables,%API%,ApiVar,GLOBAL
This issue is not solved by the new 'API magic wand' functionality and we should find a solution w/o the 'different starter's decisions'.
At least I'm not willing to write new commands into WinBuilder which decide how the run has been started.
And I think that Nunu agrees.
I am sure that it can be solved as smooth as the 'magic wand' issue, we only have to find the way ...
Peter
#30
Posted 16 January 2009 - 05:44 PM
Before I forget it:I think it is time to include the command require_file, in the new api.
Thanks a lot for the fundamental suggestion!
The 'slight' modification of your post
Is now working!I think it is time to include the API commands.
Peter
BTW: Unfortunatelly I do not have a 'Thanks' button any more
#31
Posted 16 January 2009 - 07:27 PM
I search a simply way for having a quick find of all api function and syntax
[Api_Command] Add_Shortcut=Run,%API%,AddShortcut Require_File=run,%API%,Expand_file Unpack=Run,%API%,Depack _Calculate=run,%API%,Calculate [Api_Syntax] Add_Shortcut,<Type>,<Folder>,<FullFileName>,<Title>,<Work Folder>,<Parameters>,<IconFile>,<StartMode>,<ToolTip> Require_File , <Folder\> filename , <Source> , <Target> Unpack,<Folder>,<Archive>,<Option>,<%Target_Prog%>,<%ProgramFolder%>,<%programExe%>,<Target_Temp> _Calculate,expression,VariableSo with api formatted like this you can make WB easy to list all api function (without knowing them and only for the current project) and their respective Syntax in Api_Syntax section
Hope you understand what I mean
Pedro
Cool! Wouldn't it be good to add a [Api_Doc] section too to make the Project completely self documenting ?
WetHat
#32
Posted 16 January 2009 - 07:43 PM
That's the desision of The Boss.Cool! Wouldn't it be good to add a [Api_Doc] section too to make the Project completely self documenting ?
I personally would refuse, because for me still is valid:
And to do work into this dircetion, could decrease work in the 'batch' direction.WinBuilder is a very sophisticated, but still stupid batching program without own individual decisions
And 'the Project' of your post is really 'one of several projects'
Every project writer only uses script lines following certain rules.
He currently cannot be forced to do something for documentation or whatelse.
Peter
#33
Posted 16 January 2009 - 08:30 PM
At the moment, I still only see the two possibilities for script.project:This issue is not solved by the new 'API magic wand' functionality and we should find a solution w/o the 'different starter's decisions'.
[Process] AddVariables,%API%,ApiVar,PERMANENT
or
[Process] System,INDIVIDUAL,AddVariables,%API%,ApiVar,GLOBAL System,PROJECT,Begin AddVariables,%API%,ApiVar,GLOBAL System,ONBUILDEXIT,Exec,%api%,LiveXP-ONBUILDEXIT End
Note: the first option will NOT work for individual scripts unless the project has run at least once. There's some scripts requiring some setup where it is possible that the user may run a button on it prior to running the project for the first time, resulting in errors since the api variables would not be in place. Also, the use of 'PERMANENT' means that were back to a heap of variable commands being placed in script.project. I guess the 'AddVariables' command could be used at teh start of such scripts just in case, but it kind of defeats the purpose. As such, my vote is for the second option.
Regards,
Galapo.
#34
Posted 16 January 2009 - 08:38 PM
'Process "AddVariables,%API%,ApiVar,GLOBAL" as first line of CodeBox.'
which is default to 'True'
But do not do something with script.project, which is really innocent if somebody executes CodeBox.
Peter
#35
Posted 16 January 2009 - 09:00 PM
AddVariables,%API%,ApiVar,GLOBAL System,REBUILDVARSWe can also have a function Load_Api containing this line (which stay in script.project)
and just call it if need in CodeBox
Pedro
#36
Posted 16 January 2009 - 09:08 PM
And why not adding this in Api.script rather in script.projectIs it possible that on individual script run, script.project will also be run prior, so that
[Process] AddVariables,%API%,ApiVar,GLOBALis run to initiate the api commands?
Regards,
Galapo.
on individual script run, Api.script will also be run prior
There is no script that need api function before Level 2 or 3
Pedro
#37
Posted 16 January 2009 - 09:28 PM
Pedro's solution is a good one. Hopefully doesn't add much time to processing.
Regards,
Galapo.
#38
Posted 16 January 2009 - 09:40 PM
but we can make it run able so it is executed like other script
Variable are added for the entire project so for me it doesn't play on speed
the only needed is when running a single script it should be load before
Pedro
#39
Posted 16 January 2009 - 10:14 PM
First there was talk about how to integrate the API commands into the magic wand and problems asociated with different solutions.
Then (all of a sudden) the discussion is about, if scripts, when run all by themselfs, can or can not use API commands.
How did the Magic wand functionality manage to break the 'normal' way the api works? One is display, the other is use. Two usually completely different things.
#40
Posted 17 January 2009 - 10:24 AM
As MedEvil remarks correctly, the discussion is becoming rather strange.I think i have missed something.
First there was talk about how to integrate the API commands into the magic wand and problems asociated with different solutions.
Then (all of a sudden) the discussion is about, if scripts, when run all by themselfs, can or can not use API commands.
How did the Magic wand functionality manage to break the 'normal' way the api works? One is display, the other is use. Two usually completely different things.
To make clear:
To make the API commands in the magic wand possible, Pedro made some structure changes.
As a result:
- Project build runs as before
- Build as a single script runs as before.
- Codebox
- Without API commands: runs as before
- With API commands: needs "AddVariables,%API%,ApiVar,GLOBAL" as first line in [Process]
Peter
#41
Posted 17 January 2009 - 10:59 AM
Also if this is only a problem of the codebox why isn't the codebox simply executing the extra command by default?
#42
Posted 17 January 2009 - 02:19 PM
BecauseAlso if this is only a problem of the codebox why isn't the codebox simply executing the extra command by default?
- The Run button in Codebox
- Stores CodeBox.txt
- Runs CodeBox.txt.
Not simple to insert just a command aywhere if not: - Write something int the file just behind [process]
- Exectue the changed file
- Delete what you inserted.
[*]The section name may vary from project to project
[*]There are projects w/o API. And executing that commend ...
[/list]But I solved the issue, and I'm going to publish a tutorial 'how to prepare API in magic wand' soon.
Peter
#43
Posted 17 January 2009 - 02:27 PM
Good that you found a solution.
#45
Posted 17 January 2009 - 04:44 PM
There has been a bug that sometimes the old API menu was not removed (It also remained when you switched to a non-API project).When playing with two project I got two api menu
For api menu it would great to have sub menu possibility
Pedro
That is fixed now in beta 6 b
I already thought about the submenu option with shortcuts, too.
But currently I do nor have any idea how to describe inside API.Script.
Maybe you have a suggestion (as already before which lead to the 'first' menu )
Peter
#46
Posted 18 January 2009 - 12:13 AM
I am perhap crazy but when thinking at possibility with sub menu api
Why not a personal menu for developper
You store some code line (Multiline) that you can call by a simple word
You start a new script ,you call the word New Script and the code you saved is inserted in the script with all section preformated
So it can be a great tools for all developper (w/o api)
Pedro
#47
Posted 18 January 2009 - 12:42 AM
I still got the problem with beta 6 b but only in CodeBoxThere has been a bug that sometimes the old API menu was not removed (It also remained when you switched to a non-API project).
That is fixed now in beta 6 b
If not using CodeBox seem work well when editing script in two project
Pedro
#48
Posted 18 January 2009 - 10:39 AM
I'm not sure whether I understand you correctly.Peter
I am perhap crazy but when thinking at possibility with sub menu api
Why not a personal menu for developper
You store some code line (Multiline) that you can call by a simple word
You start a new script ,you call the word New Script and the code you saved is inserted in the script with all section preformated
So it can be a great tools for all developper (w/o api)
Pedro
But I think it is not good to write any line in in a script order to activate sub menus.
Here my suggestion:
In addition to the already present lines in script.project
%APIVAR%=ApiVar
%APIDEF%=API
there is a line defining submenus, e.g.:
%APISUBDEF%=ShortCuts,Associate,Unpack
WinBuilder writes these comma separated <title>s as childs of 'API' and reads them from the [<title>] sections in Api.Script
The [<title>] sections are similar to the [%APIDEF%] section the entries for the magic wand.
Peter
#49
Posted 18 January 2009 - 11:08 AM
[ShortCuts] Desktop="Add_Shortcut,Desktop,Folder,FullFileName,Title,Work Folder,Parameters,IconFile,StartMode,ToolTip" StartMenu="Add_Shortcut,StartMenu,Folder,FullFileName,Title,Work Folder,Parameters,IconFile,StartMode,ToolTip" [Associate] Associate_file="Associate_file,[Ext],[Type],[Filename],[Option],[True for RegAddBoot]" [Unpack] Unpack="Unpack,[Folder],[Archive],[Option],[%Target_Prog%],[%ProgramFolder%],[%programExe%],[Target_Temp]"
Peter
#50
Posted 18 January 2009 - 09:41 PM
Just download last version now
Good and well working
I prepare a new api
Pedro
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users