home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload
/
ShartewareOverload.cdr
/
windows
/
pubtech.zip
/
BWSCRIPT.PTB
< prev
next >
Wrap
Text File
|
1990-05-22
|
10KB
|
370 lines
; PubTech BatchWorks Demo
debug(@off)
DaTitle="PubTech BatchWorks Demo"
crlf = strcat(num2char(13),num2char(10))
; Set the length of time to be used for DISPLAY statements
TimeShort=3
TimeLong=6
; close any extraneous windows, except Command Post and/or MS-DOS
; Note that PubTech Batch should not close itself
wincloseall("Desktop","CBM Desktop","PubTech File","File","MS-","Program")
; get Windows shells iconized. Also test error supression.
error(@off)
winiconize("MS-")
winiconize("Program")
winiconize("File Manager")
; return to error cancel state
error(@cancel)
:START
savecwd=dirget()
a="Betty Boop"
beep
; Display start message
display(3,DaTitle,`This is the PubTech BatchWorks Demo`)
display(%TimeLong%,DaTitle,`A BatchWorks script was written to create this demonstration`)
display(%TimeLong%,DaTitle,`It's easy for a user to automate virtually all Windows functions`)
display(%TimeLong%,DaTitle,`For instance, we can start the clock using the BatchWorks RUN command...`)
run("clock.exe","")
display(%TimeLong%,DaTitle,`The clock is on screen now`)
display(%TimeLong%,DaTitle,`Now we will close the clock`)
winclose("Clock")
display (2,DaTitle,"The clock window just closed")
display(%TimeLong%,DaTitle,`Now we will open the cardfile ZOOMED`)
runzoom("cardfile.exe","")
display(%TimeLong%,DaTitle,`OK so far?`)
display(%TimeLong%,DaTitle,`Let's close the cardfile and do a few more things`)
winclose("Cardfile")
display(%TimeLong%,DaTitle,`We can run the notepad and hide it with the RUNHIDE command`)
runhide("notepad.exe","")
display(%TimeLong%, DaTitle,"Notepad is running, but it's hidden; Let's use the WINSHOW command to show it")
WINSHOW("Notepad")
display(%TimeLong%, DaTitle,"Notepad is showing now")
display(%TimeLong%,DaTitle,`Now let's iconize it with the WINICONIZE command`)
WinIconize("Notepad")
display(%TimeLong%,DaTitle,`Let's run a couple more apps`)
run("Cardfile.exe",'')
run("calendar.exe","")
display(%TimeLong%,DaTitle,`Now we want to activate notepad too`)
winactivate("Notepad")
display(%TimeLong%,DaTitle,`Now we can arrange everything with the WINARRANGE command`)
WinArrange("Stackemup oinkser")
display(%TimeLong%,DaTitle,`Let's close everything but the Notepad and Windows shell`)
WinCloseall( "Notepad","Desktop","CBM Desktop","PubTech File","File","MS-","Program" )
; get Windows shells iconized
error(@off)
winiconize("MS-")
winiconize("File Manager")
winiconize("Program")
; return to error cancel state
error(@cancel)
display(%TimeLong%, DaTitle,"Now only the Notepad is active")
WinCloseall("Desktop","CBM Desktop","PubTech File","File","MS-","Program")
display(%TimeLong%, DaTitle,"Now everything has been closed")
; well. Lets try zooping the old clock around
; with the place statement
display(%TimeLong%, DaTitle,"Now for some fancy footwork")
display(%TimeLong%,DaTitle,`We can use the WINPLACE command to size and place windows`)
run("clock.exe","")
z = 11
a = 0
b = 0
:clk1
if z == 0 then goto clk2
z = z - 1
c = a + 300
d = b + 200
WinPlace(a,b,c,d,"Clock")
a = a + 70
b = b + 80
goto clk1
:clk2
z = 11
a = 700
b = 0
:clk3
if z == 0 then goto clk4
z = z - 1
c = a + 300
d = %b% + 200 ; stuff in a substitute here to be sure it still works
WinPlace(a,b,c,d,'Clock')
a = a - 70
b = b + 80
goto clk3
:clk4
WinClose("Clock")
display(%TimeLong%,DaTitle,`BatchWorks gives you the power to do just about anything Windows can do`)
display(%TimeLong%,DaTitle,"Here is an example of some file management")
display(%TimeLong%,DaTitle,"Your config.sys file will be displayed")
dexist=FILEEXIST("c:\config.sys")
if dexist == 0 then goto sorry
logdisk("c")
error(@off)
DirMake("\ptdemo")
error(@cancel)
FileCopy("\config.sys","\ptdemo\dummy.txt")
DirChange("\ptdemo")
FileMove("dummy.txt","muddy.txt")
textbox("Config.Sys","muddy.txt")
FileDelete("muddy.txt")
DirChange("\")
DirRemove("\ptdemo")
goto notsorry
:sorry
display(%TimeLong%,DaTitle,"Oops! You don't have a config.sys file!")
:notsorry
display(%TimeLong%,DaTitle,`You can open files, delete files, copy files, create directories`)
display(%TimeLong%,DaTitle,`Your imagination is the limit`)
display(%TimeLong%,DaTitle,`Let's do a little user interaction`)
:rename
a=askline("Your Name Please","Please enter your full name","")
a=strtrim(a)
b=strlen(a)
if b != 0 then goto nameok
display(3,DaTitle,"Look, You gotta enter something to get past here")
goto rename
:nameok
execute display(3,DaTitle,"Thank you, %a%")
display(%TimeLong%,DaTitle,`Now let's do some fancy calculations`)
display(3,"%a%","Your name is %b% characters long")
; string mashing test
exclusive(@on)
; Parse name into component parts
; %a full name
; %b name length
; %c pointer
; %d current character
; %f reserved for saving original dir
; %h name count (first=1, middle=2 last=3 etc)
; %i indirect character for name
; %j variables for name
; %l space flag
; %m First name
; %n middle name (if entered)
; %o last name
; etc
c = 0
h = 1
i = "M"
j = "MNOPQRSTUVWXYZ"
l = 0
M = ''
:loop
if c == b then goto report
c = c + 1
; get first char
d=strsub(a,c,1)
if d== ' ' then goto space
; not a space
l = 0
%i%=strcat(%i%,d)
goto loop
:space
if l == 1 then goto loop
l = 1
h = h + 1
i=strsub(j,h,1)
%i% = ''
goto loop
:report
if h > 8 then h = 8
y = "PARSE"
; compare computed results with the parse function
parsedata(a)
if param0 <> h then goto failure
Display(3,a,"Your name has %h% parts. They are:")
w = 0
:report2
if h == w then goto envtest
w = w + 1
i=strsub(j,w,1)
display(3,"Name %w%",%i%)
if param%w% != %i% then goto failure
goto report2
:envtest
display(%TimeLong%,DaTitle,`Now let's get some environment information`)
exclusive(@off)
; getenv test
path=environ("path")
pathlen=strlen(path)
pathwork=""
i=1
:Looppath
if pathlen-i < 65 then goto OKPATH
j=i+64
j=strindex(path,';',j,@backscan)
pathwork=strcat(pathwork,strsub(path,i,j-i+1),crlf)
i=j+1
goto Looppath
:OKPATH
display(6,"%a%, your DOS PATH is",strcat(pathwork,strsub(path,i,pathlen-i+1)))
dirchange(savecwd)
display(%TimeLong%,DaTitle,`Let's look at the clipboard and put some data in it`)
; clipboard and random number stuff
run("clipbrd.exe","")
clipput(strcat("Clipboard Testing",crlf))
b=clipget()
clipput(strcat(b,"Random Numbers",crlf))
b=random(100)
clipappend(strcat(b,crlf))
b=random(100)
clipappend(strcat(b,crlf))
b=random(100)
clipappend(strcat(b,crlf))
display(3,DaTitle,"This is just a small sample of the power of BatchWorks")
display(3,DaTitle,"Now let's send some keystrokes to other applications...")
WinClose("Clipboard")
runzoom("write.exe","")
sendkey("Greetings:~~")
sendkey("This is an example of the {F6}PubTech BatchWorks{F6} SENDKEY function{sp}")
sendkey("typing ordinary text into a Microsoft Write file. You will notice that{sp}")
sendkey("the process is reasonably quick. Higher speeds may be obtained by using{sp}")
sendkey("the clipboard functions, as used in the example below.{sp 2}")
sendkey("The SENDKEY function can be used with the {F6}PubTech Macro{f6} facility{sp}")
sendkey("to insert boilerplate text into documents. For Example:~~")
sendkey("!CE{F6}")
clipput("Copyright Notice")
sendkey("+{insert}{F6}!CR!PC~~!PL")
clipput('This manual is copyrighted. All rights are reserved. This document may ')
clipappend('not, in whole or part, be copied, photocopied, reproduced, translated, or ')
clipappend('reduced to any electronic medium or machine readable form without prior ')
clipappend('consent, in writing, from ')
sendkey("+{INSERT}{sp}{F6}")
clipput("International Widgets.")
sendkey("+{insert}{F6}~~")
sendkey("This is the end of the SendKey/Write demo.")
pause(DaTitle,"Hit OK to Continue")
WinActivate("Write")
sendkey("!FXN")
; Do a dialog box demo
; Menu choices range from a-z, and A-Z. Menu actions are defined here.
; The correspondence is established by concatenating an "x" to the
; menu choice variable name.
display(%TimeLong%,DaTitle,`You can create your own dialog boxes for Windows or non-windows apps`)
display(%TimeLong%,DaTitle,`For instance, if you want to run any of the following apps...`)
display(%TimeLong%,DaTitle,`Just select one from the menu and click OK...`)
Ax='Run("Notepad.exe","")'
Bx='Run("Notepad.exe","Win.Ini")'
Cx='Run("Control.exe","")'
Dx='Run("Calendar.exe","")'
Ex='Run("Cardfile.exe","")'
Fx='Run("Write.exe","")'
:DBegin
drop (A,B,C,D,E,F)
drop (a,b,c,d,e,f)
dialogbox("Menu","menu.dlg")
LoopCntl=char2num("A")-1
LoopLimit=char2num("F")
:DLoop
LoopCntl=LoopCntl+1
If LoopCntl>LoopLimit then goto NextLoop
testmenu=num2char(LoopCntl)
testaction=strcat(testmenu,"x")
If (IsDefined(%testmenu%)+IsDefined(%testaction%))!=(@true+@true) then goto DLoop
action=%testaction%
If %testmenu% then %action%
goto DLoop
:NextLoop
if LoopLimit==char2num("f") then goto mdone
LoopCntl=char2num("a")-1
LoopLimit=char2num("f")
goto DLoop
:mdone
display(%TimeLong%,DaTitle,`You can also include radio buttons, list boxes and other items in dialog boxes`)
wincloseall("Desktop","CBM Desktop","PubTech File","File","MS-","Program")
display(%TimeLong%,DaTitle,`There are many other functions available...`)
display(%TimeLong%,DaTitle,`You can create editable script files with PubTech Macro that can be run as Batches`)
display(%TimeLong%,DaTitle,`Macros can also be added to the System menu of any application`)
display(%TimeLong%,DaTitle,`And you can compile batch files with the BatchWorks SDK available separately`)
display(%TimeLong%,DaTitle,`This concludes the BatchWorks Demo`)
display(10,DaTitle,`Call 1-800 PUBTECH or (512) 346-2835 for more information`)
; give the user a chance to cancel the demo
askq=ASKYESNO("BatchWorks Demo","Do you want to restart the demo?")
IF askq == @TRUE THEN GOTO START
display(%TimeShort%,DaTitle,`THANKS!`)
GOTO end
:failure
Message(DaTitle,"Item %y% failed")
exit
z = "failure"
:end
exit