rms='HKCU'
pms='\Software\Mort'\SystemPath("ScriptName")
SetChoiceEntryFormat(20,12,"Tahoma")
SetMessageFont (9,"Tahoma")
ver=MortScriptVersion()
If(ver eq '4.3.0.15')
@AllFiles('','')
Else
SleepMessage(5,'You are using an older version MortScript '&MortScriptVersion()&' A working 4.3.0.15','Pity...',1)
EndIf
Sub AllFiles(allf,st)
Local(ind,list,ext)
If(omd eq '')
omd=1
EndIf
If(allf eq '')
allf=@RegR(0,'fille')
del=@RegR(0,'del')
EndIf
GetClipText(bufer)
If(bufer eq '')
as=0
Else
as=1
EndIf
list[1]='* Run("'&FileBase(allf)&'")'
If(not st)
list[2]='* SETTINGS *'
Else
list[2]='* Hide Settings *'
If(allf eq '')
list[3]='*Select a file to test *'
Else
list[3]=FilePath(allf)
EndIf
list[4]=FileBase(allf)
list[5]=FileExt(allf)
If(del=1)
list[6]='*Delete after launch *'
ElseIf(del=2)
list[6]='* Save copies *'
ElseIf(del=0)
list[6]='* DO NOT DELETE *'
EndIf
If(as)
list[7]='* Review the buffer *'
EndIf
EndIf
ind=Choice("Run +",allf,omd,0,list)
omd=ind
If(ind=0)
Exit
ElseIf(ind=2)
If(st)
@AllFiles(allf,0)
Else
@AllFiles(allf,1)
EndIf
ElseIf(ind=3)
allff=@SelectFiles('*.*',list[ind],'Edit '&list[ind])
If(allff ne '')
allff=FilePath(allff)\FileBase(allff)&'.mscr'
@RegR(2,'del',0)
@RegR(1,'fille',allff)
@AllFiles(allff,st)
Else
@AllFiles(allf,1)
EndIf
ElseIf(ind=4)
allff=Input(list[ind],"Run +",0,0,list[ind])
If(allff ne '')
allff=FilePath(allf)\allff&FileExt(allf)
@RegR(1,'fille',allff)
@AllFiles(allff,st)
Else
@AllFiles(allf,st)
EndIf
ElseIf(ind=5)
allff=Input(list[ind],"Run +",0,0,list[ind])
If(allff ne '')
allff=FilePath(allf)\FileBase(allf)&allff
@RegR(1,'fille',allff)
@AllFiles(allff,st)
Else
@AllFiles(allf,st)
EndIf
ElseIf(ind=6)
If(del=1)
del=2
ElseIf(del=2)
del=0
ElseIf(del=0)
del=1
EndIf
@RegR(2,'del',del)
@AllFiles(allf,st)
ElseIf(ind=1)
WriteFile(allf,bufer)
If(del=2)
@Duplicat(allf,rty)
EndIf
@Ergor(allf)
If(del=1)
sleep 500
Delete(allf)
EndIf
ElseIf(ind=7)
BigMessage(SubStr(bufer,0,7000))
@AllFiles(allf,st)
EndIf
EndSub
# --------
Sub Ergor(fff)
If((fff eq ''))
@Uand('')
Else
Run(fff)
fff=FileBase(fff)&FileExt(fff)
Sleep 200
While(ScriptProcExists(fff))
If(d ne '')
Close('Error')
d=Replace(d,'^LF^','^NL^')&'^NL^'
SetClipText(d)
SleepMessage(1,SubStr(d,0,50),'The error text in the buffer')
ExitSub(d)
Else
d=@Uand('')
Sleep 100
EndIf
EndWhile
#;~ SleepMessage(2,'Check buffer','',0)
EndIf
EndSub
# --------
Sub Duplicat(fll,rt)
If(not rt)
flll=fll
EndIf
If(FileExists(fll))
fgd=fgd+1
@Duplicat(FilePath(fll)\FileBase(flll)&fgd&FileExt(fll),1)
Else
Copy(flll,fll)
SleepMessage(1,fll,'Copy retained',0)
Return(flll)
EndIf
EndSub
# --------
Sub Uand(b)
If(WndExists('Error'))
Show('Error')
WaitForActive('Error',5)
Sleep 500
n=ScreenshotClick('CLICK ON THE TEXT OF ERRORS.',40,0,0,16777215)
wtix=WindowText(n[1],n[2])
If((wtix ne '')and(wtix ne 'Error'))
Return(wtix)
Else
SleepMessage(1,wtix&'^LF^'&gh,'Attempt №'&2-b)
@Uand(b+1)
EndIf
EndIf
EndSub
# --------
Sub RegR(sam,rkey,rv,plus)
If(sam=1)
RegWriteString(rms,pms,rkey,rv)
ElseIf(sam=2)
RegWriteDWord(rms,pms,rkey,rv)
ElseIf(sam=0)
Return(RegRead(rms,pms,rkey))
EndIf
EndSub
# --------
Sub SelectFiles(Ext,default,info)
Local(list,idex,Ext,Dir,info)
Dir=SelectDirectory(title,info,default)
If(Dir ne '')
list=DirContents(Dir\Ext,DC_ALL)
idex=Choice(title,Dir,1,0,list)
If(not idex=0)
indt=list[idex]
Return(Dir\indt)
EndIf
EndIf
EndSub