Repeat a script until no open window

Hello,
I've tried dabbling with Applescript and Automator and usually end frustrated. I was hoping someone could help a tech savvy but not programming savvy guy.
What I'm looking for is a way to repeat the script.
I'm extracting text out of several windows in safari. (I'm combining text from 40-50 students' work that have been submitted on Moodle, a web based class environment.) I basically manually open the windows in tabs and then I made the following script...
tell application "Safari"
activate
tell application "System Events" to keystroke "a" using {command down}
tell application "System Events" to keystroke "c" using {command down}
tell application "System Events" to keystroke "w" using {command down}
end tell
tell application "BBEdit"
activate
delay 0.1
paste
tell application "System Events" to keystroke return
tell application "System Events" to keystroke return
end tell
The delay is there because I was getting some paste errors without it. I know I can make it repeat a set number of times with "repeat 10 times" I was hoping I could make it repeat until there weren't any more open windows in safari. Any ideas?
Thanks,
Paul

Thank you so much, I really appreciate the help. So fast too!
I am a little confused because the message I was e-mailed was different than the one posted here...
*repeat with k from 1 to N*
instead of
*repeat N times*
I actually used the *repeat with k from 1 to N* and that worked perfectly. I was going to ask what the k was for and then saw the in the discussion that you didn't use the k.
It works, so I'm considering this solved, but I'm wondering what k is and why there were two different solutions.

Similar Messages

  • HT5639 I have downloaded Windows 8 on my Mac Pro 13'' retina display. The first few hours everything worked fine until I open windows today and the trackpad/mouse and keyboard aren't working. Ive tried resetting windows but it didnt work. help appreciated

    I have downloaded Windows 8 on my Mac Pro 13'' retina display. The first few hours everything worked fine until I open windows today and the trackpad/mouse and keyboard aren't working. Ive tried resetting windows but it didnt work. help appreciated thanks

    It sounds like it is time to restore from the backups you made just before making the disk changes.
    You can re-partition and restore your backups.  If you didn't make backups first (you were warned that it might damage things and to make sure you had a good backup) then you will need to repartition everything and reinstall from scratch...

  • Open window is not visible!!

    Hello Experts,
    We are using BPC 7.5 M sp04, SQL Server 2008, Office 2007.
    On one of our client laptops having Windows7 and Office 2007 is having the problem (emerged few days ago) that certain dialog (pop-up) windows appear only in the Windows' taskbar but the window itself is not visible. The main Excel session window switches to waiting (non-responsive) mode until the open window is closed using right-click menu at the taskbar. 
    This applies to the following commands: eTools->Open Dynamic Template, eTools->Save [Dynamic Template] As, eSubmit->Open Schedule Library, eAnalyze -> Open Report Library.
    What could be causing this issue. Please Advice.
    Thanks & Regards,
    Rohit

    Hi Rohit,
    I don't think it's a BPC issue maybe for some reason the pop-up are out of screen, if so right-click on the taskbar icon, click on move you will see the pointer that change with the for arrows then use one of the arrows key on the keyboard and you should see automatically the pop-up.
    Regards
         Roberto

  • When downloading course materials from Moodle, why do new Firefox windows open repeatedly and indefinitely until I FORCE QUIT?

    I use Moodle for my University courses. Moodle recommends using Firefox. Lately, when I download materials for my courses, Firefox begins to rapidly open new blank windows and will not stop until I Force Quit. I also am left with as many blank documents in my Downloads Folder as the amount of opened windows. Occasionally, when my required materials are successfully downloaded, the document will cause the aforementioned problem to begin again. I have removed Firefox and then reloaded and it is still occurring. I have attempted to use Safari and have not had the same problem. I would prefer to use Firefox but am reaching the limit of my patience and am about to say goodbye forever.

    See [[Firefox keeps opening many tabs or windows]].

  • Pages in frameset -script to open windows

    I have a site built in frames. When you link directly to a
    page not in my index frameset the page shows but of course the
    frames that should be there don't show because I don't know the way
    around. I tried an open window java script thing I got off the net
    but it seemed as if I needed to set a size somewhere or I did it
    wrong because it only brought up the frame and not the page also.
    Also, I have left and top navigation frames which I don't know how
    to script in. Not sure how to do this. Hope you all know what I'm
    getting at here. Also, I have a tutorial marked on making a dynamic
    frameset, I will study as time allows. Thanks.
    for reference
    my site

    > Yeah. well. I like the look of the two set frames and
    and one moving main
    > frame where the nav doesn't scroll with the page. Is
    there a way to
    > absolute
    > position the nav boxes so it will achieve the same look?
    Sorry for
    > putting
    > ameturish stuff on the net I have no training.
    The problems with frames is that they can cause many other
    problems.
    Samples include, as mentioned, the fact that your SSL page
    won't show as
    secure in some browsers, bookmarking pages can become
    impossible, it can
    make it difficult for search engines to navigate, it makes it
    harder for
    search engines to link into your site, and it can cause
    accessibility
    issues.
    On top of that, it can become a real pain to maintain.
    Wanting a 'static' menu is a common reason to use frames, but
    rarely is that
    type of functionality really needed at all. People can scroll
    web pages
    fairly easily.
    You can create a static menu sans frames if you want to use
    some CSS and
    javascript, though I tend to find those as annoying as frames
    a lot of the
    time.
    Another solution is to put your content into a scrollable
    div. Many people
    do that. However, I'm not a fan of trapping the important
    part of your site
    (the content) into a small box.
    Ultimately, the best optio is usually to just let the page
    flow as is.
    Also, and I've think I've said this before, your actual
    artwork is stunning.
    beautiful stuff. However, it's trapped in a rather gaudy page
    design with
    distracting backgrounds and flashing GIFs and drop shadows
    and the like.
    Think SIMPLE. Let your product shine through. Let people
    focus on that.
    -Darrel

  • Trying to open a page in IE-tab using javascript, script type="text/javascript" window.location.href="chrome://coralietab/content/container.html?url=0,myurl" /script Error:Component returned failure code:0x80004005 (NS_ERROR_FAILURE) [nsIDOMLocation.href]

    I am trying to open a page in IE-tab using javascript like this, <script type="text/javascript"> window.location.href = "chrome://coralietab/content/container.html?url=0,myurl" ;</script>.Error occured : [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMLocation.href]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame ::myurl :: load :: line 234" data: no] I have IE-Tab plug-in installed..when I open the same link manually in mozilla,it works fine and page gets opened in Ie-tab.

    The only way this might be possible is by using the HostContainer object
    to access the HTML page and do it from there.

  • HT2500 How do I not display the preview pane in mail until I open it with a double click? Some mail I do not wish to open-just delete it.

    How do I not display the preview pane in mail until I open it with a double click? Some mail I do not wish to open-just delete it. New macbook pro with LION OS

    Just drag the divider line between the preview pane and the message list all the way to the edge so the preview is completely closed. Selected messages will open in a new window with a double-click or the return key.

  • I cannot get the info bar (not the dock) on the top of my screen to permanently appear without my having to put the cursor on top of screen. Then it appears. Don't even know what that is called...above the open window.

    How do I get the area above the open window to display information (as in closing that specific window, "Safari  File Edit View History, etc.) without having to attempt to put the cursor on it to give me that info? I am not referring to the dock which is at the bottom of my screen. Although,It too, is not  visible.
    They were both visible before today.
    Sorry, but I have no clue as to what this topic should be.

    When you do Safari to it's maximum size on the screen (with the two little arrows in the Safari top menu bar on the right), Safari will take the whole screen including the top Apple menubar. In that menubar is the same set of little arrows to bring Safari back to it's previous size (which you can set by moving it's borders), you bring the Apple menubar in sight by moving the mousepointer to the top of the screen, when you do not want to loose that apple menubar, you can set Safari as bog as you can by moving its borders but just until below the apple menubar. Don't touch the little arrows in Safari menubar.

  • Need help with refreshing open window in new tab

    Hello all,
    First, all my other problems I've solved.  One last thing, being a newbie and trying things I've found on the net and them
    not working, I can use your help one last time.  My code has a Home page that peforms a Search (most of you have
    I am sure done this), and from that search submit a window opens in a new tab (browser tab) and has the results on
    it.
    That works fine.  What I'm having trouble with is being able to perform a new search and refreshing that open window
    with the new data.  Right now I am closing that window by clicking on the tab and then performing the search.
    While it works, it's not user friendly.
    So, I've tried the usual  mywindow=window.open("url.cfm"); and then trying to grab that handle to refresh, but to
    no avail.  Has anyone done this?
    Thanks!

    Here's an example of how you could do it.
    <script>
    function submitAndFocusTarget(form) {
      var win = window.open("", form.target);
      form.submit();
      win.focus();
    </script>
    <form action="index.cfm" target="mysearchwin" method="get" onsubmit="submitAndFocusTarget(this); return false;">
      <input type="text" name="search" value="" />
      <input type="submit" value="search" />
    </form>

  • I want to reset Firefox, and the message is that something is preventing the reset. I have closed all open windows and I still get the "Oops" message,

    I have uninstalled and reinstalled Firefox because I was receiving unwanted adware and was being directed to untrusted sites. Now I want to reset Firefox because I want to change the home page and toolbars, and something is preventing the reset. I have closed all open windows repeatedly, but the problem continues.
    =====Moved from Firefox OS product to Firefox for Desktop product category by Moderator. -feer56=====

    Check the programs that are on your computer
    '''Windows:''' Start > Control Panel > Uninstall Programs.
    '''Mac:''' Open the "Applications" folder
    '''Linux:'''
    * [http://www.freesoftwaremagazine.com/articles/see_all_your_installed_applications_ubuntu_unity Ubuntu Unity]''' {web link}
    * Xfce: Applications Menu category sections
    * options depends on the package manager and the desktop environment
    Go thru the list. If you find something that you don't
    know what it is, use a web search.
    '''''[https://support.mozilla.org/en-US/kb/troubleshoot-firefox-issues-caused-malware Troubleshoot Firefox Issues Caused By Malware]''''' {web link}

  • Firefox asks (twice) to save and close tabs, on new open windows without tabs, when i close them.

    About one month ago, i started to receive a message box from firefox, asking if i wanted to save and close tabs, on newly open windows (and pop-ups) without any tabs open on them.
    And everytime i close the windows without tabs, firefox asks it twice...
    I did not made any changes, so i don't know why it started doing this.

    Start Firefox in [[Safe Mode]] to check if one of the add-ons is causing the problem (switch to the DEFAULT theme: Tools > Add-ons > Themes).
    * Don't make any changes on the Safe mode start window.
    See:
    * [[Troubleshooting extensions and themes]]
    * [[Troubleshooting plugins]]
    If it does work in Safe-mode then disable all extensions and then try to find which is causing it by enabling one at a time until the problem reappears.
    * Use "Disable all add-ons" on the [[Safe mode]] start window to disable all extensions.
    * Close and restart Firefox after each change via "File > Exit" (Mac: "Firefox > Quit"; Linux: "File > Quit")

  • TS1363 my ipod shows up in My Computer...until ITunes opens

    my ipod shows up in My Computer and the E drive...until ITunes opens. Then the ipod disappears and ITunes says it can't identify it and the ipod disappears from My Computer.  I have Windows 8.1.  I have uninstalled and reinstalled ITunes.  I've shut off the ipod service and turned back on.  I've reset the ipod settings.  Basically, I've worked through all the suggestions from the website and nothing has solved the problem.

    I have exactly the same situation except that my IPAD2 also disappeared from ITunes.
    I managed to resolve the IPAD by re-installing the device driver specifying C:\Program Files\Common Files\Apple\Mobile Device Support\Drivers\usbaapl64.inf and as soon as I had done that the IPAD re-appeared in ITunes.
    I cannot get the IPOD to work though. Windows insists on seeing it as a disk drive and if I try to install usbaapl64.inf as above I just get an error message saying it is not a compatible device.
    I can access the IPOD and see video/photos etc until I run ITunes. Before running ITunes the IPOD is identified as a device with the correct name. As soon as ITunes runs the name disappears and it shows simply as "E:"
    I've run out of ideas now so I'm hoping that someone comes up with a solution.

  • Window doesn't open window all the way using "+" sign

    I made the switch from Windows to Mac a few years back and besides not having a HDD activity light, the biggest pet peeve I have about Apple's OS's is that they don't allow you to click on the "+" sign in the upper left hand corner of an open window to get the window to open fully or maybe it's a trick that I haven't been taught. I works when you use it while using "TextEdit" but not on other applications that I've used. They added that feature to Safari for Windows so I'm sure that it would be no problem to insert that line of code in Leopard or Tiger that would take care of that. It would be moot point to ask Apple why so my question is, does anyone know of a 3rd party app. that does that job for you? The only reason I'm asking is because it's a real time saver for me and I'm sure for a lot of others.

    firstmacnewbie,
    I'll explain the issue, even though it doesn't help you. You see, Windows does a few things as a result of historic deficiencies that it has had. Just so we're clear, these deficiencies are no longer present in modern versions of Windows, but Windows users are accustomed to the little quirks that accompany them- all of which still exist in Windows- nonetheless.
    Most of these issues relate to Windows' historic lack of multi-tasking. In your case, you are used to the behaviors of a machine and OS that will only display one window at a time, one application at a time (again, this is historically, but the tendencies still exist). When Windows would only display one application window, users got into the habit of viewing and using only one thing at a time.
    Another glaring difference that springs from the same historic lack of multi-tasking is the use of "cut and paste" for file system objects. Because Windows would only display one "snapshot" of the file system, in one window, some "workaround" had to be invented to allow users to move files from one place to another. Thus "cut and paste." Because the Mac OS has almost always been able to display multiple windows, and has almost always had drag and drop functionality, user were able to simply drag files from one place to another. No "cut and paste" was needed. Keep in mind that "cut and paste" is an abstract concept, not related to reality, while drag and drop is very much intuitive and realistic (when you want to move a real object somewhere, you cannot simply toss it up in the air, trusting that it will stay in some abstract "ether" until its destination is convenient. No, you must physically move it from the first place to the second, holding it in the meantime).
    Getting back to your specific issue: You would be better served by getting used to the way things are in Mac OS, which is designed around the concept of having and using multiple open windows. This precludes opening windows up beyond their reasonable usefulness. This is especially true with today's modern displays, which sport high resolutions and large amounts of Desktop "real estate." I actually have my Safari window opened up a little beyond what is necessary to display any and all web pages, and it still consumes not much more than half of my display. Why would I want to open it more (it wouldn't show any more of any web page), hampering my ability to access either the Finder or some other application? Why would you? Again, you would be better served by "unlearning" your Windows habits.
    Scott

  • Opening windows media player

    Hi all, I am having a problem with opening downloaded files. I downloaded the windows media player for mac os from the microsoft website. The players icon is on my desktop. How the hec do I run it?? When I doubleclick on it it says script editor cannot open the file. When I clicked info in the finder window it shows script editor as the default. When I click on OPEN WITH in the finder I cannot find an app to open this.
    I guess it's obvious I am trying to learn some of the basics of my mac. I am new to mac, but any help would be greatly appreciated. Thank you.

    This topic has appeared on this forum a gazillion times. But alright....you can;t help it....I guess it's a whole different world after having switched from PersonalCrap to Mac. You have to open the file with Stuffit (which you can also download from the net). Just from now on.....make sure you download Mac versions concerning programs. So look for Stuffit for Mac as there is also a version for Windows (or so I heard).
    Good luck

  • Safari wont load page until i open a new tab?

    this happens on my new macbook pro and my super old mac mini
    when i open a new safari window and it goes to "top sites" then google search or input a web address
    it doesn't actually start searching or going to the web address until i open a new tab.
    its weird.. i hope im making sense because im not sure how else to explain it..
    both macs are using safari 4
    any help or fix? if i dont make sense ill try to explain it another way.. lol

    See if you can try this before Safari crashes ...
    From your Safari menu bar click Safari > Preferences then select the Extensions tab. If there are any installed, turn that off, quit and relaunch Safari to test.
    If it's not an extensions issue, try troubleshooting Safari third party plugins.
    Back to the menu bar click Safari > Preferences then select the Security tab.
    Deselect:  Enable plug ins
    Quit and relaunch Safari to test. If that made a difference, then follow the instructions for troubleshooting add ons here.

Maybe you are looking for

  • How to specify COMPRESS FOR OLTP on a table in physical model?

    Hi, we have licensed Oracle's Advanced Compression and want to use the OLTP compression on some tables. I am looking for a way to specify COMPRESS FOR OLTP on a table in the physical model. So far, I can only set "Data Compression" to YES or NO. Are

  • Shipping tab in PO

    Dear Aspitants, While creating Purchase Order for Stock Transport Order Shipping Tab is not reflecting. Please Guide me. Thanks&Regards

  • Merging Script for Sequences of Pictures

    Hi, from my panorama rendering passes, I receive picture sequences (picture.0001.png, picture.0002.png ...), where I need to * import each pic of the sequence, * crop it with a fixed value * place all next to each other from left to right and then *

  • Regarding US Address cleansing directories

    Hi , I have US address cleansing directories to cleanse US address data .  But directories are working on some systems and not working in some sytems. All system config and environment are same. Is any issue in this directories. Thanks & Regards, Ram

  • Crash during update. Now pacman creates ldconfig errors.

    When I was updating kde yesterday my laptop froze. I switched it on again and deleted the lock file for pacman. I did a obligatory pacman -Syu and everything went fine except for ldconfig: File /usr/lib/libkwalletbackend.so.4.11.0 is empty, not check