thank you charles and aurel for your help.
a) charles, your line is working here fine for "shellexecute" function if I specify the name of the oxygenfile for 100 per Cent correctly.
for example: "mytest.o2bas"
b) aurel your example is working too with your Asci Editor, no problem, I have understood these things.
aa) the "gxo2.exe" file I have now in same folder for testing as the oxy example.
! ShellExecute alias "ShellExecuteA" lib "Shell32.dll" _
(sys Hwnd, string operation,file,parameters,directory,sys ShowCmd) as sys
ShellExecute null,"open","gxo2.exe","mytest.o2bas","",1
but... ab) where does oxygen knows what file has to be executed or compiled? if I am using instead of correct file name "mytest1.o2bas" the shellexecute doesn't work, the file is empty (error message appears) or cannot be found. Now how I can say oxygen with "shellexecute" function "please compile or execute the file that's open or saved?" I wanted to prevent to show the open or savefile dialog. If I am saving the file before and using "exec..." function like in "OxiIdeUtil.inc" that's not a problem because the file and whole content (text buffer) was caught and executed as I wished.
below working example for a test only with:
old "sciEdit.o2bas" example:
$ Filename"XsciEditTest.exe"
include "RTL32.inc"
Include "awinh.inc"
#lookahead ' for procedures
sys win
INT winstyle
INT button0,button1,button2,button3,button4,button5,button6,button7,button8
INT edit1,edit2,edit3
INT Lbox,static1,static2,static3,hsci
INT ed1ID,ed2ID,ed3ID
INT b0ID,b1ID,b2ID,b3ID,b4ID,b5ID,b6ID,b7ID,b8ID,b9ID,b10ID
INT LboxID = 300
INT st1ID,st2ID
int x,y,w,h
INT reID
b0ID=99
b1ID=100
b2ID=101
b3ID=102
b4ID=103
b5ID=104
b6ID=105
b7ID=106
b8ID=107
'-----------------
ed1ID=200
ed2ID=201
ed3ID=202
'----------------
st1ID=350
st2ID=351
st3ID=352
'##### SCINTILLA CONSTANTS ###################################
sciID=400 'scintilla ID
INT hlibsci,hsci 'scintilla handlers
% SCE_OB_DEFAULT = 0
% SCE_OB_LINECOMMENT = 1
% SCE_OB_BLOCKCOMMENT = 2
% SCE_OB_NUMBER = 3
% SCE_OB_KEYWORD = 4
% SCE_OB_TYPE = 5
% SCE_OB_SETID = 6
% SCE_OB_PREPROCESSOR = 7
% SCE_OB_STRING = 8
% SCE_OB_OPERATOR = 9
% SCE_OB_IDENTIFIER = 10
% SCE_OB_LABEL = 11
% SCE_OB_ASM = 12
% SCLEX_OBASIC = 40
% SCI_SETLEXER = 4001
% SCI_STYLESETFORE = 2051
% SCI_STYLESETBACK = 2052
% SCI_STYLECLEARALL = 2050
% SCI_SETKEYWORDS = 4005
% SCI_STYLESETFONT = 2056
% SCI_STYLESETSIZE = 2055
% SCI_STYLESETBOLD = 2053
% SCI_SETMARGINWIDTHN = 2242
% SCI_SETMARGINTYPEN = 2240
% SCI_SETMARGINSENSITIVEN = 2246
% SCI_SETSELBACK = 2068
% SCI_GOTOLINE = 2024
% SCI_LINELENGTH = 2350
% SCI_GETLINE = 2153
% SCI_GETLINECOUNT = 2154
% SCI_GETCURLINE= 2027
% SCI_SCROLLCARET=2169
% SCI_GOTOPOS=2025
% SCI_GETTEXT = 2182
% SCI_SETTEXT = 2181
% SCI_GETTEXTLENGTH = 2183
% SCI_CLEAR=2180
% SCI_CLEARALL=2004
% SCI_BRACEBADLIGHT=2352
% SCI_BRACEHIGHLIGHT=2351
% SCI_BRACEMATCH=2353
% SCI_GETSELECTIONEND=2145
% SCI_SETSELECTIONEND=2144
% SCI_SETCARETLINEVISIBLE=2096
% SCI_SETCARETFORE = 2069
% SCI_SETCARETLINEBACK = 2098
% SCI_SCROLLCARET=2169
% SCI_UNDO = 2176
% SCI_CUT = 2177
% SCI_COPY = 2178
% SCI_PASTE = 2179
% SC_MARGIN_SYMBOL = 0
% SC_MARGIN_NUMBER = 1
% SCI_SETMARGINMASKN = 2244
! ShellExecute alias "ShellExecuteA" lib "Shell32.dll" _
(sys Hwnd, string operation,file,parameters,directory,sys ShowCmd) as sys
'ShellExecute null,"open","..\..\gxo2.exe","t.o2bas","",1
'init color strings
bSTRING sciblue,scired,scibrown
Gosub oxyKeywords
'- tview -------------
INT htv,tvID
tvID = 500
'loadbmp
'##################################################
INT bmpB0,bmpB1,bmpB2,bmpB3,bmpB4,bmpB5,bmpB6,bmpB7,bmpB8
bmpB0 = LoadImage(0,"data/btNew.bmp",0,30,30,16)
bmpB1 = LoadImage(0,"data/btOpen.bmp",0,30,30,16)
bmpB2 = LoadImage(0,"data/btSave.bmp",0,30,30,16)
bmpB3 = LoadImage(0,"data/btUndo.bmp",0,30,30,16)
bmpB4 = LoadImage(0,"data/btCut.bmp",0,30,30,16)
bmpB5 = LoadImage(0,"data/btCopy.bmp",0,30,30,16)
bmpB6 = LoadImage(0,"data/btPaste.bmp",0,30,30,16)
bmpB7 = LoadImage(0,"data/btCompile.bmp",0,30,30,16)
bmpB8 = LoadImage(0,"data/btRun.bmp",0,30,30,16)
'##################################################
x=100:y=100:w=640:h=480
winstyle = WS_MINMAXSIZE or WS_CLIPCHILDREN
'create window **************************************************
win = SetWindow("SciEdit Test",x,y,w,h,0,winstyle,&Main)
'****************************************************************
'create buttons ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
'NEW
button0 = SetButton(win,4,4,32,32,"",0x50000080,0x200,b0ID)
SendMessage button0 , BM_SETIMAGE, 0, bmpB0
'OPEN
button1 = SetButton(win,38,4,32,32,"O",0x50000080,0x200,b1ID)
SendMessage button1 , BM_SETIMAGE, 0, bmpB1
'SAVE
button2 = SetButton(win,74,4,32,32,"",0x50000080,0x200,b2ID)
SendMessage button2 , BM_SETIMAGE, 0, bmpB2
'UNDO
button3 = SetButton(win,110,4,32,32,"",0x50000080,0x200,b3ID)
SendMessage button3 , BM_SETIMAGE, 0, bmpB3
'CUT
button4 = SetButton(win,146,4,32,32,"",0x50000080,0x200,b4ID)
SendMessage button4 , BM_SETIMAGE, 0, bmpB4
'COPY
button5 = SetButton(win,180,4,32,32,"",0x50000080,0x200,b5ID)
SendMessage button5 , BM_SETIMAGE, 0, bmpB5
'PASTE
button6 = SetButton(win,216,4,32,32,"",0x50000080,0x200,b6ID)
SendMessage button6 , BM_SETIMAGE, 0, bmpB6
'COMPILE
button7 = SetButton(win,252,4,32,32,"",0x50000080,0x200,b7ID)
SendMessage button7 , BM_SETIMAGE, 0, bmpB7
'RUN
button8 = SetButton(win,286,4,32,32,"",0x50000080,0x200,b8ID)
SendMessage button8 , BM_SETIMAGE, 0, bmpB8
':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
'create single-line edit control
edit1 = SetEditBox(win,160,54,466,23,"edit 1",0x50004000,0x200,ed1ID)
'create listbox ===================================================
INT lbx,lby,lbw,lbh
lbx=10:lby=54:lbw=144:lbh=386
Lbox = SetListBox(win,lbx,lby,lbw,lbh,"",0x50000140,0x200,LboxID)
'=================================================================
'create static control
static2 = SetStatic(win,10,40,188,13,"Scintilla control in OxygenBasic by Aurel",0,0,st1ID)
'set sci dimensions
INT rx,ry,rw,rh
rx=160:ry=80:rw=466:rh=360
'--------------------------------------------------------------------
'---------------------------------------------------------------------
'Create Scintilla control ->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
INT hlibsci,hsci,i
hlibsci = LoadLibrary "SciLexer.dll"
'print str(hlibsci)
INT rx,ry,rw,rh,ext,sci_style
rx=160: ry=80 : rw=466 : rh=360 : ext=0x200
sci_style = WS_CHILD|WS_VISIBLE|ES_SUNKEN
hsci = CreateWindowEx(ext,"Scintilla","",sci_style,rx,ry,rw,rh,win,sciID,0,0)
UpdateWindow hsci
'basic setings...
SENDMESSAGE(hsci, SCI_SETLEXER, SCLEX_OBASIC, 1)
SENDMESSAGE(hsci, SCI_STYLESETFORE, SCE_OB_DEFAULT,100)
'set sci backColor
SENDMESSAGE(hsci, SCI_STYLESETBACK,32,RGB(235,240,241))
SENDMESSAGE(hsci, SCI_STYLECLEARALL, 0, 1)
'set font
For i = 0 to 12
SENDMESSAGE (hsci, SCI_STYLESETFONT, i, "Courier New")
SENDMESSAGE (hsci, SCI_STYLESETSIZE, i, 9)
Next i
'set keyword colors
SENDMESSAGE(hsci, SCI_SETKEYWORDS, 3,scibrown) :'darkred
SENDMESSAGE(hsci, SCI_SETKEYWORDS, 1, sciblue ):'blue
'Margins ////////////////////////////////////////////////////////
'set number margin (for numnbers)
SendMessage(hsci, SCI_SETMARGINTYPEN, 0, SC_MARGIN_NUMBER)
SendMessage(hsci, SCI_SETMARGINWIDTHN, 0, 46)
'--------------------------------------------------------------------
SENDMESSAGE(hsci, SCI_STYLESETFORE, SCE_OB_LINECOMMENT,rgb(0,120,0))
SENDMESSAGE(hsci, SCI_STYLESETFORE, SCE_OB_BLOCKCOMMENT, rgb(0,120,0))
SENDMESSAGE(hsci, SCI_STYLESETFORE, SCE_OB_NUMBER,RGB(0,0,0))
SENDMESSAGE(hsci, SCI_STYLESETFORE, SCE_OB_KEYWORD,RGB(200,0,0))
SENDMESSAGE(hsci, SCI_STYLESETFORE, SCE_OB_TYPE,RGB(0,0,200)) :'keywords
SENDMESSAGE(hsci, SCI_STYLESETFORE, SCE_OB_SETID,rgb(160,0,0)):'orange/to dark blue
SENDMESSAGE(hsci, SCI_STYLESETFORE, SCE_OB_PREPROCESSOR,rgb(220,0,0))
SENDMESSAGE(hsci, SCI_STYLESETFORE, SCE_OB_STRING, 0x880088 )
SENDMESSAGE(hsci, SCI_STYLESETFORE, SCE_OB_OPERATOR,rgb(0,0,180))
SENDMESSAGE(hsci, SCI_STYLESETFORE, SCE_OB_IDENTIFIER, 0x000000 )
SENDMESSAGE(hsci, SCI_STYLESETFORE, SCE_OB_LABEL,rgb(0,0,0))
SENDMESSAGE(hsci, SCI_STYLESETFORE, SCE_OB_ASM, 0x555555 )
'ControlFont(hsci,16,400,0,"Courier New")
'->->->->->->->->->->->->->->->->->->
sys bRet
'
WHILE GetMessage (&wm,0,0,0)<>0
TranslateMessage &wm
DispatchMessage &wm
WEND
'<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-
Function Main(byval hWnd as long,byval wMsg as long, byval wParam as long,byval lparam as sys) as sys callback
SELECT wMsg
'----------------------------
CASE WM_DESTROY
PostQuitMessage 0
'------------------------------------------
case WM_SIZE
GetSize(win,x,y,w,h)
MoveWindow(hsci,160,80,(w-rw/2)+64,(h-56)-32 ,1)
MoveWindow(edit1,160,54,(w-rw/2)+64,23 ,1)
MoveWindow(Lbox,10,54,lbw,(h-56)-8 ,1)
'-------------------------------------------------------------
'-------------------------------------------------------------
CASE WM_COMMAND
controlID = LoWord(wParam) 'get control ID
notifyCode = HiWord(wParam) 'get notification message
Select controlID
CASE b0ID
If notifycode=0
'clear
SendMessage hsci,WM_SETTEXT,0,""
End If
CASE b1ID
If notifycode=0
Gosub doOpen
fnParser()
End If
CASE b2ID
If notifycode=0
'doSave
print "doRUN"
'ShellExecute null,"open","..\..\gxo2.exe","t.o2bas","",1
'ShellExecute null,"open","gxo2.exe","*.o2bas","",1
dorun
End If
CASE b3ID
If notifycode=0
'doUndo
End If
CASE b4ID
If notifycode=0
'doCut
End If
CASE b5ID
If notifycode=0
'doCopy
End If
End Select
'-----------------------------------------------------
END SELECT
FUNCTION = DefWindowProc hwnd,wMsg,wParam,lParam
END FUNCTION
SUB doRun()
STRING fName
STRING exepath=""
INT dotpos=0
dotpos=INSTR(fName,".")
exepath=Mid$(fName,1,dotpos-1)
exepath=exepath + ".exe"
'MESSAGEBOX 0,"path:"+exepath,"OK"
ShellExecute(0,"open", "gxo2.exe", "scintTest.o2bas","" , 1)
END SUB
'************************************************************
Sub doOpen
INT hsize=0
string fR
dir=""
string sep=chr(0)
'filter = "All Files"+sep+"*.*"+sep"Text files"+sep+"*.txt"+ sep
filter = " All files "+sep+" *.*"+sep+"Oxygen files "+sep+" *.o2bas"
title="Open File... "
hwnd=0
fR = FileDialog(dir,filter,title,0,0,"txt")
SendMessage edit1,WM_SETTEXT,0,strptr(fR)
tx = Getfile fR
hsize = SendMessage hsci, SCI_GETTEXTLENGTH, 0, 0
SendMessage hsci,SCI_SETTEXT,hsize+1,strptr(tx)
End Sub
'*************************************************************
SUB fnParser
STRING o2script[1024] 'string array
STRING i$,txt,d$=" "
STRING GW1,GW2
INT smax,start,lineNum,iLen,bo,ipos
start=0
smax = Sendmessage hsci,SCI_GETLINECOUNT, 0, 0
'parse line by line >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
FOR lineNum = start TO smax
int Pos=0
int EPos=0
int SPos=0
int WC=0
'get-line ........................................................
iLen = SendMessage hsci,SCI_LINELENGTH,lineNum,0 'get line length
o2script[lineNum] = String(iLen," ") 'set buffer space
Sendmessage hsci,SCI_GETLINE, lineNum, strPtr(o2script[lineNum])
'test ///////////////////////////////
'print "LINE:" + o2script[lineNum]
'///////////////////////////////////
o2script[lineNum] = Ltrim(o2script[lineNum])
'--------------------------------------------
WC = 1
Pos = InStr(1,o2script[lineNum], d$)
While Pos > 0
WC = WC + 1
Pos = InStr(pos+1,o2script[lineNum], d$)
Wend
'test wc------------------------------------------
'print WC
IF wc>0
SPos = 1
EPos = InStr(SPos,o2script[lineNum], d$) - 1
If EPos <= 0 Then EPos = LEN(o2script[lineNum])
GW1 = RTrim(LTrim(Mid(o2script[lineNum], SPos, EPos - SPos + 1)))
'print "GW1:"+GW1
END IF
'--------------------------------------------------
IF wc>1
SPos=EPos+2
EPos = InStr(SPos,o2script[lineNum], d$) - 1
If EPos <= 0 Then EPos = LEN(o2script[lineNum])
GW2 = RTrim(LTrim(Mid(o2script[lineNum], SPos, EPos - SPos + 1)))
'print "GW2:"+GW2
END IF
'test string & add to listbox
'/// SUB ///
IF Ucase(GW1) = "SUB"
'remove bracket ((((((((((((((((
bo = Instr (GW2,"(")
'print str(Len(GW2))
'print "BO:"+str(bo)
IF bo<>0
bo=bo-1
GW2=Mid(GW2,1,bo)
bo=0
END IF
i$ = "SUB:" + GW2
If ipos<>0 then ipos++
SendMessage Lbox,LB_ADDSTRING,ipos,i$
END IF
'/// FUNCTION ///
IF (Ucase(GW1) = "FUNCTION") And (Left(GW2,1)<>"=") And (Mid(GW1,9)<>"=")
bo = Instr (GW2,"(")
IF bo<>0
bo=bo-1
GW2=Mid(GW2,1,bo)
bo=0
END IF
i$ = "FN:" + GW2
If ipos<>0 then ipos++
SendMessage Lbox,LB_ADDSTRING,0,i$
END IF
GW1="":GW2=""
NEXT
END SUB
'///////////////////////////////////////
SUB oxyKeywords
'blue
sciblue="enum operator dim const local static global declare function sub method end if then else elseif endif "
sciblue=sciblue+"endsel do while enddo endwhile wend exit continue operation operations select case for to step next "
sciblue=sciblue+"goto gosub methods return block scope indexbase lib library extern that this "
sciblue=sciblue+"readstate writestate deff type val ltrim rtrim lcase ucase space left mid instr "
sciblue=sciblue+"asc len chr str hex print ellipse rgb sendmessage "
sciblue=sciblue+"with "
sciblue=sciblue+"noinit "
sciblue=sciblue+"byval "
sciblue=sciblue+"byref "
sciblue=sciblue+"economy "
sciblue=sciblue+"fpu "
sciblue=sciblue+"cpu "
sciblue=sciblue+"noprec "
sciblue=sciblue+"include "
sciblue=sciblue+"define "
sciblue=sciblue+"typedef "
sciblue=sciblue+"includepath "
sciblue=sciblue+"lookahead "
sciblue=sciblue+"view "
sciblue=sciblue+"endv "
sciblue=sciblue+"version "
sciblue=sciblue+"getmemory "
sciblue=sciblue+"freememory "
sciblue=sciblue+"getprocaddress "
sciblue=sciblue+"copy0 "
sciblue=sciblue+"copy00 "
sciblue=sciblue+"copyn "
sciblue=sciblue+"copy "
sciblue=sciblue+"mbox "
sciblue=sciblue+"comparestr "
'----------------------------
sciblue=sciblue+"alias macro as "
sciblue=sciblue+"incl "
sciblue=sciblue+"semicolon "
sciblue=sciblue+"indexers "
sciblue=sciblue+"retn "
sciblue=sciblue+"offset "
sciblue=sciblue+"skip "
sciblue=sciblue+"with "
sciblue=sciblue+"dataspace "
sciblue=sciblue+"data "
sciblue=sciblue+"o2 "
sciblue=sciblue+"bind "
sciblue=sciblue+"defs "
sciblue=sciblue+"def "
sciblue=sciblue+"struct "
sciblue=sciblue+"class "
sciblue=sciblue+"var "
sciblue=sciblue+"asm "
sciblue=sciblue+"o2h "
sciblue=sciblue+"librarypath "
sciblue=sciblue+"file "
sciblue=sciblue+"quote "
sciblue=sciblue+"union "
sciblue=sciblue+"leaf "
sciblue=sciblue+"autodim "
sciblue=sciblue+"minormajor "
sciblue=sciblue+"alert "
sciblue=sciblue+"pragma "
sciblue=sciblue+"unique "
sciblue=sciblue+"console "
sciblue=sciblue+"elif "
sciblue=sciblue+"fi "
sciblue=sciblue+"ifdef "
sciblue=sciblue+"ifndef "
sciblue=sciblue+"undef "
sciblue=sciblue+"undefine "
sciblue=sciblue+"blockdepth "
sciblue=sciblue+"new "
sciblue=sciblue+"del "
sciblue=sciblue+"terminate "
sciblue=sciblue+"freestrings "
sciblue=sciblue+"freelibs "
sciblue=sciblue+"inherits "
sciblue=sciblue+"of "
sciblue=sciblue+"from "
sciblue=sciblue+"has "
sciblue=sciblue+"export "
sciblue=sciblue+"external "
sciblue=sciblue+"com "
sciblue=sciblue+"virtual "
sciblue=sciblue+"endselect "
sciblue=sciblue+"load "
sciblue=sciblue+"and "
sciblue=sciblue+"or "
sciblue=sciblue+"xor "
sciblue=sciblue+"stdcall "
sciblue=sciblue+"cdecl "
sciblue=sciblue+"ms64 "
sciblue=sciblue+"pascal "
sciblue=sciblue+"not "
sciblue=sciblue+"once "
sciblue=sciblue+"public "
sciblue=sciblue+"private "
sciblue=sciblue+"strptr "
'darkred - brown
scibrown=scibrown+"void "
scibrown=scibrown+"byte "
scibrown=scibrown+"astring "
scibrown=scibrown+"pstring "
scibrown=scibrown+"bstring "
scibrown=scibrown+"char "
scibrown=scibrown+"zstring "
scibrown=scibrown+"wstring "
scibrown=scibrown+"bstring2 "
scibrown=scibrown+"zstring2 "
scibrown=scibrown+"asciiz "
scibrown=scibrown+"short "
scibrown=scibrown+"int "
scibrown=scibrown+"integer "
scibrown=scibrown+"float "
scibrown=scibrown+"single "
scibrown=scibrown+"sys "
scibrown=scibrown+"double "
scibrown=scibrown+"quad "
scibrown=scibrown+"word "
scibrown=scibrown+"dword "
scibrown=scibrown+"qword "
scibrown=scibrown+"uint "
scibrown=scibrown+"__int8 "
scibrown=scibrown+"__int16 "
scibrown=scibrown+"__int32 "
scibrown=scibrown+"__int64 "
scibrown=scibrown+"int8_t "
scibrown=scibrown+"int16_t "
scibrown=scibrown+"int32_t "
scibrown=scibrown+"int64_t "
scibrown=scibrown+"uint8_t "
scibrown=scibrown+"uint16_t "
scibrown=scibrown+"uint32_t "
scibrown=scibrown+"uint64_t "
scibrown=scibrown+"any "
scibrown=scibrown+"sys"
scibrown=scibrown+" bool "
scibrown=scibrown+"signed "
scibrown=scibrown+"unsigned "
scibrown=scibrown+"string "
scibrown=scibrown+"long "
END SUB
there must be an alternative way to work with "shellexecute" and "gxo2.exe" for compiling/running the script example without saving of open the current file.
best regards, frank