Restored from previous forum. Originally posted by naw.
Hi All, Is there anything like Unix ksh "exec" command in PB?
I'm not a compiler boffin, but I suspect that this may be impossible
because PB is a compiler not an interpreter...
Anyway I want to be able to do the following:
X$="MessageRequester('Y','Z',0)"
exec X$
Ta - N
Is there anything like Unix 'exec' in PB?
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by naw.
I'd like to import *Variables* from an external Text File that builds a configurable GUI a bit like this...
TextFile.txt:
TextGadget,1,2,3,4,"Hello World"
PseudoCode:
while read "./TextFile.txt" into gadget$ x y w h text$
gadget$(x,y,w,h,text$)
done
- I've got no chance, have I
I'd like to import *Variables* from an external Text File that builds a configurable GUI a bit like this...
TextFile.txt:
TextGadget,1,2,3,4,"Hello World"
PseudoCode:
while read "./TextFile.txt" into gadget$ x y w h text$
gadget$(x,y,w,h,text$)
done
- I've got no chance, have I
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by tinman.
--
It's not minimalist - I'm increasing efficiency by reducing input effort.
Edited by - tinman on 01 May 2002 13:15:04
Well, you could always build up a look up table for the names of the gadgets:PseudoCode:
while read "./TextFile.txt" into gadget$ x y w h text$
gadget$(x,y,w,h,text$)
done
Code: Select all
name$(0)="TextGadget"
name$(1)="ButtonGadget"
etc
gid=0
while Read "./Textfile.txt" into gadget$ x y w h text$
i=0 : found=0
while i<#MAXGADGETS And found=0
if gadget$=name$(i)
found=1
Else
i=i+1 ; oops forgot that :)
endif
wend
If found=1
Select i
Case 0
TextGadget(gid,x,y,w,h,text$)
Case 1
Buttongadget(gid,x,y,w,h,text$)
; etc
EndSelect
gid=gid+1
EndIf
Wend
--
It's not minimalist - I'm increasing efficiency by reducing input effort.
Edited by - tinman on 01 May 2002 13:15:04
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by tinman.
Or is there some other reason you don't want a lookup table?
--
It's not minimalist - I'm increasing efficiency by reducing input effort.
What's the problem with it only working for things in your lookup table? If new gadgets were added to PB you would have to recompile your source to get access to those anyway, so you could update your lookup table at the same time.Yeah! Thats the way I've done it and it works, but only for things that I have in my lookup table... Thanks, though for taking a look (I posted my INI2GUI onto the PB Resource site - it was related to that...)
Or is there some other reason you don't want a lookup table?
--
It's not minimalist - I'm increasing efficiency by reducing input effort.
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by naw.
exec cmd$(x,y,z,w,h,text$)
is shorter than this
select cmd$
case "TextGadget" : TextGadget(x,y,w,h,text$)
case "InputGadget" : InputGadget(x,y,w,h,text$)
case "InspectorGadget" : InspectorGadget(x,y,w,h,text$)
case "WidgetGadget" : WidgetGadget(x,y,w,h,text$)
.
.
.
.
endselect

Err! well yes, dont flame me for giving a *bad* reason, I am at least being honest here... I'm essentially very lazy and this:Or is there some other reason you don't want a lookup table?
exec cmd$(x,y,z,w,h,text$)
is shorter than this
select cmd$
case "TextGadget" : TextGadget(x,y,w,h,text$)
case "InputGadget" : InputGadget(x,y,w,h,text$)
case "InspectorGadget" : InspectorGadget(x,y,w,h,text$)
case "WidgetGadget" : WidgetGadget(x,y,w,h,text$)
.
.
.
.
endselect
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm