
-----------------------------------
Krocker
Wed Nov 03, 2010 8:20 am

Opening different exe files using turing
-----------------------------------
What is it you are trying to achieve?
Have turing open diferent exe files when a button is clicked.

What is the problem you are having?
Figuring how to open the files when clicked


Describe what you have tried to solve this problem
OPEN and SYS.EXEC


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)

% The "GUI.CreatePictureButton" program.
import GUI
View.Set ("graphics:130;70,nobuttonbar")

const size : int := 20           % The buttons size.
const border : int := 2

var starButton, mapleButton, starPic, mapleLeafPic : int

procedure StarPressed
    Text.Locate (1, 1)
    put "Simple"
end StarPressed

procedure MaplePressed
    Text.Locate (1, 1)
    put "Compound"
end MaplePressed

% Create the pictures.
% The star.
Draw.Star (border, border, border + size, border + size, black)
Draw.Star (border + 1, border + 1, border + size - 1,
    border + size - 1, black)
Draw.FillStar (border + 2, border + 2, border + size - 2,
    border + size - 2, brightred)
starPic := Pic.New (0, 0, 2 * border + size, 2 * border + size)

% The mapleleaf.
Draw.FillBox (border, border, border + size, border + size, white)
Draw.MapleLeaf (border, border, border + size, border + size, black)
Draw.MapleLeaf (border + 1, border + 1, border + size - 1,
    border + size - 1, black)
Draw.FillMapleLeaf (border + 2, border + 2, border + size - 2,
    border + size - 2, brightred)
mapleLeafPic := Pic.New (0, 0, 2 * border + size, 2 * border + size)

% Create the picture buttons.
Draw.Cls
starButton := GUI.CreatePictureButton (10, 10, starPic, StarPressed)
mapleButton := GUI.CreatePictureButton (55, 10, mapleLeafPic,
    MaplePressed)

loop
    exit when GUI.ProcessEvent
end loop


Please specify what version of Turing you are using
4

-----------------------------------
SNIPERDUDE
Wed Nov 03, 2010 11:54 am

RE:Opening different exe files using turing
-----------------------------------
You need to put the sys.exec code within the procedure you want it to run from (ex: within StarPressed).

-----------------------------------
Krocker
Wed Nov 03, 2010 3:13 pm

Re: RE:Opening different exe files using turing
-----------------------------------
You need to put the sys.exec code within the procedure you want it to run from (ex: within StarPressed).



k.. when i put sys.exec, then what, plz he specific. thx is there soemthin i  need put before hand or somethin?

-----------------------------------
SNIPERDUDE
Wed Nov 03, 2010 3:29 pm

RE:Opening different exe files using turing
-----------------------------------
Sys.Exec ("filename.exe")
You can find further information on it in the Turing Help documents (press F10 in Turing). The Turing Walkthrough might have something on it too.

-----------------------------------
Krocker
Wed Nov 03, 2010 4:37 pm

Re: RE:Opening different exe files using turing
-----------------------------------
Sys.Exec ("filename.exe")
You can find further information on it in the Turing Help documents (press F10 in Turing). The Turing Walkthrough might have something on it too.


thx that help, i have another quick question, if i want to make a button that when clicked, were would i put the coding (sys.exec)? note that i have 2 buttons.

import GUI

setscreen ("graphics:550;150")

% Tells what the button has to do
procedure Simplepressed
    put "You Have selected SIMPLE INTEREST"
   
end Simplepressed

procedure Compoundpressed
    put "You have selected COMPOUND INTEREST"
    
end Compoundpressed

% Gives the buttons a variable and creates the button
var button1 : int := GUI.CreateButton (140, 60, 2, "SIMPLE", Simplepressed)
var button2 : int := GUI.CreateButton (20, 60, 2, "COMPOUND", Compoundpressed)

put "WELCOME TO KB INTEREST CALCULATOR"
colour (3)
put "PLEASE CHOOSE ONE OF THE FOLLOWING TYPES OF INTERESTS"

loop
    exit when GUI.ProcessEvent
end loop




thanks again [/u]

-----------------------------------
SNIPERDUDE
Wed Nov 03, 2010 6:29 pm

RE:Opening different exe files using turing
-----------------------------------
You would need to put the appropriate Sys.Exec line in the procedure that gets called. So:
import GUI 

setscreen ("graphics:450;150") 

var END : boolean := false

% Tells what the button has to do 
procedure Simplepressed 
    put "You Have selected SIMPLE INTEREST"
    if Sys.Exec ("simple.exe") then
        END := true
    end if
end Simplepressed 

procedure Compoundpressed 
    put "You have selected COMPOUND INTEREST"
    if Sys.Exec ("compound.exe") then
        END := true
    end if
end Compoundpressed 

procedure Quitpressed
    END := true
end Quitpressed

% Gives the buttons a variable and creates the button 
var button1 : int := GUI.CreateButton (140, 60, 110, "SIMPLE", Simplepressed) 
var button2 : int := GUI.CreateButton (20, 60, 110, "COMPOUND", Compoundpressed) 
var button3 : int := GUI.CreateButton (260, 60, 110, "QUIT", Quitpressed)

put "WELCOME TO KB INTEREST CALCULATOR" 
colour (3) 
put "PLEASE CHOOSE ONE OF THE FOLLOWING TYPES OF INTERESTS" 

loop 
    exit when GUI.ProcessEvent or END 
end loop

-----------------------------------
Krocker
Wed Nov 03, 2010 8:20 pm

Re: RE:Opening different exe files using turing
-----------------------------------
You would need to put the appropriate Sys.Exec line in the procedure that gets called. So:
import GUI 

setscreen ("graphics:450;150") 

var END : boolean := false

% Tells what the button has to do 
procedure Simplepressed 
    put "You Have selected SIMPLE INTEREST"
    if Sys.Exec ("simple.exe") then
        END := true
    end if
end Simplepressed 

procedure Compoundpressed 
    put "You have selected COMPOUND INTEREST"
    if Sys.Exec ("compound.exe") then
        END := true
    end if
end Compoundpressed 

procedure Quitpressed
    END := true
end Quitpressed

% Gives the buttons a variable and creates the button 
var button1 : int := GUI.CreateButton (140, 60, 110, "SIMPLE", Simplepressed) 
var button2 : int := GUI.CreateButton (20, 60, 110, "COMPOUND", Compoundpressed) 
var button3 : int := GUI.CreateButton (260, 60, 110, "QUIT", Quitpressed)

put "WELCOME TO KB INTEREST CALCULATOR" 
colour (3) 
put "PLEASE CHOOSE ONE OF THE FOLLOWING TYPES OF INTERESTS" 

loop 
    exit when GUI.ProcessEvent or END 
end loop







-----------------------------------
SNIPERDUDE
Wed Nov 03, 2010 10:24 pm

RE:Opening different exe files using turing
-----------------------------------
Cheers.
