Sign in to follow this  
Followers 0
StungStang

Command Line issue

13 posts in this topic

Hi to all, im writing my own player...now i want to add the cmd line support...

I want simply have a command line support for playing and stop a streaming file.

Now i've this code :

#include <Bass.au3>
#include <BassConstants.au3>

_BASS_Startup(@ScriptDir & '\bass.dll')
_BASS_Init(0, -1, 44100, 0)
Dim $MusicHandle = ""
If @error Then
    MsgBox(0, "Error", "Could not initialize audio")
    Exit
EndIf
    Switch $CmdLine[1]
        Case "/open"
            If $CmdLine[2] <> "" Then
                $MusicHandle = _BASS_StreamCreateURL($CmdLine[2], 1, $BASS_STREAM_AUTOFREE)
                _BASS_ChannelPlay($MusicHandle, 1)
            EndIf
        Case "/stop"
            _BASS_ChannelStop($MusicHandle)
        Case "/exit"
            _BASS_StreamFree($MusicHandle)
            _Bass_Free()
            Exit
    EndSwitch

I want this syntax, for example :

/open streaming link

Example!!:

myprogramm.exe /open "http://stream.transmissionfm.com:8000/breaks-high.mp3"

I try with that but it dont work...i listen the sound for only a second...

The stop command and exit wont work...

How i can do that?...Hi!

Share this post


Link to post
Share on other sites



Hi,

look at Command Line Parameters under 'Using Autoit' in the helpfile. You could use hotkeys for the starting and stopping, perhaps?

William

Share this post


Link to post
Share on other sites

If you need those commands via commandline, you will have to do it this way:

- /play starts a new process that receives commands via WM_COMMAND

- /stop will send a command to the already running process and then exit.


*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Share this post


Link to post
Share on other sites

Hi,

look at Command Line Parameters under 'Using Autoit' in the helpfile. You could use hotkeys for the starting and stopping, perhaps?

William

I see the help file, but this function is not too much clear :)...i want just simple add comand line to my programm...why i have to use the hotkeys? O.o

Anyone have an example or what else?

hi :)

Share this post


Link to post
Share on other sites

Using the command line will allow you to call your program from a DOS command line, or from within another program. I presume you want to run it something like this:

YourProgram.exe yourMusicFile.mp3 to play the mp3 without necessarily launching your GUI?

You'd need the hotkeys to pause/stop etc - unless to do as ProgAndy suggests.

However, I have a feeling we're talking at cross purposes here. Could you spell out in the simplest terms what you actually want to do?

William

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

It's very simple, i want call my programm via DOS command line, without using gui.

I want do something like that:

MyProgram.exe /play streaminglink.mp3

Can i dont use hotkey?...I would stop the program just simply with "/stop" command. Like that:

Myprogram.exe /stop

I think is not too much difficult, if i know ho to do that :)

Hi , thanks for your help!

Edited by StungStang

Share this post


Link to post
Share on other sites

I think is not too much difficult, if I know how to do that

No, nothing is difficult when you know how to do it. Getting there is the hard part!

I think the first bit would be done as per my previous post, but the command line parameter is, I believe, only read at start-up. So no way to send a second command to the already-running script [though I'm prepared to be proven wrong by someone better-versed in this than I]. That was why I suggested hotkey. You could perhaps get the sending program/dos command line to send the hotkey, which would be intercepted by the music program and actioned.

I suppose that if you had a hidden/dummy GUI you could send commands to that - in which case it may indeed be possible without actually creating the GUI?

William

Share this post


Link to post
Share on other sites

It seems to be not possible to get a second command to an already-running script. Sincerly i dont know how to solve that. I hope that a command-line guru see this topic :). Of course any help is accepted :)

Hi.

Sorry for my bad english =P

Share this post


Link to post
Share on other sites

Up :)

Share this post


Link to post
Share on other sites

StungStang,

There are many ways to pass commands to already running scripts - search for "Inter Script Communication". To get you started MrCreatoR has posted a good version in the Examples section a few days ago - Yashied and trancexx have also posted on the subject. :)

ProgAndy's suggestion of a "command" script which then "starts"/"passes info to" the player script would seem to be the way to go here. It should be an interesting project - I look forward to seeing your implementation. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

I searched on forum...i see the MrCreatoR but sincerly i don't have understand nothing :/...

It's seems to be more complicated than I thought.

All this work just for 2 command to pass =P

Thanks a lot for your help =)

Share this post


Link to post
Share on other sites

StungStang,

All this work just for 2 command to pass

You want to use the command line which for most Windows based apps is read at start only. So, yes, you do need to do a fair amount of work to get it to happen. :)

But why on earth do you want command line support for a Windows app anyway? :)

Why not use HotKeys as was suggested before - or add a menu or click events to the tray icon? It makes life much easier. :P

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

StungStang,

You want to use the command line which for most Windows based apps is read at start only. So, yes, you do need to do a fair amount of work to get it to happen. :)

But why on earth do you want command line support for a Windows app anyway? :)

Why not use HotKeys as was suggested before - or add a menu or click events to the tray icon? It makes life much easier. :D

M23

Why?...I want to share my bass.dll based engine on other programm :P...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0