StungStang Posted April 3, 2011 Share Posted April 3, 2011 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! Link to comment Share on other sites More sharing options...
saywell Posted April 4, 2011 Share Posted April 4, 2011 Hi, look at Command Line Parameters under 'Using Autoit' in the helpfile. You could use hotkeys for the starting and stopping, perhaps? William Link to comment Share on other sites More sharing options...
ProgAndy Posted April 4, 2011 Share Posted April 4, 2011 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 Link to comment Share on other sites More sharing options...
StungStang Posted April 4, 2011 Author Share Posted April 4, 2011 Hi,look at Command Line Parameters under 'Using Autoit' in the helpfile. You could use hotkeys for the starting and stopping, perhaps?WilliamI 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.oAnyone have an example or what else?hi Link to comment Share on other sites More sharing options...
saywell Posted April 4, 2011 Share Posted April 4, 2011 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 Link to comment Share on other sites More sharing options...
StungStang Posted April 4, 2011 Author Share Posted April 4, 2011 (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 April 4, 2011 by StungStang Link to comment Share on other sites More sharing options...
saywell Posted April 4, 2011 Share Posted April 4, 2011 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 Link to comment Share on other sites More sharing options...
StungStang Posted April 4, 2011 Author Share Posted April 4, 2011 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 Link to comment Share on other sites More sharing options...
StungStang Posted April 5, 2011 Author Share Posted April 5, 2011 Up Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 5, 2011 Moderators Share Posted April 5, 2011 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 Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
StungStang Posted April 5, 2011 Author Share Posted April 5, 2011 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 =) Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 5, 2011 Moderators Share Posted April 5, 2011 StungStang,All this work just for 2 command to passYou 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. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
StungStang Posted April 5, 2011 Author Share Posted April 5, 2011 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. M23Why?...I want to share my bass.dll based engine on other programm ... Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now