Test of specific character in Applescript

Hi Applescript community!

I try to write a code in which will perform a different action depending on the 1st character of a .txt file. This is my code so far (I'm fairly new to Applescript, so I'm sorry if this is a basic question)

say application "TextEdit".

If the first character of "/ Users/Goombado/Documents/applescript_test.txt" is 1 then

display the dialog box 'Hi. '

on the other

display the dialog box 'Hello '.

tell the end

end if


Is it possible to do in Applescript?

Thanks in advance,

Andrei

set this to read "/ Users/Goombado/Documents/applescript_test.txt".

If this begins by '1' then

display the dialog box 'Hi. '

on the other

display the dialog box 'Hello '.

end if

Tags: Mac OS & System Software

Similar Questions

  • Looking for the last element of a string defined in a specific character style

    I should find each space which is the last character of a string in a particular character style. For example, in the "123 456 789" passage (the underlined part here indicating a passage located in a specific character style), my ideal GREP search would produce a match after the number 6.

    How to do this?

    Define your character style in the Format Panel find, use this GREP: \s$

    $ is the match end-of-string location, and when you search for text in a style character style, the end of what this style is applied to is considered the end of the string.

    Peter

  • How to test if a character is a number

    Hi all.

    Someone at - it an idea on what is the most effective way to test whether a character is a digit character (0... 9) in pl/sql.

    Thank you

    Steve

    We use the plsql translate function

    Select NVL (RTRIM (TRANSLATE ('156 ', '1234567890',' ')), 'TRUE')
    of the double

    It returns the string "TRUE" If there is only the numbers that make up the chain.

  • Divide a row in columns on specific character

    Hello

    I have a table where a data column must be spllitted on, every time a character specific carats found.

    Any help would be appreciated.

    Table_Sample

    Col1 Col2

    ASD 123 ^ pqwer ^.

    23 a ^ b ^ c

    expected results

    Col1 Col2

    ASD 123

    pqwer 123

    23 a

    23 b

    23 c


    Hello

    Here's one way:

    SELECT col1

    REGEXP_SUBSTR (col2,

    , '[^^]+'

    1

    LEVEL

    ) AS col2_sub

    OF table_sample

    CONNECT BY LEVEL<= regexp_count="" (col2,="">

    AND PRIOR col1 = col1

    AND PRIOR SYS_GUID () IS NOT NULL

    ;

    As always, the solution depends on your data, your needs and your version of Oracle.

  • "testing" a new character set

    11.2

    We have two environments. CHOOSE the value OF V$ NLS_Parameters WHERE parameter = "NLS_CHARACTERSET"; Returns WE8ISO8859P1 AL32UTF8 and one in the other. Asked me to 'test' the support for multibyte characters and see what we need to do.

    I don't know how to approach the issue. So I went to the basics of loading of SQL * Plus and execute: SELECT 'Ä' FROM Dual;

    In WE8ISO8859P1 result:

    '

    -

    ?

    In AL32UTF8:

    '?'

    ---

    ?

    The only difference seems to be the display of single quotes in the header.

    What should I configure SQL * more? Is there a 'simple test' to show the difference between the two environments?

    Your task is not well defined. You cannot 'test data' unless you want to repeat that all the thousands of tests run by Oracle to test its product :-)  You can test some features in the database, but more often, you want to test a business with the database application.

    Certainly, an AL32UTF8 database can store data in any language supported by Unicode. You don't have to test this possibility. Thousands of databases with this character set and store data from around the world. However, AL32UTF8 is a multibyte character set. In other words, you need to store a lot of characters may have different codes of those in a database of the WE8ISO8859P1 and these codes can have more than one byte. Depending on how the columns of the table are defined, lengths of scope are defined, the application is configured, etc, you may or may not notice problems. As you can see, you need test a particular application to useful tests.

    If you want to just test the entry of accented Latin characters of languages of Western Europe on an American or a Western European version of Windows, then:

    -Open Command Prompt

    -Run:

    C:\ > chcp

    Should display:

    Active code page: 437 (or 850)

    If you see 437, enter:

    C:\ > set NLS_LANG =. US8PC437

    If you see 850, enter:

    C:\ > set NLS_LANG =. WE8PC850

    Then, run SQL * more (in the same window from command line!):

    C:\ > sqlplus...

    You should be able to enter Western European characters in the WE8ISO8859P1 database and the AL32UTF8 database with this configuration. Note, WE8ISO8859P1 can't stand not all characters available under Windows. For example, it does not support the Euro character.

    However, I recommend Oracle SQL Developer to test the characters entry in a database. It requires no any configuration for most popular languages. Configuration of fonts in the JDK can prevail for lesser-used languages.

    Thank you

    Sergiusz

  • [FM11] Print the link to the Image and the markers of Index with the specific character Style

    Hello

    I'm new with scripts for Framemaker. I want to export FM docs to RTF, so I can import into InDesign. For placed images I want to insert a line of text that shows the link to the image (reference). In addition, I want to show the Index markers at the insertion location of brand with a different character Style. Can someone help me with this?

    Best regards, Sjoerd

    Sjoerd Hello,

    A note on your method to retrieve all related graphics: this will also deal with graphics that could be linked in master pages and reference. Just to be safe against unwanted side effects, you should limit your list of charts to those in the main flow of your document.

    On the tLoc: looking for really the cornerstone of the anchored frame that contains the chart. It's a little confusing that FM called the anchored frame and any graph of the same name. Even if you add a framework anchored in the text to an equation or a text box in your document, the anchored frame will appear in the list of the chart in the document. If you have a framework anchored containing an imported graphic file, you have a list of graphic objects inside the anchored frame, who himself appears in the list of graphical objects in the document.

    This function should do what you want to do:

    function ListGraphics (doc)

    {

    var had is doc. FirstGraphicInDoc;

    While (had. {ObjectValid()})

    If (aframe.constructor.name == "Eu") {}

    image = had. FirstGraphicInFrame;

    If (graphic.type is Constants.FO_Inset)

    doc. AddText (had. TextLoc, graphic. InsetFile);

    }

    had had =. NextGraphicInDoc;

    }

    }

    I suppose you also want to remove the anchored frames (imported image files) the text. This can be done in the same routine, but you first have to catch the next element in the linked list graphics in the doc before deleting the current. If you do not delete the first and end up with an object not valid. The method simpler and more secure to do is to create an array of items to delete. After the while loop, you delete these objects. Get the complete code looks like this:

    function ListGraphics (doc)

    {

    var toDelete = [];

    var had is doc. FirstGraphicInDoc;

    While (had. {ObjectValid()})

    If (aframe.constructor.name == "Eu") {}

    image = had. FirstGraphicInFrame;

    If (graphic.type == Constants.FO_Inset) {}

    doc. AddText (had. TextLoc, graphic. InsetFile);

    toDelete.push (had);

    }

    }

    had had =. NextGraphicInDoc;

    }

    for (i = 0; i< todelete.length;="" i++="" )="">

    toDelete [i]. Delete();

    }

    }

    This works on a small test file created. If you are in need of more support, do not hesitate to contact me: jang to jang dot nl

  • the user entered text: determine if a specific character is correct

    Hello!

    I create a learning activity for one of our biology class. The basis of the activity is to test the ability of students to transcribe and translate DNA into other sequences.

    I have a dynamic text field where the student just type in a when 36 characters.

    I already know that I can use an if statement to check whether all the 36 characters are correct. I was wondering if there was a way to check individually each letter the student typed in is the right one for this line. If UUAACCGG is the right answer, so I want flash to check and see if the third character is, in fact, or not.

    I know I can do this with 36 individual text boxes, but I was hoping to kind of go out with just a big box.

    Is this possible? If this is the case, where should I start?

    Look in the String class and charAt() method.

  • How can I set a url to a specific tab in AppleScript to avoid opening new tabs everytime the script is run?

    Tell application "system events".

    activate an application "Safari".

    key code 19 using the command to cmd - down 2 opened a second tab or activate it so open

    Open the location "http://example.com".

    tell the end

    It works fine as long as one of them are real

    1. the 2nd tab does not exist yet in this case it will be the 2nd tab and open the url in this place. Or...

    2 If the 2nd tab already exists, it will launch the 2nd tab and reload the page until the 2nd tab is already at the location of Web site, we want to be.

    But if you say 2 or more tabs open and you run this, if the 2nd tab the DSI not already on the url, you want it to be it will activate the 2nd tab and then open the location of the site in a new tab.

    What I want is something like

    Code 19 - key using the command down

    Set the location of the active tab for the 1 in safari request to "http://example.com".

    But this obviously doesn't work. So, how can I know Safari to use only the tabs that I said rather than open new ones every time?

    You can try something like that.

    tell application "Safari"
        if not (exists document 1) then make new document
        tell window 1
            if not (exists tab 2) then make new tab
            set current tab to tab 2
            set tab 2's URL to "http://www.google.com"
        end tell
    end tell
    

    Briefly tested with Safari on OS X 10.6.8 5.1.10.

    Kind regards

    H

  • How to make a deletion of all files ending with a specific character?

    Somehow a large number of duplicate files have been created in my directory tree. I have hundreds of files with names like this:

    Bill.exe
    bill1.exe
    Ted.exe
    ted1.exe

    I need to scan the entire tree and delete all the files as "bill1.
    I tried to use the old generic MS-DOS "? ', but it does not quite work.

    If I use '? 1."as my search criteria, I also get the files which contain '1', but not as the last character. For example: "Phil1Fred" will match this search.

    So that search works, there is enough other files in order to make the very painful process.

    Is there a better way to manage this type of research?

    Unfortunately, which corresponds to unwanted files, such as "Phil1Fred".

    I recommend that you add the "/ p" option, at least initially, when you remove files using a wildcard character.  This makes prompt for confirmation before deleting each file. Owner, Boulder computer Maven
    Most Microsoft Valuable Professional

  • Save eps with specific name using Applescript

    Hi everyone I want to save .eps file to the current location of the illustrator open file with specific name E.g. XXXX_FINAL. EPS

    I tried something similar - can anyone help

    tell application "Adobe Illustrator"
     activate
      set theName to name of current document
      set theNamecount to count of theName
      set theOutdatedPathObj to the file path of current document
      set thePath to (POSIX path of theOutdatedPathObj) as string
      set pathCount to count of thePath
      set pathCount to (pathCount - theNamecount)
      set newPath to (text 1 thru pathCount of thePath)
     
     
     save current document in file newPath as eps ¬
      with options ¬
      activate
    end tell
    

    Can someone help me

  • Check with button if a field contains a specific character to another otherwise message box

    Hi guys,.

    Can I get some help please?

    I have a button and I would like to add some javascript in there to check some fields.

    If the field contains a '-' character then nothing

    otherwise it displays a message.

    If ((name_7.rawValue.match(/-/) == 0) {}

    }

    else {app.alert ("Fill - in with!") ;}}

    Thank you

    encleadus

    Hello

    The MATCH function will be return a null value if there is no match, then try;

    If (name_7.rawValue.match(/-/)==null)

    {

    App.Alert ("Fill - in with!");

    }

  • Change the color of a specific character in a text.

    Hi guys! for a project I need to change the color of each "a" in a text. Is there a way I can do it automatically?

    Aaaah! Try using a simple grep style!

    If you need to play in all the paragraph styles, map of style grep using this very clever script written by Colin Flashman, King of merge data!

    https://DL.dropboxusercontent.com/u/55743036/grepstylemap.jsx

    or a simple F/R.

  • How to apply a paragraph type to a specific character?

    Hi all

    I'm quite new with scripts and don't know much, but I have an InDesign document with a lot of balls and I need to apply a paragraph style to all these bullets, without having to manually select all the.

    Is it possible that I could do this? I tried to change some existing scripts, I found, but I don't understand enough of it to make it work.

    Thanks for your help!

    You don't need a script for this. Just search for fleas and apply

    a paragraph style using the find/replace regular user interface. If you need more

    more details, better ask in the forum on a regular basis.

  • Split the string of specific character in cfscript

    Hi I want to split string (7 <>2, 3 6 0.6 <><>) by the individual (<>) of characters and store it in the table.. .as c# code:

    dataList whwre =<>7 2, 3 6 0.6 <><>

    String [] wordsStrings = Regex.Split (dataList, "<>");

    You want to use the function ListToArray in ColdFusion.  Treat the <> as a list separator.  The important part here is setting the last argument true, for the argument of multiCharacterDelimiter .

    dataList = ' 7<>2, 3<>6<>0.6;

    wordsStrings = listToArray (dataList, "<>", false, true);

  • Error displaying script of test specification

    When you view the specification of test scripts, we can see all the inputs and outputs for each test case. Bit (high level as well as intermediate attributes) attribute is added as results. Among this it is high-level and other results in the medium term. Now, when you write as a test case, where the result of higher level is derived from intermediate results, I provides the values for the results intermediate directly (they are not derived from the basic entry-level). Here all intermediate outcomes should be displayed as inputs (as they are directly provided). But only the Basic (if any) attributes and the attribute of higher level is displayed. Is this a bug or am I wrong somewhere?

    Published by: Snehal.S on January 29, 2013 01:47

    I just have a look at a test of regression in 10.4.2 script and here are my comments...

    You plan to values for the intermediate attributes that you added as expected results? If this is not the case, they will not appear in the specification of Test Script. This is true for so the higher level objectives. They can expect values defined otherwise they will not appear in the Test case specification.

    If the expected results were values set for some test cases, but not others, then those expected results will appear only in the specification of Test case for special cases where they defined values.

    See you soon,.
    Jasmine

Maybe you are looking for

  • where 'tools' in the start menu screen of firefox?

    try to find a solution to allow the opening of the docs with adobe reader

  • Portege R100 - how to use the CD?

    Hi allI have a laptop portege R100, which has no cd or floppy drive; during an automatic update of windows, it crashed and I can't start although I have all the software which are all on CD! I would be grateful for any suggestions. Thanks in advanceJ

  • Why my iMac subsistence wants to leave applications?

    This dialog keeps appearing every hour to ask me if I'm sure that if I want to stop all applications? I never asked to stop smoking whatever it is. It doesn't matter which app is open does anyone have an answer? Apple support cannot help

  • Pavillion DV7 4077 cl: BSOD when starting windows 7

    My original processor in my HP Pavilion laptop went and I replaced it with a Core i5 480M processor, but when I start the computer it only does BSOD! I uninstalled the graphics drivers and when I try to use the ATi Radeon graphics card, all I get is

  • I don't get sound from my computer.

    Computer won't give me audio.  Tried everything I can think of: audio troubleshooting, looking at the firewall, etc..  However, my computer would work only in "safe" mode  This could be the reason why I can't get sound?