Apple Script Studio "Visibility"

Hello,
I am trying to get the status of image views (if they are visible or now) and I tried several different methods -- none seem to work. For example
if visible of image view "fnamei" is true and visible of image view "lmanei" is true and visible of image view "agei" is true then
set visible of button "done" to true
end if
(*Or Maybe*)
if "fnamei" and "lnamei" and "age1" then
set visible of button "done" to true
end if
Any other suggestions?

Solution found.

Similar Messages

  • Apple Script Studio Password

    Hello,
    Is there a way of having a text box in applescript studio but when you type the correct password, you have more buttons on your window?
    Thanks!

    Sample code:
    on action theObject
    tell window 1
    if (((name of theObject) is "textfield01") and (((contents of text field "textfield01") is equal to "dev_sleidy"))) then
    set (enabled of (button "button01")) to true
    set (enabled of (button "button02")) to true
    end if
    end tell
    end action
    ... based on a window with a text field named 'textfield01' and two buttons (named 'button01' and 'button02'); and, the text field set to 'NSSecureTextFiled' via 'Interface Builder's 'Inspector's (popup menu set to 'Custom Class's) panel.
      Mac OS X (10.4.2)  

  • Selecting Different Printer With Apple Script.

    Hi,
    I am currently in the process of making a script to be able to print off labels without the need of much user input (read from a document or e-mail) and I want to be able to set the printer when it goes to the print screen.
    this is the final apple script step in the application cmd+p brings up the 1st print menu the return takes it to the second print menu cmd+v pastes predifind by the user the ammount of copys they want
    on run {input, parameters}
              tell application "Labels & Addresses"
      activate
                        tell application "System Events"
      keystroke "p" using command down
                                  delay 1
      keystroke return
                                  delay 1
      keystroke "v" using command down
                                  delay 1
                                  tell application "System Events"
                                            tell process "Labels & Addresses"
                                                      click (menu item whose description is "Printer")
                                                      click (menu item "Zebra Technologies ZTC GK420t" whose description is "Printer")
                                            end tell
                                  end tell
                                  return input
                        end tell
              end tell
    end run
    now there is chance to change the printer selection twice once in the 1st print screen and once in the 2nd print screen the only problem is im not sure how to apple script to select the right printer from the drop down menu, I got the code from a forum but I think it was old code as when I tested it it was returning errors so I modified it a bit and now it just struggles finding the menu item with description of printer.
    Does anyone know what I would have to use for it to select the right printer? (The Zebra Technologies ZTC GK420t)
    Help would be greatly appricited!
    Thanks,
    Bruce
    P.S. sorry the code is a bit messy!

    Im NOT sure if you have just made this a little over complicated… This works just fine for me. Tested with about a dozen psd layers…
    tell application "Adobe InDesign CS2"
    tell active document
    tell rectangle 1
    tell graphic 1
    tell graphic layer options
    set GLC to count of graphic layers
    repeat with i from 1 to GLC
    if name of graphic layer i ≠ "Blue" then
    set current visibility of graphic layer i to false
    else
    set current visibility of graphic layer i to true
    end if
    end repeat
    end tell
    end tell
    end tell
    end tell
    end tell
    This variant also works as I would have expected too… Retaining visibility from a list…
    tell application "Adobe InDesign CS2"
    tell active document
    tell rectangle 1
    tell graphic 1
    tell graphic layer options
    set On_List to {"Red", "Aqua", "Orange"}
    set GLC to count of graphic layers
    repeat with i from 1 to GLC
    if name of graphic layer i is not in On_List then
    set current visibility of graphic layer i to false
    else
    set current visibility of graphic layer i to true
    end if
    end repeat
    end tell
    end tell
    end tell
    end tell
    end tell

  • Removing BCC with Apple Script when automatically BCC myself is set in pref

    I have "Automatically Bcc myself" set in the Mail Composing preferences, which I like because I get a copy of email that I send. I also have an apple script that forwards messages to an email address. When I used this apple script on Tiger, the BCC option was never added (it might have been a bug with Mail in Tiger); however, now on Leopard, the BCC option is always added when I used the apple script.
    I've tried setting the BCC field to Null and Blank, but that doesn't seem to work. I suspect that the field is set upon send or the "make new" directive. Does anyone know a way to tell Mail to not Bcc automatically in an Apple Script?
    Here is the forward apple script program:
    (* Cf. http://www.macosxhints.com/article.php?story=20060219014940761 *)
    (* RS 31st July 2006 *)
    set theAuthority to "person AT here"
    tell application "Mail"
    set theMessages to the selection
    repeat with thisMessage in theMessages
    set newMessage to make new outgoing message at end of outgoing messages
    tell newMessage
    set visible to true (* comment out whole line to stop 'blinking' windows *)
    set content to thisMessage's source
    set subject to "Fwd: " & thisMessage's subject
    set bcc to null (* my attempt to set bcc to null or blank *)
    make new to recipient with properties {address:theAuthority}
    end tell
    send newMessage
    set read status of thisMessage to true
    set was forwarded of thisMessage to true
    set junk mail status of thisMessage to true
    end repeat
    end tell

    Thanks for that reply!
    After more google searching, I found this on http://www.macosxhints.com/article.php?story=20040425063255443
    One of the responses said that you can add the lines:
    delete bcc recipients
    delete cc recipients
    "in that order" to the new message tell and get rid of the recipients. I had tried the delete before, but I thought I had to get the recipients before I deleted them. I'm not a very good apple script person. Here is my final script
    (* Cf. http://www.macosxhints.com/article.php?story=20060219014940761 *)
    (* RS 31st July 2006 *)
    set theAuthority to "email address here"
    (* or your personal Knujon address *)
    tell application "Mail"
    set theMessages to the selection
    repeat with thisMessage in theMessages
    set newMessage to make new outgoing message at end of outgoing messages
    tell newMessage
    set visible to false (* comment out whole line to stop 'blinking' windows *)
    set content to thisMessage's source
    set subject to "Fwd: " & thisMessage's subject
    make new to recipient with properties {address:theAuthority}
    delete bcc recipients
    delete cc recipients
    end tell
    send newMessage
    set read status of thisMessage to true
    set was forwarded of thisMessage to true
    set junk mail status of thisMessage to true
    end repeat
    end tell

  • Its possible to convert Apple script to Java script

    Hi,
    Please Help me anyone to do that script.
    its possible to convert below mentioned Apple script to Java Script.
    Thanks in advance.
    Help me......!
    -yajiv
    Code:
    tell me to addImageLabels()
    on addImageLabels()
              tell application "Adobe InDesign CS5"
                        set numberAdded to 0
                activate
                        set enable redraw of script preferences to true
                        set currentFonts to (get name of every font)
                        if currentFonts does not contain fontname then
                                  display dialog "The font \"" & fontname & "\" is not active on your system." buttons {"Continue anyway", "Cancel"} default button 2
                        end if
                        tell document 1
      -- get a list of unique page IDs in this document
                                  set allpageids to my getPageIds()
                                  repeat with p from 1 to (length of allpageids)
                                            set pgid to item p of allpageids
      -- loop through these, getting a list of unique page item IDs to inspect
                                            tell page id pgid
                                                      set pageitems to (get id of every page item)
                                                      repeat with i from 1 to (length of pageitems)
                                                                set pid to item i of pageitems
                                                                tell page item id pid
                                                                          try
      -- certain boxes will fail to yield a content type, whatever
                                                                                    if content type is graphic type then
                                                                                              set c to class
                                                                                              set i to id
      -- get the name of the link, i.e. the filename, subject to labelFormat (full name, first six chars, etc.)
                                                                                              set gn to my getImageName(pgid, c, i)
                                                                                              if (gn is not "Empty") and (gn is not "") then
                                                                                                         set b to visible bounds
                                                                                                         set h to (item 3 of b) - (item 1 of b)
                                                                                                         set newtop to (item 1 of b) + (h / 2)
                                                                                                         set item 1 of b to newtop
                                                                                                         set w to (item 4 of b) - (item 2 of b)
                                                                                                         if w < minwidth then
                                                                                                                   set item 4 of b to ((item 4 of b) + 0.2)
                                                                                                                   set item 2 of b to ((item 2 of b) - 0.2)
                                                                                                         end if
                                                                                                         set l to (make new text frame at beginning of page id pgid with properties {visible bounds:b, fill color:fillcolor, contents:gn, label:"imagelabel"})
                                                                                                         tell l
                                                                                                                   tell paragraph 1
                                                                                                                             set justification to center align
                                                                                                                             try
                                                                                                                                       set applied font to fontname
                                                                                                                             end try
                                                                                                                             set point size to fontsize
                                                                                                                             set fill color to textcolor
                                                                                                                   end tell
                                                                                                                   set inset spacing of text frame preferences to ((insetspacing as string) & " in") as string
      fit given frame to content
                                                                                                                   set numberAdded to numberAdded + 1
                                                                                                         end tell
                                                                                              end if
                                                                                    end if
                                                                          end try
                                                                end tell
                                                      end repeat
                                            end tell
                                  end repeat -- allpageids
                        end tell -- document 1
      display dialog "Added " & numberAdded & " labels." buttons {okButton} default button 1 giving up after 10 with title scriptName
              end tell -- InDesign
    end addImageLabels
    on getPageIds()
              tell application "Adobe InDesign CS5"
                        tell document 1
                                  tell master spread 1
                                            set masterpageids to (get id of every page)
                                  end tell
                                  set docpageids to (get id of every page)
                        end tell
              end tell
              return masterpageids & docpageids
    end getPageIds
    on getImageName(int1, cla1, int2)
              tell application "Adobe InDesign CS5"
                        tell document 1
                                  tell page id int1
                                            if cla1 is rectangle then
                                                      set imagename to (name of item link of graphic 1 of rectangle id int2)
                                            else if cla1 is polygon then
                                                      set imagename to (name of item link of graphic 1 of polygon id int2)
                                            else
                                                      return "Unknown"
                                            end if
                                            try
                                                      if (labelformat is "First six characters") then
                                                                return (characters 1 thru 6 of imagename) as string
                                                      else if (labelformat is "Base name of linked file") then
                                                                set op to offset of "." in imagename
                                                                return (characters 1 thru (op - 1)) of imagename as string
                                                      else
                                                                return imagename
                                                      end if
                                            on error
                                                      return "Empty"
                                            end try
                                  end tell
                        end tell
              end tell
    end getImageName

    Yajiv:
    I realize English is probably not your first language, but you are not really making sense. Perhaps you could use more words and write in more detail.
    It seems you already have your script in AppleScript. Why do you need to convert it to JavaScript?
    It's going to be inconvenient at best and probably not worth anyone's time.
    Just use the AppleScript.

  • Apple Scripting for Microsfot Power Point 2011

    Hi,
    I am having problem with following apple script. This is working fine with Office 2004 but when i am using office 2011 then on action is changing to «class BCOa». Can any one please help me in this. I will be very thankful
    tell application "Microsoft PowerPoint"
    set btnAbout to make new command bar control at command bar ¬
    "CPS" with properties {control type:control button, button style:button caption}
    -- Set button style in "with properties" block
    set width of btnAbout to 60
    set name of btnAbout to "About"
    set *on action* of btnAbout to "cpsHandleAbout"
    set tooltip text of btnAbout to "About CPS for PowerPoint"
    end tell

    Hm, not sure if this helps, but perhaps... first create this command button by hand...
    then run
    tell application "Microsoft PowerPoint"
    get properties of command bar control "About" of command bar "CPS"
    end tell
    this returns the properties of this button...
    something like:
    {class:command bar button, begin group:false, built in:true, name:"About", description text:"", enabled:true, height:22, help context ID: 0, help file:"", id:2520, entry_index:1, left position:674, parameter:"", priority:3, tag:"", tooltip text:"&About", top:324, control type:control button, visible:true, width:28, button face is default:false, face id:23, button state:button state up, button style:button automatic}
    If the button uses a build in command you will get to know the id of this command...
    e.g. the ID is 23 (open file)
    make new command bar control at command bar ¬
    "CPS" with properties {id:23}
    and this would create such a new button...
    But I am not sure who to get a list of all action ids...

  • Removing apple scripts

    I have several very old Apple scripts in iTiunes that no longer work.  where are they located and can I delete them?
    Thanks
    Danny

    I use an older iTunes but the first item in my Applescripts menu is "Open Scripts folder".  If you don't have this you may need to go to your /users/put your username here/Library/iTunes/Scripts folder.  However, I believe Apple decided to make this invisible for users of newer systems so you will have to do it through the Go Menu in Finder, or read up on the web on how to make your Library folder visible.

  • Apple Script to make Pages open in a user-selected screen position

    This is a follow-up to a response/script made previously by Yvan KOENIG that enables Pages to open a Pages template in a user-selected "left" position.
    http://discussions.apple.com/message.jspa?messageID=9100331#9100331
    This works great for me, but I'd like to take this one step further, if possible. I'm naïve when it comes to Apple Scripts
    Currently, if I use the script, it opens up in 100% 'fit-width' view as follows:
    http://trials.sent.com/pages/100.png
    What I'd like it to do is to open up in 125% 'fit-width' view as follows:
    http://trials.sent.com/pages/125.png
    I'd like to therefore ask if it's possible to somehow enable this in the script above.

    I looked at the English version.
    Let me say you that you are a funny guy.
    Set width and set "Fit Width" are incompatible commands.
    On my 1920 x 1200 screen, if I set scale to 125%, Fit Width is disabled.
    If I check "Fit width", the size remains unchanged but is no longer selected.
    On a smaller display, "Fit Width" will set the page in the "100%" mode.
    My guess is that it's what you get.
    As I am a good guy,
    I add some instructions in the code.
    Now you may activate several settings to fit your needs (when they are technically compatibles).
    --(SCRIPT openToLeft.app]
    Enregistrer le script en tant que Script, Application ou Progiciel : openToLeft.xxx
    déplacer l'application créée dans le dossier
    <VolumeDeDémarrage>:Users:<votreCompte>:Library:Scripts:Applications:Pages:
    Il vous faudra peut-être créer le dossier Pages et peut-être même le dossier Applications.
    menu Scripts > Pages > openToLeft
    Le script créera un nouveau document à partir du modèle choisi et le poussera à gauche de l'écran.
    --=====
    L'aide du Finder explique:
    L'Utilitaire AppleScript permet d'activer le Menu des scripts :
    Ouvrez l'Utilitaire AppleScript situé dans le dossier Applications/AppleScript.
    Cochez la case "Afficher le menu des scripts dans la barre de menus".
    +++++++
    Save the script as a Script, an Application or an Application Bundle: openToLeft.xxx
    Move the newly created application into the folder:
    <startup Volume>:Users:<yourAccount>:Library:Scripts:Applications:Pages:
    Maybe you would have to create the folder Pages and even the folder Applications by yourself.
    menu Scripts > Pages > openToLeft
    The script will create a new document from the selected template and will push it to the screen's left edge.
    --=====
    The Finder's Help explains:
    To make the Script menu appear:
    Open the AppleScript utility located in Applications/AppleScript.
    Select the "Show Script Menu in menu bar" checkbox.
    +++++++
    Yvan KOENIG (Vallauris FRANCE)
    4 mars 2009
    property theApp : "Pages"
    property hardCoded : false
    true = the template is predefined
    false = you select the template when you run the script *)
    property zoomIt : false
    false = leaves the doc size as created
    true = issue a cmd + > command to enlarge it *)
    --=====
    on run
    my activateGUIscripting()
    tell application "Pages"
    set Templates_loc to localized string "Templates" (* nom local du dossier "Modèles" *)
    set MyTemplates_loc to localized string "My Templates" (* nom local du dossier "Mes Modèles" *)
    end tell -- theApp
    set templatesFolder to ((path to application support from user domain as text) & "iWork:Pages:" & Templates_loc & ":" & MyTemplates_loc & ":")
    if hardCoded then (*
    Here the template to use is hard coded in the script *)
    if templatesFolder does not end with ":" then set templatesFolder to templatesFolder & ":"
    set myTemplate to (templatesFolder & "un modèle09.template:") as alias
    else (*
    Here we are urged to choose the template in a dialog *)
    set templatesFolder to templatesFolder as alias
    Don't ask me why, Pages uses two Universal Type Identifiers for its templates
    the first one is used if only Pages '08 is installed under 10.4 or by both '08 and '09 under 10.5.6
    the second one is used under 10.4.11 if Pages '09 is installed *)
    set allowed to {"com.apple.iWork.Pages.template", "com.apple.iWork.Pages.sfftemplate"}
    if 5 > (system attribute "sys2") then
    set isOs4 to true
    set permitted to allowed
    else
    set isOs4 to false
    set permitted to {}
    end if
    if my parleAnglais() then
    set myTemplate to choose file "Choose a Pages template …" of type permitted default location templatesFolder
    else
    set myTemplate to choose file "Choisissez un modèle Pages …" of type permitted default location templatesFolder
    end if
    if not isOs4 then
    due to a system's bug, choose file is unable to filter the iwork's files UTIs
    So we must check by ourself *)
    set maybe to myTemplate as text
    tell application "System Events" to set typid to type identifier of disk item maybe
    if typid is not in allowed then
    if my parleAnglais() then
    error "The file “" & maybe & "” is not a Pages template !"
    else
    error "Le fichier « " & maybe & " » n’est pas un modèle Pages !"
    end if
    end if
    end if
    (* Here, the pathname of the template is of class alias *)
    end if -- hardCoded
    try
    tell application "Pages"
    activate
    set n to count of documents
    open myTemplate (* create a new doc from the template *)
    repeat
    if (count of documents) > n then
    exit repeat
    else
    delay 0.1
    end if
    end repeat
    tell window 1 (*
    As we are telling to application "Pages" we may use tell window 1 even if we have an Inspector or a Find/Replace dialog open.
    It would be wrong if we where telling to process "Pages" *)
    set {x1, y1, x2, y2} to get bounds
    set bounds to {0, 0, x2 - x1, y2 - y1} (* move the window to the left edge *)
    set view scale to 125.0
    --set fit page to true (* or false *)
    set fit width to true (* or false *)
    --set full screen to true (* or false *)
    --set outline visible to true (* or false *)
    --set ruler visible to true (* or false *)
    --set styles visible to true (* or false *)
    --set thumbnails visible to true (* or false *)
    --set toolbar visible to true (* or false *)
    --set two up to true (* or false *)
    end tell -- window
    end tell -- application
    end try
    end run
    --=====
    on activateGUIscripting()
    tell application "System Events"
    if not (UI elements enabled) then set (UI elements enabled) to true (* to be sure than GUI scripting will be active *)
    end tell
    end activateGUIscripting
    --=====
    on parleAnglais() (* Check if Pages is running in French *)
    local z
    try
    tell application theApp to set z to localized string "Cancel"
    on error
    set z to "Cancel"
    end try
    return (z is not "Annuler")
    end parleAnglais
    --=====
    --[/SCRIPT]
    Yvan KOENIG (from FRANCE jeudi 14 mai 2009 11:35:36)

  • Mail Apple Script

    I need to Apple Script so mail closes at login and doesn't stay open. I lost it somehow. Anyone have it?

    To hide Mail when it is open:
    tell application "System Events"
    set visible of process "Mail" to false
    end tell
    To quit Mail:
    tell application "Mail"
    quit
    end tell
    A delay statement, such as 'delay 2', can be placed at the beginning of each script if the event is being triggered too fast. In any case, put the script text into the Script Editor in the /Applications/AppleScript/ folder, save it as an application, and add the script to the list of login items for your account in the Accounts pane of System Preferences.
    (20280)

  • Hiding Folders via Apple Script

    Good evening,
    When i installed Leopard a got up a little Issue: When i look in my harddrive i can see the the folder "var,usr,etc" ... in the normal Finder Window.
    Well i thought it would be some kind of a bug so i helped myself and used a little apple script i allreade used in Tiger to hide all these annoying folders like "Microsoft Users Data etc." You know what i mean
    My Script does this:
    +set myfile to choose file+
    +tell application "System Events" to set visible of myfile to false+
    +tell application "Finder" to update myfile+
    I should be able to pick a file (have done the same for folders, too) and hide it from the normal Finder window. Well it works fine on causaul folder and data.
    But on these UNIX Folder i mentoined it wont work. My Question: How can i get this to work? (I thought of missing admin priviledges?)

    Try the instructions in this article.
    (25833)

  • HELP : APPLE SCRIPT ISSUES!

    I am trying to make an apple script that will detect when an application (minecraft,cod or other online downloaded software/games) is open and then bring up a dialog that wont go away so that only I.T. can remove it. I also want it to send an email to a certain adress saying that so and so has been playing games
    It's a school project that im working on, we have to figure out a way (through applescript) to help students be more productive, everyone else has no experience with apple script but me. I managed to create this in a couple of minutes but there is a couple glitches and problems i cant solve.
    the problems include
    it doesn't work with non-appstore apps ie. apps downloaded for the internet
    i want it to be able to detect numerous programs
    it doesn't close the program and/or bring the window/dialog to the top.
    I have used safari as an example as to where a list of "illeagle apps" should be.
    here's the script:
    tell (get system info)
              set longName to long user name
              set shortName to short user name
    end tell
    if appIsRunning("Safari") then
              tell application "Mail"
                        set theNewMessage to make new outgoing message with properties {subject:"[" & longName & "] ,Gaming Alert", content:"[" & longName & "] has been gaming, he is to report to I.T. by the end of the day", visible:true}
                        tell theNewMessage
      make new to recipient at end of to recipients with properties {address:"[email protected]"}
      send
                        end tell
              end tell
    end if
    end
    repeat
              if appIsRunning("safari") then
                        display dialog "Gaming is not allowed, Your log of your computer programs running has been emailed to the I.T. department. Please visit the I.T. department immedietly to remove this message" buttons {"Report To I.T."} default button 1 cancel button 1 with title "Gaming Alert" with icon stop
              end if
    end repeat
    if appIsRunning("safari") then
              tell application finder
                        quit appIsRunning("safari")
              end tell
    end if
    on appIsRunning(appName)
              tell application "System Events" to (name of processes) contains appName
    end appIsRunning
    end
    Any help is greatly appriciated
    Thanks! 

    I really do not appreciate your negativity towards this assignment.
    firstly i am not trying to "cheat" the system by asking for help, our teacher encourges us to go online , reserch and go onto forums such as these.
    Secoundly , I dont need you to criticize my idea's by telling me that i am a "taddle tale" or whatever
    Thirdly , it's called updating over wifi. Thats how I intend on updating the blacklist to new games
    Finally it will encourage student productivity, as without games there will be no distractions. Internet games and such are blocked and I plan to keep my identity, as the creator of the script , a secret
    And also, here's a bit of criticism maybe you would be a better educationalist yourself if you actually encouraged a project.
    Ps. Are you familiar with google science fair... if not LOOK IT UP!
    im going i have talked viney kumar and are most likley teaming up to put this project in action, we go to the same school. He thinks it is a good idea and if YOU ever had any idea's at all that aren't criticism maybe you would have at least one atom that is up to his standard of innovation.bye the way, i am only 14.What were you trying to do when YOU were 14...
    Signed
    Steves Assistant

  • Sending email using apple script...

    I have created a watch folder using apple script that when a file is dropped on it, it automatically opens, formats, and sends out a custom email.
    What I don't understand is, how can I include multiple variables in the "content" section (also known as the body section of the email)? I want to put custom type in the content section that says "There is a file awaiting your review." I also would like to choose an email signature from my mail program to use. Third, I would like to include the name of the file that is being sent....
    I found that by doing {content:iteminfo} I could get the file name...If I do {content:"There is a file awaiting your review."} I could get the custom type I wanted....
    BUT, I can't figure out how to get BOTH of them together in ADDITION to adding a custom email signature...
    I know there are some really smart people out there...Any tips?

    I can't figure out how to get BOTH of them together
    This is just standard AppleScript text concatenation with the &:
    ... {content: "There is a file awaiting your review: " & iteminfo}
    Here you can see I'm concatenating a literal string (enclosed in quotes) and a variable. You can extend this ad infinitum.
    As for the signature:
    tell theMessage to set message signature to signature "My Sig"
    (which assumes you have a signature named 'My Sig'. Adjust as necessary.

  • New to apple script...

    Hi I am new to apple script; I was using Automator but it became too dumb to it's surroundings after a while. Can you please tell me why these don't do what I think they should; Safari has 2 windows open one with four tabs (window 1 as I have used exists to be sure of) and one with 9 (window 2).
    tell application "Safari"
    activate tab 6 of window 2
    end tell
    all it does is bring the frontmost safari window up
    Please help

    There are a couple of reasons behind this, mostly because you're using the wrong command.
    The main thing is that the 'activate' command is used to activate the application. Any other parameters (such as 'tab 6 of window 2') are discarded.
    Instead, the appropriate syntax is to set the current tab property of the window:
    tell application "Safari"
      set current tab of window 2 to (tab 6 of window 2)
    end tell
    It's a little verbose, but it works.
    If you also want to bring that window frontmost you need to change its index:
    tell application "Safari"
      tell window 2
        set current tab to (tab 6 of window 2)
        set index to 1
      end tell
    end tell
    Note though that changing the window index will now also change this window to 'window 1' instead of 'window 2'. Something to bear in mind if you're taking further actions.

  • How can I get the size of a file with apple script

    I try to get the size of a file within an apple script. But I did not find information how to do this.

    There are two ways. I think Apple is moving toward using System Events, which is listed first.tell application "Finder"
    set myFile to selection as alias
    --this just gets a file for me to work with
    --coercing it into an alias is required for the other functions
    end tell
    tell application "System Events"
    get size of myFile
    end tell
    set myInfo to (info for myFile)
    get size of myInfo

  • How to call a perl script from an apple script

    Hi All,
    How to Call a perl Script from an apple script.
    Pls Give Your comments.
    Thanx & Regards,
    Esther

    Applescript to call a perl script named "/tmp/x.pl" passing an argument "world"
    do shell script "/usr/bin/perl /tmp/x.pl world"
    or if the script is given the executable atttribute (chmod +x /tmp/x.pl),
    do shell script "/tmp/x.pl world"
    Perl script "/tmp/x.pl" that prints a string using a passed argument
    #!/usr/bin/perl
    print "Hello $ARGV[$1]\n";

Maybe you are looking for

  • Adobe Acrobat 11 will not open files in IE 10.0.06

    Adobe Acrobat 11 will not open files in IE 10.0.06. Problem started about 2 months ago. It can open older files on computer but cannot open or downloadd any from internet. Using Office 2010. Already spent an hour with my computer tech support under w

  • Where can I get a stylus for a PRS-950 reader?

    The stylus on my 2 year old e-reader has broken & I need to know where I can get a new one. Thx, Paul

  • Prefixing a sequence name with a schema in 9041

    G'day, I'm attempting to upgrade to Toplink 9041, and one thing i've noticed is that the Workbench does not allow any special characters in the name of a sequence. This does not allow us to prefix sequence names with a schema, the same way our tables

  • CS3 - no thumbnail previews

    Does anyone know why CS3 doesn't show you previews of documents in thumbnail mode? I hate having to open up each version of a document to see which one is which. Any one know any add ons or ways I can get the preview back other than re-installing CS2

  • Noob Exception Handling Help

    OK, basicly. Theres 3 fields. If a user enters data into 1 of the fields, it searches and prints something out of the DB. But if a user enters nothing it should throw an error telling them to input something. It all occurs in the doGet. Experts.. hal