How to write an applescript to hide a user specifid application?

I want to write an applescript to take a command line argument (application name) as input and hide the application, so I tried the following script:
on run argv
          tell application "Finder"
                    set visible of process argv to false
          end tell
end run
However, when I tested it, it kept saying something like (my mac is Chinese...): "Can't convert <script> to Integer tpye." number -1700 from «script» to integer
does anyone know what the error was and how to fix it?
Thank!

The basic construct is a try/end try block which runs your own code when an error occurs rather than stopping your script.
An alternative when using do shell script is to suppress stdout and stderr so that errors are not returned to the application. Which you can do by appending ' > /dev/null 2>&1 &' to the end of the shell command.
Note, though, that your command will not work as written because 'choose folder' will return an alias object which can not be passed to a shell command as-is. Shell commands require unix-style paths for all file/folder parameters. Fortunately, AppleScript makes this easy by providing a POSIX path command which will convert an alias to a unix path. Additionally, since Mac paths can commonly include spaces and other non-shell safe characters, you may want to quote the path, too, like:
<pre class=command>set shell_script to "usr/local/bin/readpst -o " & quoted form of POSIX path of mbox_output & " " & pst_input & " > /dev/null 2>&1 &"</pre>

Similar Messages

  • How to write an applescript and ignore errors

    I'm writing an applescript that uses a shell command that will always return an error. Applescript stops as soon as the error occurs. I want the applescript to continue running. How should I tell Applescript to ignore errors?

    The basic construct is a try/end try block which runs your own code when an error occurs rather than stopping your script.
    An alternative when using do shell script is to suppress stdout and stderr so that errors are not returned to the application. Which you can do by appending ' > /dev/null 2>&1 &' to the end of the shell command.
    Note, though, that your command will not work as written because 'choose folder' will return an alias object which can not be passed to a shell command as-is. Shell commands require unix-style paths for all file/folder parameters. Fortunately, AppleScript makes this easy by providing a POSIX path command which will convert an alias to a unix path. Additionally, since Mac paths can commonly include spaces and other non-shell safe characters, you may want to quote the path, too, like:
    <pre class=command>set shell_script to "usr/local/bin/readpst -o " & quoted form of POSIX path of mbox_output & " " & pst_input & " > /dev/null 2>&1 &"</pre>

  • How to write data to an XML file present under application server

    frnds: can ne one tell me, how to write data in to a file, which is present under a application server
    Ex: i want to write a string data in to a file test.txt which is present under "http://localhost:8080/<some_webapp>/test.txt"
    Note:i have deploted a service<some_webapp> under Tomcat/webapps dir

    Very simple. A servlet can writes to that file if it has the good rights.
    In the servlet get (or post) method, use a code like this:
    import java.io.*;
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) {
    try {
    String filePath = this.getServletContext().getRealPath("/text.txt");//See http://java.sun.com/products/servlet/2.2/javadoc/javax/servlet/ServletContext.html#getRealPath(java.lang.String)
             PrintWriter writer = new PrintWriter (filePath);
            //or BufferedWriter out = new BufferedWriter(new FileWriter(filePath));
            writer .println("aString");
           writer.flush();
            writer .close();
        } catch (Exception e) {
           e.printStackTrace();
    }Hope That Helps

  • How to write the panel bar like this in my application?

    Hi all,
    How to write the code to set up a panel bar just like the url displaying in my application?
    http://www.coalesys.com/products/panelbaraspdotnet/features/pb_ed_screen.asp
    Thanks

    Yes, it is possible, by writing a little bit of custom code.
    Essentially one panel would be a JList with custom rendered items. See the pages that deal with lists and combo boxes in the swing tutorial.
    http://java.sun.com/docs/books/tutorial/uiswing/components/
    To slap in more "panels", put them in a container with CardLayout, and make the buttons switch between the lists.
    I am sure that I saw this "panel bar" listed in the Interface Hall of Shame but it seems that the site has disappeared now. It used to be in http://www.iarchitect.com/shame.htm

  • How to write select query for all the user tables in database

    Can any one tell me how to select the columns from all the user tables in a database
    Here I had 3columns as input...
    1.phone no
    2.memberid
    3.sub no.
    I have to select call time,record,agn from all the tables in a database...all database tables have the same column names but some may have additional columns..
    Eg: select call time, record,agn from ah_t_table where phone no= 6186759765,memberid=j34563298
    Query has to execute not only for this table but for all user tables in the database..all tables will start with ah_t
    I am trying for this query since 30days...
    Help me please....any kind of help is appreciated.....

    Hi,
    user13113704 wrote:
    ... i need to include the symbol (') for the numbers(values) to get selected..
    eg: phone no= '6284056879'To include a single-quote in a string literal, use 2 or them in a row, as shown below.
    Starting in Oracle 10, you can also use Q-notation:
    http://download.oracle.com/docs/cd/E11882_01/server.112/e17118/sql_elements003.htm#i42617
    ...and also can you tell me how to execute the output of this script. What front end are you using? If it's SQL*Plus, then you can SPOOL the query to a file, and then execute that file, like this:
    -- Suppress SQL*Plus features that interfere with raw output
    SET     FEEDBACK     OFF
    SET     PAGESIZE     0
    -- Run preliminary query to generate main query
    SPOOL     c:\my_sql_dir\all_ah_t.sql
    SELECT       'select call time, record, agn from '
    ||       owner
    ||       '.'
    ||       table_name
    ||       ' where phone_no = ''6186759765'' and memberid = j34563298'
    ||       CASE
               WHEN ROW_NUMBER () OVER ( ORDER BY  owner          DESC
                              ,        table_name      DESC
                              ) = 1
               THEN  ';'
               ELSE  ' UNION ALL'
           END     AS txt
    FROM       all_tables
    WHERE       SUBSTR (table_name, 1, 4)     = 'AH_T'
    ORDER BY  owner
    ,       table_name
    SPOOL     OFF
    -- Restore SQL*Plus features that interfere with raw output (if desired)
    SET     FEEDBACK     ON
    SET     PAGESIZE     50
    -- Run main query:
    @c:\my_sql_dir\all_ah_t.sql
    so that i form a temporary view for this script as a table(or store the result in a temp table) and my problem will be solved..Sorry, I don't understand. What is a "temporary view"?

  • How to write if statement for knowing that user is executing in background.

    Hai Experts.
    I am having a report , in that i want two types of output say when i execute in foreground it should say " Hello it is foreground".
    when i execute it in background as a job it should display " Hello it is back ground".
    please tell me how to code this in the report.
    if forground.
    write : hello it is foreground.
    else if it is background.
    write : it is back ground.
    please tell me the code in ABAP

    if sy-batch = space
       write : 'hello it is foreground'.
    elseif sy-batch = 'X'.
       write : 'it is back ground'.
    endif.
    Regards,
    Rich Heilman

  • How to write to an XML file from JDE batch application?

    Hello everyone,
    I need to write data from a batch application to an XML file. I don't know how to use the XML business functions.
    I tried to use XML Publisher but the format is not the same as the client XML. The XML file has some customized format.
    I need to do it manually with business functions and ER. Please help me out.
    Some business functions I saw are Create XML document, XML Add element and XML Add attribute but the parameters are complex to
    use.
    Thank you very much.
    Edited by: Lovvy on Sep 8, 2010 2:58 AM

    The XML DB forum is better suited to your question.
    It also has a FAQ which details how to read and shred XML into tables as well as other common XML based questions...
    XML DB FAQ

  • How to write text file in Shockwave?

    Does anybody know how to write text file in Shockwave to
    user's disk?
    Thanks in advance.

    Those Xtras can wreak to much havoc when used with the wrong
    intent.
    What you can do is write with setpref and store a list of
    saves and the
    saves itself seperatly. Then you'd have to build your own
    save/open
    dialog to let the user:
    * pick a previously saved file to load or overwrite
    * have the user type the name of a new file to save.
    Only thing that remains is that the user cannot decide where
    the files
    are saved.
    Manno
    SiuLinda wrote:
    > Thanks a lot for your reply.
    > Yes, cookies is good but I have to write a program to
    save the text file in
    > where the user wants, user can open these files later if
    they like, like using
    > Filextra and Fileio, but I found all of these xtras seem
    to be not supported in
    > shockwave.
    >
    Manno Bult
    [email protected]

  • How to Write a trigger to hold session data

    Hi Everyone,
    There are 4 Weblogic Servers which are connected to the database concurrently. In the database I have Application Users table "USERS". When a user is logged to the application let us say userA(from "USERS" table) is logged into the application, whenever that same userA logged into the application from other Weblogic server(other system) it should not allow to login into the application. Is it possible to write a trigger for this. If possible, Can any body suggest how to write a trigger to hold that UserA data into one temporary table as long as that userA is active and removes the data from temporary table when userA logged off (OR) as well as that Weblogic server is goes down.
    Thanks in advance.

    Hi Justin,
    First Thank you very much to all of you.
    1. Yes Application Users are authenticated only once,
    that to at the time of login to the Application.
    2. We are not running any script that informing the
    message like "connections
    from the downed server should be reset". Do you
    you think is it suggestable.
    It's not mandatory to use triggers only.Can we
    achieve this by maintaining any temporary table.
    I have one idea is that, Lets create a table name
    e "App_Users_Session_Data(User_Id,Is_Active)"
    If "User A" logins into the application then User_Id
    = 1A and Is_Active = 'T' will be entered
    automatically into the table
    "App_Users_Session_Data". When same "UserA" logins
    from other Weblogic Server then Application first
    check this table and informing that "UserA" already
    logins and is active.
    Whenever "UserA" loggsoff then this entry will be
    automatically deleted.
    My doubt is "UserA" logins successfully into the
    application and corresponding user entry is there in
    "App_Users_Session_Data". If Weblogic Server goes
    down from where this UserA logins, This entry will
    not be deleted. If this entry is still there then the
    same UserA should not login into the application from
    the same Weblogic server(which is up again). My doubt
    is how to remove this entry automatically when
    Weblogic server goes down. Can we achieve this by any
    other way. If possible can u give some guidelines
    thats enough for me.
    Thank you everyone
    SankarHi,
    First off all and as I undeerstood you can change your application.
    1- A table say weblogic_servers have to be created:
    Several scenarios are possibles. If you want you can have a row per weblogic server in this table with what you want as identifier. Any way this table can have a column (sid for example) which identifies the weblogic database session. This can be managed by logon and logoff triggers for the related database user. The logoff trigger for example deletes all lines in App_users_Sessions_Data (see below) related to the same session as the weblogic server and puts the session sid in weblogic_servers to NULL.
    2- Change the table App_Users_Session_Data:
    You have to add a column (sid for example) linking the app user to the database session of the weblogic server. When a user connects, you can check if the databse session is always there and decide accordingly.
    A good idea in my opinion is to centralize your logic by putting it in an INSERT trigger on App_Users_Session_Data.

  • How do I make this script: Hide dock while Gimp is open, automatically?

    Scenario: I need to maximize my 1024x768 screen when I do photo editing, so every time I open Gimp.app, I hide my dock. Since I tend to re-arrange icons on my dock periodically, I generally like to leave it showing. When I quit Gimp.app, I sometimes forget to un-hide the dock and am annoyed later on when I can't easily see the icons.
    Goal: This may seem trivial, but it would be nice to make a small application that does the following:
    1) Either launch Gimp.app, or simply link something to Gimp.app that launches my home-made application concurrently.
    2) Hides the Dock when Gimp.app launches.
    3) Runs in the background, ideally not visibly, and not using more than 4 or 5 MB of RAM or generating any processor load, and observes when I either quit Gimp.app or quit X11.
    4) Shows the dock and terminates itself when I Gimp.app closes.
    If I use this as a launcher, I could give it a Gimp icon and put it in the Dock instead of Gimp. If it is activated by Gimp, the other option I mentioned in #1, the icon would not be significant because hiding mode will be turned on every time my home-made app is open.
    I see several potential solutions but can't iron out the details. I have searched Google and these forums, and found solutions to a few similar problems, but have not been able to adapt those solutions to my needs. If this could be handled better with something other than AppleScript, feel free to point it out. The ideas I have for doing this are:
    1) Write an AppleScript
    2) Set this up in Automator
    3) Save a Unix shell script, or
    4) Write a simple Java application.
    I think using Java would make this unnecessarily complicated, because #1, #2, and #3 can all handle system events quite well, that's not really what Java was meant to do. It may still be an option, though. I have generated a few working parts of the program in #1 and #2, but I the only waiting command I could find waits for the user to click in a dialogue box, not to quit an application.
    I hope this isn't too much of a newbie question, I've done a lot with Macs before, and this ought to be simple but I'm stumped. I've never needed to post on a Mac forum, but you can find me all over the Linux forums, since that isn't my forte! Help will be greatly appreciated.

    Save the code, provided below, as an applications (AppleScript applet, via the 'File Format:' popup menu), and click on the 'Options:' 'Stay Open' checkbox to add a check mark.
    -- Code starts here --
    property tApp : "Gimp"
    on run {}
    tell application "System Events" to tell process "Dock" to keystroke "d" using command down & option down
    tell application tApp to activate
    end run
    on idle {}
    tell application "System Events"
    set pNames to name of processes
    tell process "Dock" to if (not (pNames contains tApp)) then
    keystroke "d" using command down & option down
    tell me to quit
    end if
    end tell
    return 2
    end idle
    -- Code ends here --

  • How to capture show layer and hide layer event in photoshop through a plugin???

    How to capture show layer and hide layer event in photoshop through a plugin???for mac

    Use the Listener plug-in found in the SDK to see how you can monitor the show/hide layer event. You can also use the Getter plug-in to show what information you can find out about the current state of Photoshop.

  • How to write numbers in Arabic?

    Hi All,
    How to write numbers in arabic?
    (how will you in normal papers....assume 123 to be in the arabic numerals here).
    Should it be:
    | -123|
    (or)
    | 123-|
    Thanks,
    Jana

    Try the following.
    DecimalFormat formatter_ar=null;
    Numberformat form = NumberFormat.getNumberInstance(new Locale("ar","EG"));
    if(form instanceof DecimalFormat) formatter_ar = (DecimalFormat)form;
    String str = formatter_ar.format(-123.45);
    System.out.println(str);

  • How to write a start routine in the trasnformations ?

    Hi Experts,
    I am working on BI 7, As I want to write a start routine in transformations of 0FIGL_O02 DSO, to allow the GL accounts with cost center data. Already there is a delete statement please find.
    *DELETE SOURCE_PACKAGE where BAL_FLAG = 'X'. I had made comment to allow the G/L accounts. since I have some GL Accounts which does'nt have the cost center data, so in this case I have to write a ABAP code to allow this G/L accounts with cost center data.
    So Let me know if anyone can help me how to write the ABAP code in the start routine.
    Thanks
    sekhar

    Hi,
                Yopu can write the below lines of code adn try
        SORT source_package BY Receive nr  Type ASCENDING.
        DELETE ADJACENT DUPLICATES FROM source_package COMPARING Receive nr  Type.
    But you should make sure which record of the either rows need to deleted
    i.e in
    F9001;LU;J001;662;
    F9001;LU;J002;662
    You need to decide to eliminate 1st or 2nd one.(depends on your requirement)

  • How to write the start routine in the transformations ?

    Hi Experts,
    I am working on BI 7, As I want to write a start routine in transformations of 0FIGL_O02 DSO, to allow the GL accounts with cost center data. Already there is a delete statement please find.
    *DELETE SOURCE_PACKAGE where BAL_FLAG = 'X'. I had made comment to allow the G/L accounts. since I have some GL Accounts which does'nt have the cost center data, so in this case I have to write a ABAP code to allow this G/L accounts with cost center data.
    So Let me know if anyone can help me how to write the ABAP code in the start routine.
    Thanks
    sekhar

    Hi Experts,
    I am working on BI 7, As I want to write a start routine in transformations of 0FIGL_O02 DSO, to allow the GL accounts with cost center data. Already there is a delete statement please find.
    *DELETE SOURCE_PACKAGE where BAL_FLAG = 'X'. I had made comment to allow the G/L accounts. since I have some GL Accounts which does'nt have the cost center data, so in this case I have to write a ABAP code to allow this G/L accounts with cost center data.
    So Let me know if anyone can help me how to write the ABAP code in the start routine.
    Thanks
    sekhar

  • How to write a pgm to change the existing encrypted password

    Hi all,
    can anybody tell me how to write a pgm to change the existing encrypted password.
    thanks in advance.

    Well, it's going to depend on how it's implemented in the current system.
    But basically it's going to look a lot like the current login actions. Presumably you have something that takes the user ID and password, encrypts the password, looks up the encrypted password in the database matching that user ID, and compares them. This functionality would also take a new password (preferably twice so they can be checked for consistency), and if the existing encrypted passwords match, it will encrypt the new password and put it in the database where the old one was.
    And if the application has a mechanism for new users to sign up, it'll look a lot like this as well.
    But I'm just guessing. This is all going to depend on how the existing functionality is written. Probably the best thing you can do is talk to a programmer at your organization who has worked on the application, and ask them for help.
    Hope this helps anyway.

Maybe you are looking for

  • MBP Retina or Powerful Ultrabook?

    Hi, I've been a PC user all my life, but after working my way through the first iPod Nano, a couple iPod Touches, and now an iPad 2- I've grown to like the way Apple works. I'm finally at the point where I've decided to upgrade my 4-year old Future S

  • How is it possible for Adobe Support to be so bad ?

    I mean really ! For a multi billion dollar company, support is worse than Microsoft ! And that speaks heaps ! I had the worst customer experience throughout the day with people that have no grasp over the english language and moreso, no technical ski

  • Adobe Reader 9.3 takes over icons on Windows 7 Desktop

    This has repeated 4 times (downloaded 9.3 and installed) since I got a new laptop two months ago.  All icons become unusable with error SC_Reader.ico.   Adobe help was call but since this is a free product, no help was provided.  I have had several o

  • HT5312 how to transfer redeems payment to my another iTunes account?

    I bought a gift card and put it in one of my itune account. But when it ask me to ans my security question, i realize iforgot them. I also noticed i forgot to add a rescue email address when i create it that time. So, i want to transfer my redeems to

  • Selecting one dimension of a two dimension array?

    hi, i want to select only one dimension of an array and put it into an arraylist (or casting the array verbatim into the arraylist) for example, here is an two dimension array: Object[][] data =      {  { new Date(), "A", new Integer(1), Boolean.TRUE