How to tell Safari to save as a Web Archive

The default "Save" when using a script is to save as "Page Source." How would one write a script to Save as "Web Archive."

01. In 'Safari' - manually, select the 'File, Save As...' menu item. A drop down sheet will appear.
02. Select the 'Format:' Web Archive' menu item.
03. Click on the 'Save' button.
04. Locate the just saved web page, trash it, and empty the trash.
You have now set 'Safari' to save all future 'Save As...'es in the 'Web Archive' format.
05. Use the code (which is supplied with no error trapping) below.
-- Code starts here --
property tURL : "http://www.badcopnews.com/"
tell application "Safari"
activate
make new document at end of documents
set URL of document 1 to tURL
get document 1
end tell
delay 3
tell application "System Events" to tell process "Safari"
keystroke "s" using command down -- 'Command S' - 'Save As...'
delay 1 -- Pause for 1 second.
keystroke "d" using command down -- 'Command D' - Go to 'Desktop'.
delay 1 -- Pause for 1 second.
keystroke "c" using command down -- 'Command C' - Go copy highlighted text.
set the clipboard to ((do shell script ("date +%Y%m%d%H%M%S")) & (the clipboard))
keystroke "v" using command down -- 'Command V' - 'Paste'.
delay 1 -- Pause for 1 second.
click button "Save" of sheet 1 of window 1 -- Click on 'Save' button.
end tell
-- Code ends here --

Similar Messages

  • How to tell Safari to Save As...

    I have the following as which uses URL Access Scripting to download a webpage.
    set the target_URL to "http://jott.com/notes.aspx?page=243"
    set the destination_file to "Macintosh HD:Users:jeffrey:Downloads:jotts:" & "243.html"
    tell application "URL Access Scripting"
    download target_URL to file destination_file replacing no
    end tell
    But unfortunately, this doesn't work with the particular pages I'm using, because the url assumes you're already logged in.
    So what I need is essentially the same thing, but done with safari while already logged in.
    Is there a way to do this?

    Maybe you might try this:
    --BEGINNING OF SCRIPT
    open location "https://jott.com/login.aspx"
    tell application "Safari"
    repeat until (text of front document contains "All Rights Reserved.")
    -- just wait until the page is completely loaded
    end repeat
    delay 1 -- wait a little longer
    end tell
    tell application "System Events"
    keystroke "0123456789" & tab -- your 10 digit phone number
    keystroke "Jeffrey Ellis" -- your password
    delay 1 -- for visual feedback
    keystroke return
    delay 1 -- -- adjust if necessary
    keystroke "l" using {command down}
    keystroke "http://jott.com/notes.aspx?page=243" & return
    delay 3 -- adjust if necessary
    tell process "Safari"
    click menu item "Save As…" of menu 1 of menu bar item "File" of menu bar 1
    repeat until sheet 1 of window 1 exists
    end repeat
    keystroke "243.html"
    keystroke "d" using {shift down, command down} -- save to dekstop
    tell sheet 1 of window 1
    click pop up button 1 of group 1
    click menu item "Web archive" of menu 1 of pop up button 1 of group 1 -- or "Page Source" if you prefer
    click button "Save"
    end tell
    end tell
    end tell
    tell application "Finder"
    set theTargetFolder to "Macintosh HD:Users:jeffrey:Downloads:jotts:"
    set thePath to (path to desktop as string) & "243.html"
    repeat until document file thePath exists
    end repeat
    move document file thePath to theTargetFolder without replacing
    end tell
    --END OF SCRIPT
    Btw, I'm pretty sure there exists a one-line UNIX solution to your problem.

  • How to tell SAFARI to select especific mail service

    Does any one know, how to tell SAFARI to use for example, YAHOO web mail serivice instead of MAC MAIL, when selecting the option MAIL LINK TO THIS PAGE.
    Tks in advanced from México

    Ralphjh,
    An Automator workflow can save the page in a web archive format:
    First download the Save Safari Web Archive workflow.
    I would add two additional actions at the beginning of the workflow, each from Automator's Safari library, so that your final workflow would look like this:
    1) *Get Specified URLs* -- Deselect or use the minus sign to remove the default www.apple.com address. Open your puzzle page in Safari, make it frontmost, and click on the Current Safari Page button.
    2) *Display Webpages*
    3) *Run AppleScript* -- No need to modify the existing script.
    4) *Get Selected Finder Items*
    5) *Move Finder Items* -- The desktop is default.
    Save the Workflow as File Format: application, and add it to your Login Items.
    It all may be for naught however. I suspect that upon your return from vacation, you'll be disappointed to find that opening any one of the saved files will only result in opening the current day's puzzle. For example, on Tuesday April 29th, the puzzle linked from the URL you posted opened the puzzle for +that day,+ Puzzle Number 760. A quick look at the 30 Day Killer archive (scroll down the page) reveals that each day's puzzle has its own URL. The actual URL for Puzzle Number 760 is:
    http://www.sudoku.org.uk/DailyKiller.asp?day=29/04/2008
    You'll notice that the URLs for the individual days' puzzles in the Killer Archive differ only in the dates appended to them. You would likely need to find a way to incorporate that pattern into an AppleScript -- correlating the current date to the updated URL.
    Regards, Andrew99

  • How to tell Safari to open and save a web page

    While on vacation, I would like to save a daily puzzle that occurs on a web site that uses the same URL for each new puzzle. Using the Energy Saver Preference panel, I can schedule a daily start up and shut down and add Safari to the Login Items. How would I tell Safari to open that URL and then save the web page to the Desktop?

    Ralphjh,
    An Automator workflow can save the page in a web archive format:
    First download the Save Safari Web Archive workflow.
    I would add two additional actions at the beginning of the workflow, each from Automator's Safari library, so that your final workflow would look like this:
    1) *Get Specified URLs* -- Deselect or use the minus sign to remove the default www.apple.com address. Open your puzzle page in Safari, make it frontmost, and click on the Current Safari Page button.
    2) *Display Webpages*
    3) *Run AppleScript* -- No need to modify the existing script.
    4) *Get Selected Finder Items*
    5) *Move Finder Items* -- The desktop is default.
    Save the Workflow as File Format: application, and add it to your Login Items.
    It all may be for naught however. I suspect that upon your return from vacation, you'll be disappointed to find that opening any one of the saved files will only result in opening the current day's puzzle. For example, on Tuesday April 29th, the puzzle linked from the URL you posted opened the puzzle for +that day,+ Puzzle Number 760. A quick look at the 30 Day Killer archive (scroll down the page) reveals that each day's puzzle has its own URL. The actual URL for Puzzle Number 760 is:
    http://www.sudoku.org.uk/DailyKiller.asp?day=29/04/2008
    You'll notice that the URLs for the individual days' puzzles in the Killer Archive differ only in the dates appended to them. You would likely need to find a way to incorporate that pattern into an AppleScript -- correlating the current date to the updated URL.
    Regards, Andrew99

  • How to tell Safari .csv is legitimate extension?

    One of our users has to download tons of .CSV files each day, and prior to our upgrade to Tiger, she had no trouble.
    But now, every time she goes to download a .CSV file, Safari adds a .txt to the end of the file name. Then she has to manually remove the .txt, and even then Safari complains
    "The name filename.csv appears to have an extension. Do you want to append .txt anyway?" and she has to click on "Don't Append".
    When she has to do this several hundred times in a day, it gets old very quickly. How do we tell Safari that .csv is a legitimate extension and that it doesn't need to add .txt to it?
    Thanks
    various Mac OS X (10.4.8)
    various
    various    

    Jim,
    Two observations:
    1. Firefox downloads .csv files just fine.
    2. When changing the extension, it's not Safari complaining. it's the Finder, right? If you have a bunch of files it's easy to change using a WYSIWYG app like A Better Finder Rename.
    G4 933 mhz Quicksilver   Mac OS X (10.4.8)   Wacom Intuos 2 tablet; Epson 2400 Photo; HP Deskjet 6840; LaCie 80gb D2 FWDV

  • How to get Safari to save my cropping in full screen mode?

    Hello,
    In Lion, you can put Safari in Full Screen mode and crop the edges. You can set differents crops for different tabs within Safari, but when you restart safari the crops are reset. How can you save the crops for the tabs?
    Thanks

    Works fine for me.
    Start Firefox in <u>[[Safe Mode|Safe Mode]]</u> to check if one of the extensions (Firefox/Tools > Add-ons > Extensions) or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance).
    *Do NOT click the Reset button on the Safe mode start window or otherwise make changes.
    *https://support.mozilla.org/kb/Safe+Mode
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes

  • How to get Safari to save passwords?

    I went on a website for the first time and Safari asked me if I wanted it to save my username and password, but I accidentally said "never for this site" even though I now want it to save them. Is there a way to change this? I'm using an iPad with iOS7. Thanks!

    OK. Think I found it:
    Settings app > Safari > Saved Passwords > Tap Edit > locate the site on teh list (it will sate "not saved" in the sub heading) > Tap the entry to select it (check mark) > tap Delete.
    After this, when you return to the site and add the login credentials, you should be prompted to save it.
    NOTE: Some sites explicitly prevent saving passwords.

  • Safari 6 "Save As" help...

    I am getting so annoyed...
    I know Safari 6 dropped that "Activiy Window" thing, but I never used that.  I don't care about bootleging a YouTube video, but I am very annoyed that I can "Save As" MP4??
    Cnet offers a download link to their review videos, when you click it the video reloads in a new windows "castfire" or something.  In FireFox or Google Chrome I just go to File - Save As - Format Mp4 and BOOM!
    However, in Safari I can only save as a Web Archive or a Page Source, how can I get more options and what are those two things anyway?
    Respectfully,
    JAC151

    Oh My Gosh!!!
    How did you know how to do that!?!?!
    Do you know how long I have spent googleing how to do that!!!
    Thank YOU!!!
    Does this work with all videos?

  • How can I watch the save password in iPad3 safari ?

    Hello all my apple friends. Please tell me how can I watch the save passwords in my iPad 3 safari.
    I save my password in safari but I want to know how can I watch this password .
    Please suggest me .....

    When you type a letter you can see that letter for a second and then it changes to the dot. That's how it works. I suggest writing the password down first.
    Basic troubleshooting steps  
    17" 2.2GHz i7 Quad-Core MacBook Pro  8G RAM  750G HD + OCZ Vertex 3 SSD Boot HD 
    Got problems with your Apple iDevice-like iPhone, iPad or iPod touch? Try Troubleshooting 101
     In Memory of Steve Jobs 

  • How to make Safari remember my password for sites whiteout promoting me? I mean i don't want to ask me if i want to save the password or not, just save it automatically to my keychain.

    How to make Safari remember my password for sites whiteout promoting me? I mean i don't want to safari ask me if i want to save the password or not, can it just save it automatically to my keychain qhitout asking?

    No. It's a safety feature. Select the appropriate response and the next time you visit, you won't be prompted.

  • How can I have Safari save my opened web pages when I quit so that when I open next time they will be there?

    How can I have Safari save my opened web pages when I quit so that when I open next time they will be there? I can do that in Firefox automatically, but can't seem to find how to do it in Safari.  I'm thinking maybe it's just now possible yet?

    From your Safari menu bar click History / Reopen All Windows from Last Session.
    Or..
    Glims can  re open tabs from a previous session if that helps.
    http://www.machangout.com/
    Compatible with Snow Leopard v10.6 and Safari 5+ and it's free.

  • How do I tell Safari to play a live stream always in QuickTime?

    I like to watch a television station from Eastern Europe that streams live on the internet. When I click on the link, the content plays in Windows Media Player. Recently, purely by fluke, it opened in QuickTime and I really preferred this version. Unfortunately I have been unable to repeat this fluke. There is nothing in Safari, QuickTime, or WMP preferences relevant to this issue. I have inputted the link's URL where QuickTime prompts me, but it does nothing.
    Is there a way I can tell Safari to open the link in QuickTime whenever I select the link?
    (Both my Safari and QuickTime use the latest versions.)

    If the content is playing in Windows Media Player, you will be better off installing Flip4Mac which will allow a Quicktime window to open. Microsoft no longer supports WMP for Macs and recommends all Mac users to use Flip4Mac. This software can be found on Versiontracker and Macupdate as well as the manufactures website for download.

  • AppleScript: Safari - Save As Web Archive

    The title says it all: Can someone tell me please how - most likely via UI scripting, since I can't see anything in the dictionary - I can get Safari to save the front most document as a Web Archive using AppleScript?

    This is one I have recently written that saves all tabs in a window, it remembers the parent folder until next time, and also uses the webarchive  ending when Safari is in doubt. You can set properties for whether you like it to overwrite or not. Please look at Macscripter for any updates.
    property tlvl : me
    # Release 1.0.1
    # © 2012 McUsr and  put in Public Domain under GPL 1.0
    # Please refer to this post: http://macscripter.net/post.php?tid=30892
    property shallClose : false # set this to false if you don't want to close the windows, just saving them
    property dontOverWriteSavedTabs : false # set this to true if you don't want to overwrite already saved tabs in the folder
    script saveTabsInSafariWindowsToFolder
              property parent : AppleScript
              property scripttitle : "SafariSaveTabs"
              on run
                        if downloadWindowInFront() then return 0 # activates Safari
                        local script_cache
                        set script_cache to my storage's scriptCache()
                        set saveFolder to POSIX path of (getHFSFolder({theMessage:"Choose or create folder to save Safari-tabs in.", hfsPath:DefaultLocation of script_cache as alias}))
                        if saveFolder = false then return 0 -- we were obviously mistaken, about what we wanted to do.
                        my storage's saveParenFolderInScriptCache(saveFolder, script_cache)
                        tell application "Safari"
                                  tell its window 1
                                            local tabc, oldidx
                                            set tabc to count tabs of it
                                            if not tlvl's shallClose then
                                                      set oldidx to index of current tab
                                                      tell tab tabc to do JavaScript "self.focus()"
                                            end if
                                            local saveCounter
                                            set saveCounter to 1 -- regulates setting of save folder to only first time in Safari.
                                            repeat while tabc > 0
                                                      local theUrl, theIdx, theProtocol, alreadyClosed
                                                      set {theUrl, theIdx, alreadyClosed} to {URL of its current tab, index of its current tab, false}
                                                      if my isntAduplicateTab(theIdx, it) then
                                                                set theProtocol to my urlprotocol(theUrl)
                                                                if theProtocol is in {"http", "https"} then
                                                                          # save it
                                                                          set saveCounter to my saveCurrentTab(saveFolder, saveCounter)
                                                                else if theProtocol is "file" then
                                                                          # make an alias of it
                                                                          my makeAliasForAFurl(saveFolder, theUrl)
                                                                end if
                                                      else
                                                                if tlvl's shallClose then
                                                                          close current tab
                                                                          set alreadyClosed to true
                                                                end if
                                                      end if
                                                      if not alreadyClosed and tlvl's shallClose then
                                                                close current tab of it
                                                                set tabc to tabc - 1
                                                      else if not tlvl's shallClose then
                                                                set tabc to tabc - 1
                                                                if tabc > 0 then tell tab tabc to do JavaScript "self.focus()"
                                                      end if
                                            end repeat
                                            # move forwards
                                            if not tlvl's shallClose then
                                                      tell tab oldidx to do JavaScript "self.focus()"
                                            end if
                                  end tell
                        end tell
              end run
              to makeAliasForAFurl(destinationFolder, furl)
                        local ti, tids, thefilePath
                        set ti to "file://"
                        set {tids, AppleScript's text item delimiters} to {AppleScript's text item delimiters, ti}
                        set thefilePath to text item 2 of furl
                        set AppleScript's text item delimiters to tids
                        set theFile to POSIX file thefilePath as alias
                        set theFolder to POSIX file destinationFolder
                        tell application "Finder"
                                  make alias at theFolder to theFile
                                  # I don't care if there was one there from before, as it could equally
                                  # be a file with the same name.
                        end tell
              end makeAliasForAFurl
              to saveCurrentTab(destinationFolder, timeNumber)
                        tell application id "sfri" to activate
                        tell application "System Events"
                                  set UI elements enabled to true
                                  tell process "Safari"
                                            keystroke "s" using {command down}
                                            tell window 1
                                                      repeat until exists sheet 1
                                                                delay 0.2
                                                      end repeat
                                                      tell sheet 1
                                                                if timeNumber = 1 then -- We'll set the savepath upon first call
                                                                          keystroke "g" using {command down, shift down}
                                                                          repeat until exists sheet 1
                                                                                    delay 0.2
                                                                          end repeat
                                                                          tell sheet 1
                                                                                    set value of text field 1 to destinationFolder
                                                                                    click button 1
                                                                                    delay 0.1
                                                                          end tell
                                                                end if
                                                                keystroke return
                                                                delay 0.2
                                                                if exists sheet 1 then -- We are being asked if we want to overwrite already saved tab
                                                                          if dontOverWriteSavedTabs then
                                                                                    keystroke return # if it was already saved. We don't overwrite it
                                                                                    click button 3
                                                                          else
                                                                                    keystroke tab
                                                                                    keystroke space # we are  to overwrite
                                                                          end if
                                                                else
                                                                          try
                                                                                    set dummy to focused of sheet 1
                                                                          on error
                                                                                    # click button 1 of panel of application "Safari"
                                                                                    keystroke return
                                                                                    delay 0.2
                                                                                    if exists sheet 1 then -- We are being asked if we want to overwrite already saved tab
                                                                                              if dontOverWriteSavedTabs then
                                                                                                        keystroke return # if it was already saved. We don't overwrite it
                                                                                                        click button 3
                                                                                              else
                                                                                                        keystroke tab
                                                                                                        keystroke space # we are  to overwrite
                                                                                              end if
                                                                                    end if
                                                                          end try
                                                                end if
                                                      end tell
                                            end tell
                                  end tell
                        end tell
                        set timeNumber to timeNumber + 1
                        return timeNumber
              end saveCurrentTab
              on downloadWindowInFront()
                        tell application "Safari"
                                  activate
                                  set tabCount to count tabs of its window 1
                                  if tabCount < 1 then
                                            tell application "SystemUIServer" to activate
                                            activate
                                            return true # Downloads window or somethingelse
                                  end if
                        end tell
                        return false
              end downloadWindowInFront
              on isntAduplicateTab(idxOfCurrentTab, theWin)
                        using terms from application "Safari"
                                  tell theWin
                                            set curTabname to name of tab idxOfCurrentTab
                                            set curTabUrl to URL of tab idxOfCurrentTab
                                            repeat with i from (idxOfCurrentTab - 1) to 1 by -1
                                                      if name of tab i = curTabname and URL of tab i = curTabUrl then return false
                                            end repeat
                                            return true
                                  end tell
                        end using terms from
              end isntAduplicateTab
              on getHFSFolder(R) -- Returns hfsPathAsText
                        -- R : {Amessage:theMessage,hfsPath:aStartPath}
                        local new_path, failed
                        set failed to false
                        tell application "SystemUIServer"
                                  activate
                                  repeat while true
                                            try
                                                      set new_path to (choose folder with prompt (theMessage of R) default location (hfsPath of R) without invisibles) as text
                                            on error e number n
                                                      if n is -128 then
                                                                set failed to true
                                                                exit repeat
                                                      end if
                                            end try
                                            exit repeat
                                  end repeat
                        end tell
                        if failed is true then
                                  return false
                        else
                                  return new_path
                        end if
              end getHFSFolder
              on urlprotocol(anUrl)
                        # returns the protocol of an Url, i.e. http, https, file, localhost etc.
                        local tids, theProtocol
                        set {tids, AppleScript's text item delimiters} to {AppleScript's text item delimiters, "://"}
                        set theProtocol to text item 1 of anUrl
                        set AppleScript's text item delimiters to tids
                        return theProtocol
              end urlprotocol
              to parentfolder for aPath
                        local colons, slashes, origDelims
                        set {colons, slashes} to {false, false}
                        if (offset of ":" in aPath) > 0 then set colons to true
                        if (offset of "/" in aPath) > 0 then set slashes to true
                        if colons and slashes then
                                  return null
                        else if colons then
                                  set origDelims to ":"
                        else if slashes then
                                  set origDelims to "/"
                        else
                                  return null
                        end if
                        local tids
                        set {tids, AppleScript's text item delimiters} to {AppleScript's text item delimiters, origDelims}
                        if aPath = "/" then
                                  -- we return root when we get root
                                  set AppleScript's text item delimiters to tids
                                  return "/"
                        end if
                        local theParentFolder
                        if text -1 of aPath is in {":", "/"} then
                                  set theParentFolder to text items 1 thru -2 of text 1 thru -2 of aPath
                        else
                                  set theParentFolder to text items 1 thru -2 of aPath
                        end if
                        set theParentFolder to theParentFolder as text
                        if slashes and theParentFolder = "" then set theParentFolder to "/"
                        -- sets the root path if we got a folder one level below it
                        if colons and (":" is not in theParentFolder) then set theParentFolder to theParentFolder & ":"
                        -- we return volumename, if we are given volumename
                        set AppleScript's text item delimiters to tids
                        return theParentFolder
              end parentfolder
              script storage
                        property cachespath : ((path to library folder from user domain as text) & "caches:" & "net.mcusr." & scripttitle)
                        on scriptCache()
                                  local script_cache
                                  try
                                            set script_cache to load script alias (my cachespath)
                                  on error
                                            script newScriptCache
                                                      property DefaultLocation : (path to desktop folder as text)
                                                      # edit any of those with default values
                                            end script
                                            set script_cache to newScriptCache
                                  end try
                                  return script_cache
                        end scriptCache
                        to saveScriptCache(theCache)
                                  store script theCache in my cachespath replacing yes
                        end saveScriptCache
                        to saveParenFolderInScriptCache(theFolderToSaveIn, script_cache)
                                  local containingFolder
                                  set containingFolder to (parentfolder of saveTabsInSafariWindowsToFolder for theFolderToSaveIn) & "/"
                                  local theLoc
                                  set theLoc to POSIX file containingFolder as alias
                                  set DefaultLocation of script_cache to theLoc
                                  my saveScriptCache(script_cache)
                        end saveParenFolderInScriptCache
              end script
    end script
    tell saveTabsInSafariWindowsToFolder to run

  • How to tell embedded jinitator applet is still running when window closed

    Hello, we are trying to accomplish the same thing that is mentioned in this post from Metalink. I've searched for a solution and hope someone here can help. Instead of restating the issue I think David Wilson does a good job of explaining what is needed. Can anyone please suggest a possible solution?
    From: David Wilton 07-Oct-05 01:08
    Subject: How to tell embedded jinitator applet is still running when window closed
    How to tell embedded jinitator applet is still running when window closed
    Hi,
    We run an oracle 10g forms application through 9iAS over an intranet. All users are running windows 2000 professional.
    We run separate frame = true but I would like to switch to separate frame = false
    With separate frame = true if the user clicks the outer windows "X" close button (forms mdi window) the user is prompted to save changes before the application ends.
    BUT
    when using separate frame = false
    If the user clicks the upper window "X" button (no longer form mdi window but regular browser window) the window and application is abruptly closed.
    I'm interested in using a onbeforeunload function to confirm if the user wants to close the window. This would be placed in the basejini.htm file. This could always ask if the user wants to exit or not. If they click OK then the window closes but if they click "Cancel" you are returned to the forms application exactly where you left. something like event.returnvalue="do you really want to exit?";
    However if the user exited using the normal exit form method then the applet is already closed before the onbeforeunoad event fires and there is nothing to go back to and I want the window to close automatically. This is accomplished using close.html file in post forms trigger.
    So what I want and what I think many may also want is the check if the embedded applet is still running and if so prompt the user to return to the application or continue to close. Of course If the applet is no longer running then just close because there is no reason confirm closing anymore.
    Does anyone have a html/JavaScript solution that can be placed in the jinitiator.htm file? or similar?
    Thank you
    David
    [email protected]
    From: Andrew Lenton 07-Oct-05 08:58
    Subject: Re : How to tell embedded jinitator applet is still running when window closed
    I don't know if this is exactly what you are after but you can add the following to the top of your basejini.htm file and it should prompt the user before exiting the IE window.
    <BODY %HTMLbodyAttrs%>
    %HTMLbeforeForm%
    <SCRIPT>
    <!--
    window.onbeforeunload = unloadApplet;
    function unloadApplet(){
    message = "Warning! Please exit the Java Applet prior to
    exiting the browser"
    return message;
    //-->
    </SCRIPT>
    From: Oracle, mohammed pasha 07-Oct-05 09:55
    Subject: Re : How to tell embedded jinitator applet is still running when window closed
    David,
    Well I could not understand your complete requirement.
    Refer to Note.201481.1 How to Close the Browser Window When Closing Forms And How to Simulate SeparateFrame By Javascript
    Note.115905.1 How to Close Browser Window When Closing Webforms Applet
    Kind Regards,
    Anwar
    From: David Wilton 07-Oct-05 14:37
    Subject: Re : How to tell embedded jinitator applet is still running when window closed
    Thank you for your reply and yes you did not understand my question fully.
    Sorry if this is a long reply
    I am able to close the browser window using information in notes 115905.1 and 201481.1, this is not the issue. We implemented this several years ago. It is workable for both separate frame = true or false.
    It is most important to not allow the user to end their forms application by closing the windows browser, they must close using normal form exit commands.
    What I want is to have separate frame = false, the big drawback to this option is the user can exit the application and bypass all forms code by pressing the windows "X" close button. This is why we need the code as just provided by Andrew Lenton above in this thread.
    BUT Andrew's code will always prompt the user before closing the window and I do not want that. I want the user to be prompted only under scenario 2 listed below.
    Here's the 2 case scenario for exiting the application.
    1. If the user closes properly and uses exit form which fires all normal form triggers including post_form with it's call to close.html file.
    All uncommitted changes are saved or rollback and the users session is ended normally both on the database and in the application server.
    All browser windows will close, great all is good. And without Andrew's code the window will close but with Andrew's code the user will be prompted to close or not, if they select Cancel the window will remain but the applet has already ended so why prompt? ...This is what I want to avoid.
    2. In the forms app. if the user clicks the windows "X" close button with uncommitted changes. The browser just closes the changes are rollback without prompting the user to save. The users sessions are now lost and still running in the database and application server until they are timed out.
    If I use Andrew's code then the user will be prompted to continue to close or go back, if they click Cancel to go back then focus returns to the forms application and the user can continue to work. If the user clicks OK then the window closes and unfortunately their sessions are still lost until timed out.
    So what I desire is to add to Andrew's code to check if the embedded applet is still running and prompt the user to close or not accordingly.
    Something like:
    Basejini.htm like
    </HEAD>
    <SCRIPT LANGUAGE="JavaScript">
    function maximizeWindow()
    window.moveTo(0,0);
    window.resizeTo(screen.availWidth,screen.availHeight);
    function confirm(){
    If(document.embeddedapplet.closed())
    Win.opener = self;
    win.close();
    Else if
    event.returnValue = "Closing Forms Application. OK to continue?";
    </SCRIPT>
    <BODY %HTMLbodyAttrs%, onload="maximizeWindow()", onbeforeunload="confirm()">
    %HTMLbeforeForm%
    I hope this explains my requirements.
    David
    From: Oracle, Evelene Raechel 10-Oct-05 06:45
    Subject: Re : How to tell embedded jinitator applet is still running when window closed
    Hi,
    Note.199928.1 How to Alert User on Closing Client's Browser Window in Webforms
    Regards,
    Rachel
    From: David Wilton 11-Oct-05 17:40
    Subject: Re : How to tell embedded jinitator applet is still running when window closed
    I'm sorry this is not helpful at all.
    Note 199928.1 is only an alert which does not stop the closing of the window and still displays as an alert if the user does close properly using exit form ... so why would you want to display the alert then?
    This is exaclty what I do not want and why I want to determine if the applet is still running before displaying any kind of message.
    David
    From: Oracle, Evelene Raechel 17-Oct-05 12:23
    Subject: Re : How to tell embedded jinitator applet is still running when window closed
    Closing thread.
    Thanks,

    Hello,
    I had the same issue last year - wanting to provide a warning on closing the browser, but only if the Forms session is still running. The approach I took is described below, see also the thread where I originally posted this at Closing brower window
    Hi there,I've had a similar requirement - or rather, the two conflicting requirements: to warn when the browser is being closed, but for the app to be able to close the browser without a warning being fired.
    To always provide a warning when someone (the user or the Forms app) tries to go to a different page (e.g. your close.htm), use Javascript like:
    function confirmExit(){
    if(appletRunning==true) {
    msg="Closing this window or navigating to another page will end your SomeGreatApp session.";
    window.event.returnValue=msg;
    And make a call to confirmExit() in the onBeforeUnload event of your main page.
    You'll notice I first check an 'appletRunning' variable before displaying the warning. This Javascript variable is set to true by my app when it starts up, using an embedded Javabean that calls out to Javascript. Once that variable is set to true, then the warning will be displayed if the user tries to shut the browser by clicking on the 'x' button, or to go to a different URL.
    When my app is shutting down, it uses the same Javabean to set appletRunning back to false. It then navigates to a close.htm - which will be done without a warning being displayed.
    See Re: How can a Javabean call Javascript function of the basejpi.html?? for example code on how to call Javascript from a bean embedded in your Forms app.
    Hope these ideas help you out, it's worked for me (so far, anyway!!)
    James

  • How do I find and save the background music file of my Flash site?

    I see that the background music in my Flash site is located in a symbol called muz.  When I click the properties of this symbol, the sound file's location is listed as .\flash\sound\muz.wav  I couldn't find that sound sub-folder in the flash folder nor could I find the file.  I tried doing a search to look for the muz.wav file in my computer but it could not be found.  Does anyone know how I can find and save this file?  Can the symbol somehow be exported and the sound file be extracted that way?

    I copied and pasted the symbol into an empty .fla file.  This new .fla file is just 1 frame.  Can you tell me what you mean by "spreading" it along the timeline?  When I tried exporting it to a .wav file (as just 1 frame in timeline), I only hear a fraction of a fraction of the first note of the music in the generated .wav file.  The music is heard fine in its entirety when previewing the .fla file (F12).
    By the way, in the symbol's properties, there is an option to "Export for ActionScript" and an option to "Export for runtime sharing".  Do you think any of these would work?

Maybe you are looking for