home *** CD-ROM | disk | FTP | other *** search
- ºaddshare.scpºIf "{_Locking}" = "-1"
- OutBox "Your system uses locking."
- Else
- MsgBox "r", "Should SHARE.EXE be activated?", "", "&Yes;&No"
- If "{r}" = "1"
- AddShareExe
- OutBox "Please leave Windows and restart your system to activate SHARE.EXE{_NL}For a sample how to do this with StepOne see command ReBoot."
- EndIf
- EndIf
- ºaskbox.scpºAskBox "i", "Please enter a text.", ""
- If "{i}" <> ""
- OutBox "You've entered the following text:{_NL}{i}"
- Else
- OutBox "You haven't entered a text."
- EndIf
- ºaskend.scpºAskEnd
- OutBox "No problem."
- Endºbeep.scpºAskBox "b", "Enter the number of beeps you want to hear.", ""
- If "{b}" <> "0"
- Beep "{b}"
- Else
- OutBox "No beep."
- EndIf
- ºchdir.scpºGetDir "p"
- PathBox "p1", "Enter the name of the path you want to chang to."
- If "{p}" <>\ "{p1}"
- ChDir "{p1}"
- MsgBox "", "You've choosed '{p1}'. Do you want to reactivate '{p}'?", "", "&Yes;&No"
- If "{_Stack}" = "1"
- ChDir "{p}"
- EndIf
- Else
- OutBox "No problem..."
- EndIf
- ºchftype.scpºChangeFileType "NewName", "{_appname}", "ini"
- OutBox " INI file with same base name and path as the sample{_nl}'{_appname}'{_nl}is named:{_nl}'{NewName}'"
- ºclipread.scpºTextRead "t", "{_BootDrv}\autoexec.bat"
- ClipWrite "{t}"
- ClipRead "auto"
- OutBox "{auto}"
- ºclipwrit.scpºTextRead "t", "{_BootDrv}\autoexec.bat"
- ClipWrite "{t}"
- ClipRead "auto"
- OutBox "{auto}"
- ºcompute.scpºLet "a", "2"
- Compute "res", "2", "+", "{a}"
- OutBox "2 plus {a} is: {erg}", "Calc 1"
- Compute "res", "10" + "{a}"
- OutBox "10 plus {a} is: {erg}", "Calc 2"
- ºconcat.scpºLet "res", "Hello "
- Concat "res", "World!"
- OutBox "{res}", "Result"
- ºcopy.scpºPathBox "s", "Enter a source path.", "", "", "", "", "-1", "&OK"
- If "{s}" <> ""
- SplitPathName "x", "{s}", "2"
- PathBox "t", "Enter a target path."
- If "{t}" <> ""
- Copy "{s}", "{t}\{x}"
- If "{_err}" = "0"
- OutBox "Ready - file copied."
- EndIf
- Else
- OutBox "No problem."
- EndIf
- Else
- OutBox "No problem."
- EndIf
- ºcreatetn.scpºTextRead "t", "{_bootdrv}\autoexec.bat", "0"
- CreateTempName "f"
- TextWrite "{f}", "{t}"
- TextRead "t1", "{f}"
- OutBox "{t1}"ºddeexec.scpºLet "p", "ProgMan"
- AskBox "g", "Program group, you want to create."
- If "{g}" <> ""
- DDEExecute "{p}", "{p}", "", "[creategroup({g})]"
- If "{_Err}" = "0"
- MsgBox "r", "Should {g} be deleted?", "", "&Yes;&No"
- If "{r}" = "1"
- DDEExecute "{p}", "{p}", "", "[deletegroup( {g})]"
- EndIf
- EndIf
- Else
- OutBox "No problem."
- EndIf
- ºddepoke.scpº' Please start first the _DDE example.
- DDEPoke "StepOne", "System", "DDESystem", "Client1~Display~Test"
- ºddereque.scpºDDERequest "res", "Progman", "Progman", "Groups"
- Window "-1", "", "", "{res}"
- GetUserInput
- ºdel.scpºLet "f", "del.tmp"
- TextWrite "{f}", "This is a test for the Del command."
- FileExist "r", "{f}"
- If "{r}" = "0"
- OutBox "There goes something wrong."
- Else
- TextRead "i", "{f}"
- MsgBox "", "File{_NL}'{f}'{_NL}was created with the following contents:{_NL}{i}{_NL}{_NL}Should StepOne now delete the file?", "", "&Yes;&No"
- If "{_Stack}" = "1"
- Del "{f}"
- Else
- OutBox "No problem..."
- EndIf
- EndIf
- ºdirexist.scpºDirExist "t", "{_TempDir}"
- If "{t}" = "0"
- OutBox "You don't have a TEMP directory."
- Else
- OutBox "TEMP directory exists as '{_TempDir}'."
- EndIf
- ºend.scpºLet "f", "{_BootDrv}\command.com"
- FileExist "e", "{f}"
- If "{e}" = "0"
- OutBox "You don't have MS-DOS, have you?"
- Else
- OutBox "File{_NL}'{f}'{_NL}exists."
- EndIf
- ºfiledate.scpºLet "f", "{_BootDrv}\command.com"
- FileExist "r", "{f}"
- If "{r}" = "0"
- OutBox "You don't have MS-DOS, have you?"
- Else
- FileDate "r", "{f}"
- OutBox "Your{_NL}'{f}'{_NL}is dated:{_NL}{r}"
- EndIf
- ºfileexis.scpºLet "f", "{_BootDrv}\command.com"
- FileExist "r", "{f}"
- If "{r}" = "0"
- OutBox "You don't have MS-DOS, have you?"
- Else
- OutBox "File{_NL}'{f}'{_NL}exists."
- EndIf
- ºfilelen.scpºLet "f", "{_BootDrv}\command.com"
- FileExist "r", "{f}"
- If "{r}" = "0"
- OutBox "You don't have MS-DOS, have you?"
- Else
- FileLen "r", "{f}"
- OutBox "File{_NL}'{f}'{_NL}is{_NL}{e} Bytes{_NL}long."
- EndIf
- ºfilesear.scpºFileSearch "FileWithPath", "command.com"
- OutBox "{FileWithPath}", "Searching in DOS path: command.com"
- FileSearch "FileWithPath", "io.sys"
- OutBox "{FileWithPath}", "Searching in DOS path: io.sys"
- ºfindfrst.scpºWindow "-1", "", "Please be patient...", "Searching INI files in Windows directory."
- Let "List", ""
- FindFirst "res", "{_windowsdir}\*.ini"
- For "i", "1", "1000"
- If "{res}" <> ""
- Concat "List", "{res}{_nl}"
- FindNext "res"
- Else
- ExitFor
- EndIf
- Next
- Compute "i", "{i}" - "1"
- Window "-1", "", "{i} INI files found", "{List}"
- GetUserInputºfornext.scpºFor "i", "1", "10"
- MsgBox "res", "Counter has value: {i}.{_nl}Do you want to continue?", "", "&OK;&Cancel"
- If "{res}" = "2"
- ExitFor
- EndIf
- Nextºgetdir.scpºGetDir "p"
- OutBox "Active path is:{_NL}'{p}'."
- ºgetdiskf.scpºLet "d", "{_BootDrv}"
- GetDiskFree "f", "{d}"
- OutBox "Your boot drive {d} has {_NL}{f} bytes{_NL} free."
- ºgetdiskl.scpºLet "d", "{_BootDrv}"
- GetDiskLabel "l", "{d}"
- OutBox "Volume label of your boot drive {d} is:{_NL}{l}"
- ºgetdisks.scpºLet "d", "{_BootDrv}"
- GetDiskSize "s", "{d}"
- OutBox "Your boot drive {d} has a capacity of:{_NL}{s} bytes{_NL}"
- ºgetdiskt.scpºLet "d", "{_BootDrv}"
- GetDiskType "t", "{d}"
- If "{t}" <> "HD"
- OutBox "Your boot drive {d} isn't a hard drive."
- Else
- OutBox "Your boot drive {d} is a hard drive."
- EndIf
- ºgetenvir.scpºgetenvironment "env", "prompt"
- OutBox "DOSPrompt: {env}"ºgetnewer.scpºGetNewerFile "newer", "{_bootdrv}\config.sys", "{_bootdrv}\autoexec.bat"
- GoSub "{newer}"
-
- Sub 1
- OutBox "File CONFIG.SYS is younger as file AUTOEXEC.BAT."
- EndSub
-
- Sub 2
- OutBox "File CONFIG.SYS is older as file AUTOEXEC.BAT."
- EndSubºgettabc.scpºGetTableCount "t"
- If "{t}" <> ""
- OutBox "You have {t} table(s) in your project."
- Else
- OutBox "You don't have tables in your project."
- EndIf
- ºgettabec.scpºGetTableElementCount "e"
- If "{e}" <> ""
- OutBox "You've {e} elements in the table(s) of your project."
- Else
- OutBox "You don't have tables in your project."
- EndIf
- ºgettablc.scpºGetTableLineCount "l"
- If "{l}" <> ""
- OutBox "You've {l} lines in the table(s) of your project."
- Else
- OutBox "You don't have tables in your project."
- EndIf
- ºgetuseri.scpºLet "t", "StepOne test"
- Window "-1", "{t}", "Info", "Press 'End', or 'Alt+E' to end '{t}'.", "-1", "10;10;990;900"
- GetUserInput "&End"
- ºgosub.scpºGoSub "test", "abc"
- End
-
- Sub test
- Parameter "x"
- OutBox "{test:x}"
- EndSub
- ºgoto.scpºAskBox "res", "How often should loop be executed?{_NL}Please enter the desired number:"
- If "{res}" <> ""
- Compute "", "{res}" + "1"
- If "{_Err}" = "0"
- Label "ForLoop"
- Compute "i", "{i}" + "1"
- If "{i}" <= "{res}"
- PlayWave "{_WindowsDir}\xylophon.wav"
- Goto "ForLoop"
- Else
- Goto "AfterForLoop"
- EndIf
- EndIf
- EndIf
- OutBox "Sorry, you haven't entered a number!"
- Label "AfterForLoop"
- ºif.scpºMsgBox "res", "Do you want to see a demonstration of If?", "", "&Yes;&No"
- If "{res}" = "1"
- Let "t", "You want to see a demonstration."
- Else
- Let "t", "Why no?"
- EndIf
- OutBox "{t}"
- ºiniread.scpºIniRead "res", "", "Devices", "{_Nil}"
- Let "t", ""
- For "Count", "1", "100"
- Split "dev", "{res}", "{_NL}", "{Count}"
- If "{dev}" <> ""
- IniRead "res1", "", "Devices", "{dev}"
- Concat "t", "{dev} at {erg1}{_NL}"
- Else
- ExitFor
- EndIf
- Next
- If "{t}" <> ""
- Let "t", "[Devices]{_NL}{t}"
- OutBox "{t}", "Your devices and interfaces"
- EndIf
- ºiniwrite.scpºLet "Contents", "{_BootDrv}\StepOne\^.SCP"
- IniWrite "", "Extensions", ".SCP", "{Contents}"
- If "{_Err}" = "0"
- IniRead "res", "", "Extensions", ".SCP"
- OutBox "Your file WIN.INI was edited as follows:{_NL}[Extensions]{_NL}.SCP={res}"
- Else
- OutBox "Error during editing of file WIN.INI."
- EndIf
- IniWrite "", "Extensions", ".SCP", "{_NIL}"
- ºisattrib.scpºLet "f", "{_BootDrv}\command.com"
- IsArchive "a", "{f}"
- IsHidden "h", "{f}"
- IsReadOnly "r", "{f}"
- IsSystem "s", "{f}"
- Let "t", "{f} has set the following attributes:{_NL}"
- If "{a}" = "-1"
- Concat "t", "Archive{_NL}"
- EndIf
- If "{h}" = "-1"
- Concat "t", "Hidden{_NL}"
- EndIf
- If "{r}" = "-1"
- Concat "t", "Read only{_NL}"
- EndIf
- If "{s}" = "-1"
- Concat "t", "System{_NL}"
- EndIf
- OutBox "{t}"
- ºisperm2w.scpºMsgBox "res", "Please enter a write protected disk in drive 'A'.", "", "&OK;&Cancel"
- If "{res}" = "1"
- IsPermissionToWrite "res1", "a:"
- If "{res1}" = "0"
- OutBox "You don't have a write permission at drive 'A'."
- Else
- Outbox "The disk in drive 'A' isn't write protected."
- EndIf
- EndIfºistaskac.scpºIsTaskActive "res", "{_WindowsDir}\progman.exe"
- If "{res}" = "-1"
- OutBox "Program Manager is allready started."
- Else
- OutBox "Program Manager isn't started."
- EndIf
- ºjump.scpºJump "+2"
- OutBox "This text will never be displayed"
- ' Comment lines don't count
- OutBox "Hello World"
- ºlabel.scpºLet "Count", "0"
- Let "Cancel", "0"
- '...
- If "{Cancel}" = "1"
- Goto "LoopEnd"
- EndIf
- Label "LoopBegin"
- Compute "Count", "{Count}", "+", "1"
- MsgBox "Cancel", "Loop was executed {Count} times.{_NL}Do you want to exit?", "", "&Yes;&No"
- If "{Cancel}" = "2"
- Goto "LoopBegin"
- EndIf
- Label "LoopEnd"
- OutBox "Loop was executed {Count} times."
- ºlen.scpºAskBox "t", "Please enter a text."
- Len "res", "{t}"
- If "{res}" = "0"
- Let "tx", "You don't have entered a text."
- Else
- Let "tx", "ou've entered the following text:{_NL}{t}{_NL}Text contains{_NL}{erg} characters."
- EndIf
- OutBox "{tx}"
- ºlet.scpºLet "res", "Hello "
- Concat "res", "World!"
- OutBox "{res}", "Result"
- ºmci2.scpºWindow "-1", "", "Now Playing: 1"
- Let "count", "1"
- Label "loop"
- MCISend "", "open cdaudio alias mymusic"
- If "{_err}" = "-1"
- OutBox "No Audio CD found."
- Goto "break"
- EndIf
- MCISend "", "set mymusic time format tmsf"
- MCISend "", "play mymusic from {count}"
- If "{_err}" = "-1"
- Goto "break"
- EndIf
- Wait "+20"
- MCISend "", "stop mymusic"
- MCISend "", "close mymusic"
- Compute "count", "{count}" + "1"
- Window "-1", "", "Now Playing: {count}"
- Goto "loop"
- Label "break"
- ºmcisend.scpºMCISend "", "open {_WindowsDir}\xylophon.wav type waveaudio alias mywave"
- MCISend "", "play mywave wait"
- MCISend "", "close mywave"
- ºmkdir.scpºLet "targetp", "{_BootDrv}"
- Let "Datap", "{targetp}\dummy"
- MkDir "{Datap}"
- If "{_Err}" = "0"
- PathBox "", "Path 'dummy' was created...", "", "{targetp}\dummy", "", "", "0", "&OK"
- RmDir "{Datap}"
- If "{_err}" = "0"
- OutBox "... and now deleted!"
- EndIf
- EndIf
- ºmsgbox.scpºLet "f", "AUTOEXEC.BAT"
- TextRead "res", "{_BootDrv}\{f}"
- MsgBox "r", "Do you want to see the contents of {f}?", "", "&Yes;&No"
- If "{r}" = "1"
- OutBox "{res}"
- Else
- OutBox "No problem..."
- EndIf
- ºnetaddc.scpº' Please use for 'd:' and '\\server\path' corresponding values to your system.
- NetAddConnection "d:", "\\server\path"
- ºnetcance.scpº' Please change 'f:' to a corresponding value on your system.
- NetGetConnection "Resource", "f:"
- If "{Resource}" <> ""
- NetCancelConnection "f:"
- Else
- OutBox "Network drive 'f:' isn't available."
- EndIf
- ºnetgetc.scpºNetGetConnection "Res", "f:"
- If "{Res}" = ""
- OutBox "Network drive 'f:' isn't available."
- Else
- OutBox "Drive 'f:' is named in network {Res}."
- EndIf
- ºoutbox.scpºTextRead "tf", "{_BootDrv}\AUTOEXEC.BAT"
- OutBox "{tf}", "AUTOEXEC.BAT"
- ºpatchf.scpºLet "hint", "Important hint!!!{_nl}"
- Concat "hint", "This example changes the file PATCHME.EXE. Some virus scanner "
- Concat "hint", "will recognize the change of this file and will "
- Concat "hint", "think this could be an unknown virus typ. "
- Concat "hint", "This is definitively wrong and a problem of virus scanner. "
- Concat "hint", "The software isn't able to make a difference between "
- Concat "hint", "legal and illegal changes of EXE files!"
- OutBox "{hint}"
- ' Gets the user name of the resource from file USER.EXE.
- ' This isn't documented but was described in german
- ' Microsoft System Journal 1/94. Command ResStringRead
- ' of StepOne is useful for this...
- ResStringRead "username", "user.exe", "514"
-
- ' #515 is the name of the corporation
- ResStringRead "corpname", "user.exe", "515"
-
- Let "username", "{username} of {corpname}"
- SplitPathName "path", "{_appname}", "1"
-
- ' To make sure that the example works every time we only work with a copy of PatchMe
- Copy "{path}\patchme.exe", "{path}\patchme1.exe", "3"
-
- PatchFile "{path}\patchme1.exe", "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "{UserName}"
-
- ' Checks, if it works fine
- TaskStart "{path}\patchme1.exe" ºpathbox.scpºPathBox "ini", "Please choose an INI file.", "", "", "", "*.ini", "-1"
- If "{ini}" <> ""
- TextRead "i", "{ini}"
- OutBox "You've choosed the following INI file:{_NL}{ini}{_NL}{i}"
- Else
- OutBox "No problem."
- EndIf