Command-line type itunes control - questions

Hello,
I'm writing a little tool with Applescript to control iTunes via command-line type interface. I have few general questions, thanks in advance for any answers. First I'll explain my idea, questions at the end. (If wrong forum, please tell me where to go)
The goal: to control music with as less hassle as possible. I listen music all day, have dozens of gigabites of it, and find mouse/iTunes interface too troublesome. Moodkiller whilst reading a book, for example.
Tool is pop-up dialog, with a single text field. Write something and hit enter -> search phrase or command interpreted and sent to iTunes as Applescript -> iTunes acts, and a new dialog pops up, ready for next command. (Enter with no text quits app)
Examples:
"oasis wonderwall"
Searches iTunes library and finds Wonderwall of Oasis. Displays a pop-up list of search matches, in this case just one song. Hit enter -> iTunes plays it. (If more results, I get to choose song from list.)
I find this quicker than to activate iTunes search box with mouse, enter search string, activate results pane with several TAB:s etc...
"trip-hop"
Searches an iTunes library, finding over two hundred "trip-hop" genre songs. This time just plays random song among results (thumb rule: if number of results > 100, behave that way, otherwise as above). Library continues playing from that point. Usually means you get to hear a lot of trip-hop. (could also make new trip-hop playlist)
">"
Command: skip to next song. ">>>" skips 3 songs at once, ">>>>" four songs etc
"<"+" increases three notches, "++" four etc.
Decrease volume, again "---" three notches etc.
"play", "pause", "stop"
Basic player commands, you name it.
"oasis wonderw >"
Searches song and adds it to end of current playlist (if more than one result, choose from list).
Other ideas too, but you propably got the point.
My questions:
1) Any applications currently doing this kind of job? With iTunes or other music players? (You can use Quicksilver for iTunes song searching, but I'm not certain if that's very handy or fast)
2) Would you use this kind of tool, if it were good? (just a theoretical question) If yes, how would you like to control it?
3) I have used Applescript's basic "display dialog" and "choose from list" commands, but would love more customized pop-ups (fancier song lists etc). Pointers to good scripting additions to accomplish this? Currently the entire tool is made with Applescript.
If this raises interest, I could post the tool somewhere. It's still very early draft, anyway.
Cheers,
O
Helsinki

Hi CofeeBreak,
Thank you for your comment, but I was able to find the problem (didn't solve it yet): In the FM command line interface, calling a HEX file located in a folder with brackets in its name, such as "C:\hello_World(V1)\LabVIEW.hex" will not be recognized by the FM.exe, whereas "C:\hello_World_V1\LabVIEW.hex" will work just fine. In the Flash Magic GUI and Command Line Manual section on hex files there is no mention of that, my solution at the moment is to remove the brackets from folder names.
Thanks
Amir

Similar Messages

  • Command line control Profile Manager 2

    Greeting All,
    Any guide that introduce command line that can control Profile Manager 2 to make device camera on/off? Do know is this possible via command line?
    Here is the sernario.
    1. User scan a QR code that trigger App to commnuicate Profile Manager turn off camera.
    2. App to login Profile Manager in background and turn off camera in profile.
    3. Profile Manager push profile to trun off device camera.
    4. App logout Profile Manager in background.
    Any advise is welcome.
    Thanks,
    Spin

    The CommandLine tool is also shipped with JCAPS and which is very useful to tool.
    We can do deploy, redeploy and undeploy with this tool. and the respective docs are available as said in the above location.

  • Entering special characters at the command line.

    I'm writing a simple program in java that automates certain processes in learning a foreign language.
    This includes holding a database of vocabulary within the context of a sentence and testing a student on words they have encountered.
    Nothing too tricky, except that I am having trouble with entering special characters at the command line. I'm not really surprised by this and was hoping that someone could help me.
    I'm using a mixture of Solaris 8 and Mac OS X 10.3 for running the software, so anyone with any input on either of these systems will be able to help.
    The characters I am trying to enter are the following:
    �,�,�,�,�,�,�,�,�,�,�,�.
    They are latin, and used in Spanish amongst other languages.
    I'm a little confused by the implementation of character sets. I can enter these characters in applications such as word or textedit or an email, but just not at an X window.
    From looking at the web it appears that these characters can be input using the
    Latin1 (ISO 8859-1) character set or the ISO 10646-1/Unicode extension.
    I'm just not sure what I actually have to do to get it to work.
    If anyone can offer any help I'd be really grateful.
    Ian Stanton

    It's a problem that could be encountered in different circumstances, in this circumstance it is with a program I am writing in java.
    I anticipate that these days not that many applications are delivered that require use of the command line, but since I am still learning Java it is necessary to explore this avenue.
    It's interesting actually since presumably developers writing code for the international market need to accomodate characters similar to those I am attempting to enter, and more that are less familiar to me such as far and middle eastern scripts, and of course many others.
    We (possibly) assume that since a character is printed on our keyboard it is a simple matter to read it in. But what if I was a Spanish student wanting to type a character into the command line and that character wasn't there? I believe that Spanish (and variants of that language) is the third most spoken language on the planet.
    These characters are often relatively easy to enter in office and internet applications amongst others but apparetly not so at the command line.
    Maybe this question is more suitably asked of the Unix community but I thought it a good idea to try Java since i was writing Java code and that many Java programmers could have encountered the same problem.

  • Hana db filesystem directory structure and process command line

    Hi experts,
    Could someone provide please actual directory structure of Hana db filesystem?
    Generally speaking, I need to model some Hana db(of 1.0, 1.5 versions) entities. Among them:
    Schemas
    Data files
    Log files
    Important configuration files
    Database parameters(guess found in config files and command line)
    Database version
    The question is where i can find such information having access to filesystem?
    One another question is how common Hana db commandline looks like?
    Does it have one process or several?
    It would be perfect if someone give some ps -aef command result grepped with relevant Hana Db processes
    Thanks,
    Eugene
    Edited by: Eugene Kondrashev on Dec 28, 2011 12:51 PM

    Eugene Kondrashev wrote:
    > * What are the processes relevant to Hana Db?
    This is still changing pretty much ...
    Anyhow, just check the running services in HANA studio (landscape tab) and you have all the process at hand.
    > * What is the signature of starting command?
    What is that supposed to mean?
    > * How can I identify running Hana Db instance on a host having shell access?
    How about the HDB command?
    SUSE Linux Enterprise Server 11 (x86_64)
    /usr/sap/HAN/HDB00> HDB help
    Usage: /usr/sap/HAN/HDB00/HDB { start|stop|reconf|restart|version|info|proc|admin|kill|kill-<sig>|term }
      kill or kill-9 should never be used in productive environment!
    /usr/sap/HAN/HDB00> HDB info
    USER       PID  PPID %CPU    VSZ   RSS COMMAND
    hanadm   14682 14677  0.0  85580  2180 sshd: hanadm@pts/0
    hanadm   14683 14682  3.3  16768  2980  \_ -bash
    hanadm   14756 14683 18.1  13652  1680      \_ /bin/sh /usr/sap/HAN/HDB00/HDB info
    hanadm   14782 14756  0.0   6620   892          \_ ps fx -U hanadm -o user,pid,ppid,pcpu,vsz,rss,args
    hanadm   31638     1  0.0  42624  1820 sapstart pf=/usr/sap/HAN/SYS/profile/HAN_HDB00_vml3012
    hanadm   31645 31638  0.0 528216 151400  \_ /usr/sap/HAN/HDB00/vml3012/trace/HDB.sapHAN_HDB00 -d -nw -f /usr/sap/HAN/HDB00/vml3012/daemon.ini pf=/usr/sap/HAN/SYS/profi
    hanadm   31665 31645  0.5 5001972 1002844      \_ hdbnameserver
    hanadm   31723 31645  0.0 4367024 244336      \_ hdbpreprocessor
    hanadm   31744 31645  1.9 5664496 1779448      \_ hdbindexserver
    hanadm   31752 31645  3.6 7197924 3359440      \_ hdbstatisticsserver
    hanadm   31759 31645  0.6 5289164 1507684      \_ hdbxsengine
    hanadm   32017 31645  0.0 429188 124344      \_ sapwebdisp_hdb pf=/usr/sap/HAN/HDB00/vml3012/wdisp/sapwebdisp.pfl -f /usr/sap/HAN/HDB00/vml3012/trace/dev_webdisp
    hanadm   31527     1  0.0 292676 110380 /usr/sap/HAN/HDB00/exe/sapstartsrv pf=/usr/sap/HAN/SYS/profile/HAN_HDB00_vml3012 -D
    > * Does Hana DB started with SAP start profile? If so, could someone point me to the example of such a profile?
    ?? seriously... take a guess
    regards,
    Lars

  • Adobe DNG Converter - command-line parameters for new 1.4 features

    Adobe DNG Converter - I need to know what the command-line parameters are for the new DNG-1.4 options (e.g. lossy compression).
    Last I checked, there was no updated documentation released - would somebody please help?
    Rob

    By inspecting strings in the exe file using ProcessExplorer (MS SysInternals), I found these command-line switches for controlling lossy compression:
    -lossy
    -size
    -count
    A D O B E
    Adobe: please take a moment and update the command-line documentation - thanks.
    http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/products/photoshop/pdfs/dng_ commandline.pdf
    or, if there is another that is updated - do tell...
    Rob

  • IEAK IE9 msi - Can not find command line to make install process passive with a reboot prompt

    hey all, this seems to be something simple and I can not get it to work the way intended.   I want IE9 installer to install passively and then prompt for reboot, that's it.  
    I have tried using the switches for the standard exe from Microsoft but nothing allows for passive and prompt for reboot
    I have now also downloaded and used IEAK and then created msi installs and selected the passive and prompt for reboot options which does not make the installer do that actual behavior by default.  
    So I have now actually began trying various commands with the IEAK msi files, none of which are making the behavior I desire happen, passive with prompt for reboot.
    Can anyone suggest a proper command line for this?
    I have essentially tried these on the different installers I have built, and sometimes entered the /passive on full installers:
    msiexec.exe filename /promptrestart
    msiexec.exe filename REBOOTPROMPT=""

    Hi,
    I am afraid when using /passive options together, there would be no promote when installing.
    See the instruction for /passive here:
    The installer displays a progress bar to the user that indicates that an installation is in progress but no prompts or error messages are displayed to the user. The user cannot cancel the installation. Use the
    /norestart or /forcerestart standard command-line options to control reboots.
    If no reboot option is specified, the installer restarts the computer whenever necessary
    without displaying any prompt or warning to the user.
    Based on my unserstanding, when using this command option, we can only choose restart or not with the
    /norestart or /forcerestart standard command-line options
    If /passive is in use, then the promote would be expected not to work. So if we would like to force install IE, then we might better schedule the install time or restart out of the work hours.
    Best regards
    Michael Shao
    TechNet Community Support

  • How can I print the test page with the Arabic type from the command line

    Hi,
    I have been trying to make the tool for printing the test page from the command line on the Arabic OS. I used "rundll32 printui dll printuientry" with "/k /n" options. My tool is to print the test page in all OS when pushing the
    button.
    Normally, in the Arabic Windows, the test page is printed with RTL type when printing the test page in the "Devices and Printers". But in my tool, the test page is printed with LTR type. I'm confused because of this result.
    Is it possilbe to print the test page with RTL type when using the "rundll32 printui dll printuientry"? If it is possible, could anyone give me the hint or information for resolving?
    Please check for me.

    Hello,
    Thank you for your post.
    Your issue is out of support range of Test Tools in Visual Studio 2010 and 2012 forum which discusses Visual Studio Test issues.
    I am moving your question to the moderator forum ("Where is the forum for..?"). The owner of the forum will direct you to a right forum.
    Best regards,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Is there a way to pass archive file name to the command-line control?

    Hi there,
    I have been researching the flash media live encoder laterly. But still cannot find confirmed anwsers on the following questions:
    1. Is there a way to pass an archive file name to the command-line control when starting an encoder?
    2. Can the username/password to the Flash Media Server be saved in the profile? If not, is there any otherway to provide(GUI mode) them automatically,
        like as variables to a script?
    Thanks a lot in advance.
    Helen

    1. The only way to inform the command-line encoder about the archive file name is to save the FMLE session profile with the file name. The node for saving the file name is <output><file><path>C:\sample.flv</output></file></path>. The easier way to update the xml profile is to use "Save Profile" option of the GUI mode. If you want to programmatically update the file name, read the profile and update the node before launching the encoder. I hope this answers your question.
    2. No. Credentials can't be saved in the profile. The only way to provide them programmatically is to use /ap and /ab commands for the command-line encoder. For GUI mode, there is no programmable option. But still you can try capturing keystrokes.

  • Types of Command Line Utility Projects in Xcode

    Hello. Question:
    There are five types of projects within the Command Line Utility section in Xcode. One is the Standard Tool project, which I know is written in C. Another is the C++ Tool, which is written in C++. Here's my question -- what language are the other three written in (Foundation Tool, CoreFoundation Tool, and Core Services Too)? If I understand correctly, the Foundation Tool project type uses Objective-C -- I found this interesting, because I thought Ojective-C only worked with Cocoa Apps with GUIs and what not. Wouldn't Objective-C be kind of wasted on a command line app (to some extent at least)? Also, if the Foundation Tool project does use Objective-C, then what language do the CoreFoundation and Core Services project types use?

    I don't think you'll get any errors. Those are just templates. You can use any kind of source code in any project.
    That's what I originally thought, but then I tried using Objective-C code in a Standard Tool project out of curiosity and it didn't work. Also, when you are creating a project, for the description under Standard Tool project, it says something like "creates a Standard Tool project written in C" and similar descriptions with other projects with other languages -- what's the point in having that if you can use any variation of C in any project? Also, what would be the point in having the different standards options (like we were discussing in another thread, \[-std=c99\] and what not) if any code can be used in any project? I mean, surely Objective-C and C++ specific code isn't part of the C89 or C99 standard, right? Just trying to understand how all this works...
    edit: I'm just going back and adding this now. I was re-reading over this post and I was thinking that maybe the answer to my question is that it depends on the file type for the source code -- could that be it? So in other words, you can use any kind of code within any project if you create a file that holds that kind of code, and a certain project template simply creates a project with that type of code file already created (so, in other words, a Standard Tool project written in C, for example, simply creates a template project for you with a .c source code file already added, nothing more -- is that right?). So, then, within a .c file, for example, you can only use C code, and within a .m file only C/Objective-C code, and so forth, right? If I've got the right idea with all that, then I think I understand; if not, then I'm still a bit confused. Sorry, I know this is probably incredibly basic, but I'm trying to learn.
    Thanks for all your answers, by the way, etresoft. Your help is very much appreciated.
    Message was edited by: Tron55555

  • Is there an iTunes.exe command-line switch/syntax reference list?

    Is there an iTunes.exe command-line switch/syntax reference list?
    I would like iTunes to automatically play my music (selectable/programmable) when I click on the iTunes icon.
    Thank you in advance, ACJ

    Hi,
    Thank you for posting in Windows Server Forum.
    The switch /control indicates that you can take the control of the session which you have taken. Generally when we take remote desktop session we will already get the control of that session but in some case where some administrator will not give full access
    or control of remote session to the user. At that if they know this option they can use to control that remote session.
    Use command line parameters with Remote Desktop Connection
    http://windows.microsoft.com/en-in/windows/command-line-parameters-remote-desktop-connection#1TC=windows-7
    Hope it helps!
    Thanks.
    Dharmesh Solanki

  • Audio guys, LAME command line question

    Hey I know this is not the exact forum for this question but I figured you guys could help me better than anyone. I have a G5 running tiger server and a website that is recompressing uploaded MP3 files using LAME via command line. LAME seems to be mangling some of the files by creating distorted filed and 0 byte sized files. I am wondering is there an any other mac program that I can use to reencode mp3 files with the terminal and command line? LAME is said to be great but the files that are already at the frequency that I want (44.1) are converted ok but everything else is just mangled... any suggestions. Thanks!

    I guess I'm looking for either:
    a suggestion on why LAME might be messing up files, maybe someone wlse who had similar issues with LAME and found a fix
    or
    another mac program like LAME that I can run via command line through PHP to convert files.
    I'll play with automator and see if the itunes option might work.
    Thanks!

  • How to change a setting in the Java Control Panel with command line

    Hi,
    I am trying to figure out how to change a setting in the Java Control Panel with command line or with a script. I want to enable "Use SSL 2.0 compatible ClientHello format"
    I can't seem to find any documentation on how to change settings in the Java Control Panel via the command line
    Edited by: 897133 on Nov 14, 2011 7:15 AM

    OK figured it out. This is for the next person seeking the same solution.
    When you click on the Java Control Panel (found in the Control panel) in any version of Windows, it first looks for a System Wide Java Configuration (found here: C:\Windows\Sun\Java\Deployment). At this point you must be wondering why you don't have this folder (C:\Windows\Sun\Java\Deployment) or why its empty. Well, for an enterprise environment, you have to create it and place something in it - it doesn't exist by default. So you'll need a script (I used Autoit) to create the directory structure and place the the two files into it. The two files are "deployment.properties" and "deployment.config".
    Example: When you click on the Java Control Panel it first checks to see if this directory exists (C:\Windows\Sun\Java\Deployment) and then checks if there is a "deployment.config". If there is one it opens it and reads it. If it doesn't exist, Java creates user settings found here C:\Users\USERNAME\AppData\LocalLow\Sun\Java\Deployment on Windows 7.
    __deployment.config__
    It should look like this inside:
    *#deployment.config*
    *#Mon Nov 14 13:06:38 AST 2011*
    *# The First line below specifies if this config is mandatory which is simple enough*
    *# The second line just tells Java where to the properties of your Java Configuration*
    *# NOTE: These java settings will be applied to each user file and will overwrite existing ones*
    deployment.system.config.mandatory=True
    deployment.system.config=file\:C\:/WINDOWS/Sun/Java/Deployment/deployment.properties
    If you look in C:\Users\USERNAME\AppData\LocalLow\Sun\Java\Deployment on Windows 7 for example you will find "deployment.properties". You can use this as your default example and add your settings to it.
    How?
    Easy. If you want to add *"Use SSL 2.0 compatible ClientHello format"*
    Add this line:
    deployment.security.SSLv2Hello=true
    Maybe you want to disable Java update (which is a big problem for enterprises)
    Add these lines:
    deployment.javaws.autodownload=NEVER
    deployment.javaws.autodownload.locked=
    Below is a basic AutoIt script you could use (It compiles the files into the executable. When you compile the script the two Java files must be in the directory you specify in the FileInstall line, which can be anything you choose. It will also create your directory structure):
    #NoTrayIcon
    #RequireAdmin
    #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
    #AutoIt3Wrapper_UseX64=n
    #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
    Func _JavaConfig()
         $ConfigFile_1 = @TempDir & "\deployment.properties"
         $ConfigFile_2 = @TempDir & "\deployment.config"
         FileInstall ("D:\My Documents\Autoit\Java config\deployment.properties", $ConfigFile_1)
    FileInstall ("D:\My Documents\Autoit\Java config\deployment.config", $ConfigFile_2)
         FileCopy($ConfigFile_1, @WindowsDir & "\Sun\Java\Deployment\", 9)
         FileCopy($ConfigFile_2, @WindowsDir & "\Sun\Java\Deployment\", 9)
         Sleep(10000)
         FileDelete(@TempDir & "\deployment.properties")
         FileDelete(@TempDir & "\deployment.config")
    EndFunc
    _JavaConfig()
    Now if you have SCUP and have setup Self Cert for your organization, you just need to create a SCUP update for JRE.
    Edited by: 897133 on Nov 16, 2011 4:53 AM

  • Design Question - Command Line Argument Processor

    Folks,
    I'm a java and OO newbie... I've been going through Sun's java tutorials
    I've "enhanced" Sun's RegexTestHarness.java (using Aaron Renn's gnu.getopt package) to expose the various Pattern.FLAGS on the command line.
    Whilst it does work the arguement processing code is awkward so I want to rewrite it... but I'm pretty new to OO, so before I spend days hacking away at a badly designed ArgsProcessor package I thought I'd run my deign ideas past the guru's... and atleast see if my ideas are impossible, or just plain bad.
    Any comments would be greatly appreciated.
    The starting point is RegexTestHarness.java/**
    *@source  : C:\Java\src\Tutorials\Sun\RegexTestHarness.java
    *@compile : C:\Java\src\Tutorials\Sun>javac -classpath ".;C:\Java\lib\java-getopt-1.0.13.jar" RegexTestHarness.java
    *@run     : C:\Java\src\Tutorials\Sun>java -classpath ".;C:\Java\lib\java-getopt-1.0.13.jar" RegexTestHarness -i
    *@usage   : RegexTestHarness [-vcixmslud]
    //http://java.sun.com/j2se/1.5.0/docs/api/java/io/package-summary.html
    import java.io.InputStream;
    import java.io.InputStreamReader;
    import java.io.BufferedReader;
    //http://java.sun.com/j2se/1.4.2/docs/api/java/util/regex/package-summary.html
    import java.util.regex.Pattern;
    import java.util.regex.Matcher;
    import java.util.regex.PatternSyntaxException;
    //http://www.urbanophile.com/arenn/hacking/getopt/gnu.getopt.Getopt.html
    import gnu.getopt.Getopt;
    import gnu.getopt.LongOpt;
    * private command line options interpreter class
    class Options {
         public boolean verbose = false;
         public int flags = 0;
         public Options(String progname, String[] argv) throws IllegalArgumentException {
              LongOpt[] longopts = new LongOpt[9];
              longopts[0] = new LongOpt("verbose",               LongOpt.NO_ARGUMENT, null, 'v');
              longopts[1] = new LongOpt("CANON_EQ",               LongOpt.NO_ARGUMENT, null, 'c');
              longopts[2] = new LongOpt("CASE_INSENSITIVE",     LongOpt.NO_ARGUMENT, null, 'i');
              longopts[3] = new LongOpt("COMMENTS",               LongOpt.NO_ARGUMENT, null, 'x');
              longopts[4] = new LongOpt("MULTILINE",               LongOpt.NO_ARGUMENT, null, 'm');
              longopts[5] = new LongOpt("DOTALL",                    LongOpt.NO_ARGUMENT, null, 's');
              longopts[6] = new LongOpt("LITERAL",               LongOpt.NO_ARGUMENT, null, 'l');
              longopts[7] = new LongOpt("UNICODE_CASE",          LongOpt.NO_ARGUMENT, null, 'u');
              longopts[8] = new LongOpt("UNIX_LINES",               LongOpt.NO_ARGUMENT, null, 'd');
              Getopt opts = new Getopt(progname, argv, "vcixmslud", longopts);
              opts.setOpterr(false);
              int c;
              //String arg;
              while ( (c=opts.getopt()) != -1 ) {
                   //arg = opts.getOptarg();
                   //(char)(new Integer(sb.toString())).intValue()
                   switch(c) {
                        case 'v': verbose = true; break;
                        //http://java.sun.com/docs/books/tutorial/essential/regex/pattern.html
                        case 'c': this.flags |= Pattern.CANON_EQ; break;
                        case 'i': this.flags |= Pattern.CASE_INSENSITIVE; break;
                        case 'x': this.flags |= Pattern.COMMENTS; break;
                        case 'm': this.flags |= Pattern.MULTILINE; break;
                        case 's': this.flags |= Pattern.DOTALL; break;
                        case 'l': this.flags |= Pattern.LITERAL; break;
                        case 'u': this.flags |= Pattern.UNICODE_CASE; break;
                        case 'd': this.flags |= Pattern.UNIX_LINES; break;
                        case '?': throw new IllegalArgumentException("bad switch '"+(char)opts.getOptopt()+"'"); //nb: getopt() spits
         public String toString() {
              StringBuffer s = new StringBuffer(128);
              if (verbose) s.append("verbose, ");
              if ((this.flags & Pattern.CANON_EQ) != 0)               s.append("CANON_EQ, ");
              if ((this.flags & Pattern.CASE_INSENSITIVE) != 0)     s.append("CASE_INSENSITIVE, ");
              if ((this.flags & Pattern.COMMENTS) != 0)               s.append("COMMENTS, ");
              if ((this.flags & Pattern.MULTILINE) != 0)               s.append("MULTILINE, ");
              if ((this.flags & Pattern.DOTALL)  != 0)               s.append("DOTALL, ");
              if ((this.flags & Pattern.LITERAL) != 0)               s.append("LITERAL, ");
              if ((this.flags & Pattern.UNICODE_CASE) != 0)          s.append("UNICODE_CASE, ");
              if ((this.flags & Pattern.UNIX_LINES) != 0)               s.append("UNIX_LINES, ");
              if (!s.equals("")) {
                   s.insert(0,"{");
                   s.replace(s.length()-2,s.length(),"");
                   s.append("}");
              return(s.toString());
    * public regular expression test harness
    public class RegexTestHarness {
         public static void main(String[] argv){
              BufferedReader in = null;
              try {
                   Options options = new Options("RegexTestHarness", argv);
                   //System.out.println(options);
                   in = new BufferedReader(new InputStreamReader(System.in));
                   System.out.println("RegexTestHarness");
                   System.out.println("----------------");
                   System.out.println();
                   System.out.println("usage: Enter your regex (none to exit), then the string to search.");
                   System.out.println("from:  http://java.sun.com/docs/books/tutorial/essential/regex/index.html");
                   String regex = null;
                   while(true) {
                        try {
                             System.out.println();
                             System.out.print("regex: ");
                             regex = in.readLine();
                             if (regex.equals("")) break;
                             Pattern pattern = Pattern.compile(regex, options.flags);
                             System.out.print("string: ");
                             Matcher matcher = pattern.matcher(in.readLine());
                             if (options.verbose) System.out.printf("groupCount=%d%n", matcher.groupCount());
                             while (matcher.find()) {
                                  System.out.printf("%d-%d:'%s'%n", matcher.start()+1, matcher.end(), matcher.group());
                                  //start is a zero based offset, but one based is more meaningful to the user, Me.
                        } catch (PatternSyntaxException e) {
                             System.out.println("Pattern.compile("+regex+") " + e);
                        } catch (IllegalStateException e) {
                             System.out.println("matcher.group() " + e);
                   } //wend
              } catch (IllegalArgumentException e) {
                   System.out.println(e);
              } catch (Exception e) {
                   e.printStackTrace();
              } finally {
                   try {in.close();} catch(Exception e){}
    }... I haven't got a clue if it's possible, but I want my ArgProcessor.getArgs method to return a hash (keyed on name) of Objects of the requested "mixed" types... for example a boolean, a String, and a String[].
    I want the client code of my new fangled ArgProcessor to look something like this:class testArgProcessor {
         public static void main(String[] args) {
              //usage testArgProcessor [-v] [-o outfile] file ...
              try {
                   HashMap<Arguement> args = ArgProcessor.getArgs( args,
                        { //hasArg value, letter, name, type, value, default
                          {hasArg.NONE,     'v', 'verbose', 'boolean', true, false}
                        , {hasArg.REQUIRED, 'o', 'outfile', 'String', null, null}
                        , {hasArg.ARRAY,     '', 'filelist', 'String[]', null, null}
                   if (args.outfile != null) {
                        out = new BufferedWriter(......);
                   } else {
                        out = System.out;
                   for (String file : filelist) {
                        if (args.verbose) System.out.println("processingFile: " + file)
                        ... process the file ...
              } catch (IllegalArgumentException e) { //from ArgProcessor.getArgs()
                   System.out.println(e);
    }

    Paul,
    What are you trying to do, and why?Sorry I should have made myself a lot clearer...
    What I'm really trying to do is learn Java, and good OO design... so I'm going through the Sun tutorials, and I see that the standard Pattern class has a few handy switches, so I wanted to expose them to the command line... which I did using the handy gnu.getopts library...
    Are you trying to write a general purpose
    command-line processing library?Yes, I'm trying to write a general purpose command-line processing library? one that's "cleaner" to use than the gnu.getopts.
    I've been hacking away for a few hours and haven't gotten very far... what I have discovered is that gnu.getopts class is in fact very clever (surprise surprise)... and my idea to "simplify" it's usage leads to loss of flexibility. So, I'm starting to think I'm completely barking up the wrong tree... and that I was somewhat vanglorious thinking that I (a newbie) could improve upon it.
    Are you trying to write a command-line app to do
    pattern matching?Yep, That too... That's where I started... with an example from Sun's tutorials... where it's used to parse a long series of patterns and strings, exploring java's regex capabilities.
    I think I'll just give up on "improving" on gnu.getopts... my options processing code is ugly, and so be it.
    Thanx for your interest anyway.
    Keith.

  • Question about reading a string or integer at the command line.

    Now I know java doesn't have something like scanf/readln buillt into it, but I was wondering what's the easiest, and what's the most robust way to add this functionality? (This may require two separate answers, sorry).
    The reason I ask is because I've been learning java via self study for the SCJA, and last night was the first time I ever attempted to do this and it was just hellish. I was trying to make a simple guessing game at the command line, I didn't realize there wasn't a command read keyboard input.
    After fighting with the code for an hour trying to figure it out, I finally got it to read the line via a buffered reader and InputStreamReader(System.in), and ran a try block that threw an exception. Then I just used parseInt to get the integer value for the guess.
    Another question: To take command line input, do you have to throw an exception? And is there an easier way to make this work? It seems awfully complicated to take user input without a jframe and calling swing.
    Edited by: JGannon on Nov 1, 2007 2:09 PM

    1. Does scanner still work in JDK1.6?Try it and see. (Hint: the 1.6 documentation for the class says "Since: 1.5")
    If you get behaviour that doesn't fit with what you expect it to do, post your code and a description of our expectations.
    2. Are scanner and console essentially the same thing?No.
    Scanner is a class that provides methods to break up its input into pieces and return them as strings and primitive values. The input can be a variety of things: File InputStream, String etc (see the Scanner constructor documentation). The emphasis is on the scanning methods, not the input source.
    Console, on the other hand, is for working with ... the console. What the "console" is (and whether it is anything) depends on the JVM. It doesn't provide a lot of functionality (although the "masked" password input can't be obtained easily any other way). In terms of your task it will provide a reader associated with the console from which you can create a BufferedReader and proceed as you are at the moment. The emphasis with this class is the particular input source (and output destination), not the scanning.
    http://java.sun.com/javase/6/docs/api/java/util/Scanner.html
    http://java.sun.com/javase/6/docs/api/java/io/Console.html

  • How do I back up the music and apps etc. I restored my computer and I reinstalled iTunes, I was told something about a terminal command line, what does that mean? Please help

    How do I back up the music and apps etc. I restored my computer and I reinstalled iTunes, I was told something about a terminal command line, what does that mean? Please help

    - Transfer iTunes purchases to the computer by:
    iTunes Store: Transferring purchases from your iOS device or iPod to a computer
    - Transfer any other music by using a third-party program like one of those discussed here:
    Copy music
    - Connect the iPod to the computer and make a backup by right clicking on the iPod under Devices in iTunes and select Back Up
    - Restore the iPod from that backup. The restore will also update the iOS.
    Note that the backup that iTunes makes does not include synced media like apps and music
    Are you sure you have a 3G iPod? A 1G iPod can only go to iOS 3.1.3
    See:
    Identifying iPod models

Maybe you are looking for

  • Since updating my software I am unable to access my apps for work specific activities.

    Cannot sign in to work related APPS since updating software .

  • Using Photoshop Elements 4.0 on more than one computer

    I store and edit my photos on my pc. Occasionally, I would like to take some photos with me and edit them on my laptop while I travel. When I come home, how can I transfer the version sets, stacks, etc. with the photos back to my pc? P.S. When I uplo

  • Photos Not Displaying

    Hello, I've just synced my entire iTunes library to my new 160Gb Classic, and then updated the s/w to version 1.0.2. I've never used the Classic on any of the previous versions so I don't know if this phenomenon is new to 1.0.2 or is specific to my i

  • What's best workflow for adding subtitle to existing dvd?

    We have been requested to add a foreign language subtitle to an existing dvd. It was authored in DVDSP so we have the original files. The translators are requesting a QT or dvd with window dub of the timecode for timing. How would I do that if the as

  • Adobe Policy - Stinks!

    I've been a longtime customer of Adobe PhotoShop and then PhotoShop Elements. I run under Windows Vista and have had no problems till recently. I purchased a new Canon 70D camera and find that the Camera RAW codec in PSE 11 did not support this camer