Qbasicnews.com
May 31, 2020, 08:33:18 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Chaining to another program.  (Read 1717 times)
Dex4now
Member
*
Posts: 75


WWW
« on: March 01, 2003, 12:56:26 PM »

Hi all, quite awhile back, before some cracker messed with the forum, I posted a question where I asked if there was some way to use QuickBASIC 4.5 to control another program.  There were suggestions of SHELL and CHAIN, with caveats that they probably wouldn't do what I wanted very well, and that was correct, they didn't!   Sad

However, not being one to give up, I've still been playing around with this, and came up with this solution.  Not exactly elegant, but it works.  The following code is a very simplified version of what I actually have, in order to post it in this forum.



Code:

Setup:
  COLOR 7
  CHDIR "C:\"
  file$ = "INTRFACE.BAT"
  mpx$ = "MPXPLAY.EXE -fl -v -bl "
  CLS
  LOCATE 4, 4 : PRINT "Select by number . . ."
  LOCATE 6, 4 : PRINT "1. Maaya Sakamoto - Light of Love"
  LOCATE 8, 4 : PRINT "2. Maaya Sakamoto - 24"
  LOCATE 10, 4 : PRINT "3. Exit program."
  g$ = INPUT$(1)
  IF g$ = "1" THEN mp3$ = mpx$ + "C:\MP3\Litelove.mp3"
  IF g$ = "2" THEN mp3$ = mpx$ + "C:\MP3\24.mp3"
  IF g$ = "3" THEN GOTO Finish
  CLS
  CHDIR "C:\TEMP"
  OPEN file$ FOR OUTPUT AS #1
      PRINT #1, "@echo off"
      PRINT #1, "C:"
      PRINT #1, "CD\"
      PRINT #1, "CLS"
      PRINT #1, mp3$
      PRINT #1, "MP3PLAY.EXE"
  CLOSE
  SHELL "BAT2EXE INTRFACE.BAT>NUL"
  KILL "C:\TEMP\INTRFACE.BAT"
  CHAIN "C:\TEMP\INTRFACE.COM"

Finish:
  CHDIR "C:\"
  KILL "C:\TEMP\INTRFACE.COM"
  CLS
  END
 


This assumes that you have a C:\TEMP directory and the program BAT2EXE.COM in your path somewhere, preferably C:\DOS.  This is a little freeware program that converts batch files to .COM files.

Also, this basic program MUST be run compiled only. (With the program in the root directory.)

Let me know what you think.    Smiley

Dex

EDIT:  BTW - If anyone wants to mess with these, they can be downloaded here:
http://members.aol.com/dex4now2/files/mp3play.bas
http://members.aol.com/dex4now2/files/mp3play.exe
Logged
NovaProgramming
Been there, done that
*****
Posts: 1025



« Reply #1 on: March 07, 2003, 07:50:19 PM »

Can't help ya there, but it looks to me like you're trying to run MP3 files from the looks of things, not transforming BATCH into .COM files... er, But I have NO IDEA how to help you so I am just rambling on heheh
Logged

ovaProgramming.

One night I had a dream where I was breaking balls.  The next morning, BALLSBREAKER was born.

Quote from: "Haye, Phillip J."
 Excellent.  Now you can have things without paying for them.

BALLSBREAKER 2
~-_-Status Report-_-~
Engine: 94%
Graphics: 95%
Sound: 100%
A Severe Error has crippled BB2 for the time being... I have to figure it out, but until then you won't see much of it Sad.
-----------------------------
Dex4now
Member
*
Posts: 75


WWW
« Reply #2 on: March 07, 2003, 08:12:19 PM »

Hi Nova; thanks for replying.  I don't actually need "help" per se., the above code works perfectly.  I just respect the opinions of others in this forum and wondered what others thought of this somewhat "solution" to a problem.

I don't like this solution, however, because it requires writing a "file" that must be deleted.  It just doesn't seem . . . elegant!

 Smiley    Dex
Logged
Plasma
Na_th_an
*****
Posts: 1770


WWW
« Reply #3 on: March 07, 2003, 10:11:25 PM »

If this is for your car MP3 player, just write the file to a RAM disk; that's what I did. (I used a method similar to yours, but a little simpler)

I finally finished mine, btw...just waiting for my new head unit so I can install it in my car. Pics should be up soon, and I can send you the source code if you'd like.
Logged
Dex4now
Member
*
Posts: 75


WWW
« Reply #4 on: March 07, 2003, 11:13:12 PM »

Plasma . . . I'm all ears....LOL

Feel free to "enlighten" me!

My whole system exists "virtually" in my lab, till I get this whole 12 volt thang worked out!

Dex
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!