Source language: Translate to:

Run a random exe file

NeoBook tips, tricks, code samples and more...

Moderator: Neosoft Support

Run a random exe file

Postby DownUnderOz » Tue Sep 09, 2008 10:48 am

I have 5 files in a folder called "RAINBOW":

file1.exe
file2.exe
file3.exe
file4.exe
file5.exe

I want to create an exe file that will have a button that, when pressed, will run (at random) one of the 5 exe files.

I only have a very basic knowledge of NeoBook, so could you please be explicit about exactly what I need to put in the "Actions" field. Unfortunately, I get very confused when reading the majority of posts on this forum!

Much appreciated
DownUnderOz
 
Posts: 5
Joined: Mon Oct 15, 2007 7:56 am

Postby smartmedia » Tue Sep 09, 2008 11:34 am

Hi...

Try this pub..
Save the all code in a file and open it from Neobook.

Code: Select all
NBW Publication Source File
(C)1993-2008 NeoSoft Corp.
Title=Untitled NeoBook Publication
Language=US
NeoBookVer=5,60
ScreenColors=16777216
ScreenWidth=320
ScreenHeight=200
BkndColor=0
ScreenAutoSize=Yes
LinkColor=16711680
WindowStyle=0
WindowOrder=0
WindowPos=0
WindowProps=31
BiDiMode=0
UseUpdateTimer=Yes
ReturnTime=60
ShapeTransColor=536870912
CompileType=0
MediaType=0
FilesIncluded=1
FontsIncluded=2
CopyExternalFiles=No
SetupMedia=3
SetupInstDir=C:\MyProgram
SetupTitle=Setup
SetupColors=16711680|0|65535
VersionMajor=1
VersionMinor=0
VersionRelease=0
VersionBuild=0
CustomFontName=Arial
CustomFontSize=9
CustomFontStyle=0
CustomCharset=1
CacheSize=30
ExtractOp=132
L_OK=OK
L_CANCEL=Cancel
L_YES=Yes
L_NO=No
L_CLOSE=Close
L_ERRORTITLE=Error
L_FINDTITLE=Find
L_FINDPROMPT=Find &What
L_FINDFIRST=&Find First
L_FINDNEXT=Find &Next
L_FINDERROR=Search text not found.
L_PWORDTITLE=Password required
L_PWORDMSG=Before continuing, you must first|enter the correct password.
L_PWORDPROMPT=&Password:
L_PWORDERROR=That's not the right password!
L_MEDIAERROR=In order to play this type of file you must install|the appropriate multimedia hardware and/or|software.
L_INTERNETERROR=Unable to locate Internet Browser software.
L_ABORTFUNCTION=Do you want to cancel this function?
L_EXTRACTERROR=This file could not be extracted and cannot be played.
L_INSTDIRPROMPT=Please enter the drive and directory where you would like this program to be installed. To accept the default drive and directory, simply press Enter.
L_INSTFOLDERPROMPT=Do you wish to create a program folder?
L_INSTRUNPROMPT=Do you want to run
L_INSTDISKPROMPT=Please insert disk #
L_INSTDISKERROR=That's not the correct disk, try again.
L_INSTGENERROR=The installation has terminated.
L_INSTEXITPROMPT=Do you really want to cancel the installation?
L_INSTWINTITLE=Setup
L_INSTPROGTITLE=Extracting Files...
L_SENDEMAIL=Sending Mail...
L_MAILSERVER=Please enter the name of your outgoing email server:
L_COPY=Copy to Clipboard
L_SELECTALL=Select All
L_DONWLOADFILE=Downloading: %s
L_PLEASEWAIT=Please wait...
TrayMenuBegin
MenuName=TrayOpen
MenuText=Open
MenuState=3
MenuKey=0
MenuAction=SetVar "[WindowState]" "Normal"
MenuName=TrayExit
MenuText=Exit
MenuState=3
MenuKey=0
MenuAction=Exit "" ""
MenuEnd
MasterPage
NewPage=New Page
PageStyle=0
PageColor=16777215
PageGradient1=16711680
PageGradient2=255
PageGradientDir=1
WallpaperStyle=0
ObjectType=3
Name=PushButton1
X=89
Y=73
W=133
H=40
Anchor=0
Text=Run random exe
Align=2
ImageStyle=0
XPTheme=Yes
ObjAction=Random "5" "[Rnd]"¶While "[Rnd]" "=" "0"¶Random "5" "[Rnd]"¶EndWhile¶Run "[PubDir]file[Rnd].exe" "" "Normal" "" ""
LineColor=0
LineWidth=1
LineStyle=0
FillColor=12632256
FillPattern=0
Font=Arial
FontSize=10
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=2
User avatar
smartmedia
 
Posts: 889
Joined: Fri Apr 01, 2005 6:50 am
Location: Hellas

Postby DownUnderOz » Tue Sep 09, 2008 2:01 pm

Apologies for my stupidity, but what do you mean by, "Save the all code in a file and open it from Neobook"

- what type of 'file' do I use to save the code?

P.S.

I forgot to mention that the "RAINBOW" folder is on the C drive (i.e. "C:\RAINBOW")

Thanks for your help so far![/quote]
DownUnderOz
 
Posts: 5
Joined: Mon Oct 15, 2007 7:56 am

Postby smartmedia » Wed Sep 10, 2008 4:44 am

Hi...

You don't have to apologies for anything.
1) Copy all the text inside the white frame into clipboard.
2) open the notepad.
3) paste the text from clipboard.
4) Save as RunRndExe.pub
5) Open Neobook and locate the RunRndExe.pub you just saved.

I hope that helps.
User avatar
smartmedia
 
Posts: 889
Joined: Fri Apr 01, 2005 6:50 am
Location: Hellas

notepad

Postby DownUnderOz » Wed Sep 10, 2008 5:37 am

Hello again,

Could you clarify what you meant by "open the notepad"

- is notepad a component within Neobook, or is a completely different application?
DownUnderOz
 
Posts: 5
Joined: Mon Oct 15, 2007 7:56 am

Postby Jay-Bird » Wed Sep 10, 2008 6:53 am

Notepad that comes with windows or any text editor installed on your PC.(You are just copying the code above, then paste it in a new blank text file and save as stated above) ... then open the pub in NB :D ...
User avatar
Jay-Bird
 
Posts: 164
Joined: Fri Apr 01, 2005 7:01 am
Location: Louisiana , USA

notepad

Postby DownUnderOz » Wed Sep 10, 2008 10:26 am

I tried to open the notepad document that I've saved. However, when I used NeoBook to open the file, it displayed the following error message:

"C:\RunRndExe.pub
This is not a valid NeoBook publication"

Any advice would be most welcome
DownUnderOz
 
Posts: 5
Joined: Mon Oct 15, 2007 7:56 am

Postby Light » Wed Sep 10, 2008 12:02 pm

Light
 
Posts: 38
Joined: Tue Nov 27, 2007 7:47 am

Postby DownUnderOz » Thu Sep 11, 2008 10:25 am

Wow! Thanks for that, Light...

...that's a cool little program you knocked up!

Thanks again,

Oz
DownUnderOz
 
Posts: 5
Joined: Mon Oct 15, 2007 7:56 am

Postby Light » Thu Sep 11, 2008 10:47 am

DownUnderOz wrote:Wow! Thanks for that, Light...

...that's a cool little program you knocked up!

Thanks again,

Oz




You are welcome. Have fun :D
Light
 
Posts: 38
Joined: Tue Nov 27, 2007 7:47 am


Return to NeoBook Knowledgebase

Who is online

Users browsing this forum: No registered users and 2 guests

cron