Login | |
|
 |
Custom Msgbox - 5/12/2005 2:55:32 PM
|
|
 |
|
| |
ttleser
Posts: 3
Score: 0
Joined: 5/12/2005
From:
Status: offline
|
First off, I want to say that my knowledge of VBscript is extremely novice boardering on stupid. ;) I own a gaming center (with 20 PCs) and I have a cafe software that requires my customer to sign into. When they want to play a certain game, they locate it in the menu selection and launch it. The game, in the background, copies user files from a file server and then launch the game (using batch files I wrote). There are a couple of games that I have that require you to signin, they are MMORPGs (Massively Mutliplayer Online Role Playing Game). The customer will need to have their own account to be able to play these games, except one game which I have 3 in-store account available for usage. What happens is when the customer wants to play the game, they select it from the menu select, but I've got a little VBScript that displays a message telling them that this is a "MMORPG and requires them to have an account". If they click "yes" and get to the game's signin screen, they call me over and I sign in with one of my 3 accounts for them to play with. Ok, enough of the background info. I'd like to have another display window that would come up that would ask them which account they are using, ie... Account1, Account2, Account3 or personal account. After they click one of those 4 buttons, the game will launch just like it does now and I'd still have to sign into the game with one of the 3 accounts. I'd also like the script to export the selection they/me made to a text file, and preferibly upload it to a ftp/web server. I'd like to have my flash web page to be able to display with of my accounts are in use (which I can do, I think) . The export would need to allow for 3 instances of the game being run (not all at the same pc) so that any previous export isn't overwritten. Breath... Ok, so what I need to know is: 1. How to create a custom msgbox window with my own buttons (other than the standard yes/no, ok/cancel, etc...) 2. How to export that selection to a text file (either on a local server or on the Internet. 3. If the export can't save directly to the web, how to ftp upload the exported text file to a ftp/web server. Thanks a load. ;)
|
|
| |
|
|
|
 |
Re: Custom Msgbox - 5/13/2005 6:51:50 AM
|
|
 |
|
| |
ttleser
Posts: 3
Score: 0
Joined: 5/12/2005
From:
Status: offline
|
OK, I searched a little on the web and found that the code needs to be in HTML format as well as have the <html> tags in it. OK, I tested it again and this time it created an HTA file and when I ran that it gave me a big IE window with the 4 options in it. I guess I've got a few more questions. 1. Once the .HTA file was run, it got deleted. I'd need it to not be deleted once it's run. I'd need to have it run anytime a customer wants to play that game. 2. Can I have the window sized to something smaller? You mentioned using CSS file, unfortuately I don't have any experience with Cascading Style Sheets either, would CSS allow me to have the window sized appropriately? 3. Can this method allow for uploading to a site, or do I just have the script put on a website and have my cafe software use the script on the site? 4. I also noticed that the selection.txt file is over written with each new selection made. Any way to have a different selection file created depending on which choice is made? For example, customer chooses Account1 then account1.txt file would be created. This way if Account2 is chosen on other PC at the same time, the other text file wouldn't get deleted. 5. I noticed in the code: objMyHTA.WriteLine "<td><input type=radio name=Acc value=Acc1>Account 1</input></td>" That it outputs the text "Acc1", is there a way to change it to include a space? For example, change "Acc1" to "In Use". I can change it to "In Use", but it'll only show "In". ok, yet one more update to this post. I noticed in your post that you said once the html file is run, it should run the HTA file. So I re-ran it again and noticed in the lower right corner of the IE window that it says it's done with errors, when I do a details on it, it says: Line: 65 Char: 1 Error: The system cannot find the file specified. Code: 0 URL: file://c:\documents and settings\administrator\Desktop\test.html Looking at line 65, it's: objShell.Run strDesktopPath & "\MySelectionScreen.hta" Not sure what's causing the error in this line. Here's the full code I used: <html> <script language=vbscript type=text/vbscript> <!-- Option Explicit Dim objFso Dim objShell Dim strDesktopPath Dim objMyHTA Set objFso = CreateObject("Scripting.FileSystemObject") Set objShell = CreateObject("WScript.Shell") strDesktopPath = objShell.SpecialFolders("Desktop") Set objMyHTA = objFso.CreateTextFile(strDesktopPath & "\MySelectionScreen.hta") objMyHTA.WriteLine "<html>" objMyHTA.WriteLine "<hta:application>" objMyHTA.WriteLine "<head>" objMyHTA.WriteLine "<script language=VbScript>" objMyHTA.WriteLine "Function fnCheckSelection()" objMyHTA.WriteLine " For i = 0 To document.all.Acc.length -1" objMyHTA.WriteLine " If document.all.Acc(i).checked=True Then" objMyHTA.WriteLine " fnWriteSelection(document.all.Acc(i).value)" objMyHTA.WriteLine " End If" objMyHTA.WriteLine " Next" objMyHTA.WriteLine "End Function" objMyHTA.WriteLine "Function fnWriteSelection(val)" objMyHTA.WriteLine " Set objFso = CreateObject(" & Chr(34) & _ "Scripting.FileSystemObject" & Chr(34) & ")" objMyHTA.WriteLine " Set objMyOutput = objFso.CreateTextFile(" & Chr(34) & _ strDesktopPath & "\Selection.txt" & Chr(34) & ")" objMyHTA.WriteLine " objMyOutput.WriteLine val" objMyHTA.WriteLine " objMyOutput.Close" objMyHTA.WriteLine " objFso.DeleteFile(" & Chr(34) & strDesktopPath & _ "\MySelectionScreen.hta" & Chr(34) & ")" objMyHTA.WriteLine " Window.Close" objMyHTA.WriteLine " Set objMyOutput = Nothing" objMyHTA.WriteLine " Set objFso = Nothing" objMyHTA.WriteLine "End Function" objMyHTA.WriteLine "</script>" objMyHTA.WriteLine "</head>" objMyHTA.WriteLine "<body>" objMyHTA.WriteLine "<table>" objMyHTA.WriteLine "<tr>" objMyHTA.WriteLine "<td><input type=radio name=Acc value=Account1>Account 1</input></td>" objMyHTA.WriteLine "</tr>" objMyHTA.WriteLine "<tr>" objMyHTA.WriteLine "<td><input type=radio name=Acc value=Account2>Account 2</input></td>" objMyHTA.WriteLine "</tr>" objMyHTA.WriteLine "<tr>" objMyHTA.WriteLine "<td><input type=radio name=Acc value=Account3>Account 3</input></td>" objMyHTA.WriteLine "</tr>" objMyHTA.WriteLine "<tr>" objMyHTA.WriteLine "<td><input type=radio name=Acc value=Personal>Personal</input></td>" objMyHTA.WriteLine "</tr>" objMyHTA.WriteLine "<tr>" objMyHTA.WriteLine "<td><input type=button value=OK OnClick=fnCheckSelection()></td>" objMyHTA.WriteLine "</tr>" objMyHTA.WriteLine "</table>" objMyHTA.WriteLine "</body>" objMyHTA.WriteLine "</html>" objMyHTA.close objShell.Run strDesktopPath & "\MySelectionScreen.hta" Set objMyHTA = Nothing Set objShell = Nothing Set objFso = Nothing '--> </script> </body> </html>
|
|
| |
|
|
|
 |
Re: Custom Msgbox - 5/17/2005 2:32:09 AM
|
|
 |
|
| |
kirrilian
Posts: 628
Score: 3
Joined: 3/15/2005
From:
Status: offline
|
quote: Originally posted by ttleser Thanks to all for the input so far. ;) > kirrilian I'd like to avoid input boxes if possible, make it as **** proof as possible as well as I'd prefer my customers don't know the name of my accounts, the labels I'd use on the buttons would be more... generic. I tried it anyways and I get an error on line 11, character 2. It's the Set fso = CreateObject("Scripting.FileSystemObject") line I think .;)
you have to change the output variable to a valid path.
|
|
| |
|
|
|
| |
|
|
 |
|
 |
|
|