Help with applescript to unmount disk when putting laptop to sleep

Could some kind soul please help me a bit with some applescript?
I would need two things in applescript:
1. A way to check whether a certain external (firewire) disk is mounted
(so that I can unount, er, eject it, if it is there)
2. A way to make an applescript being executed whenever the laptop goes to sleep.
For the interested reader:
what I want to do is to write an applescript that would automatically unmount my external backup disk whenever the laptop goes to sleep.
Oftentimes I forget to do that myself, then, when the computer is asleep and I want to unplug everything to take it home, I remember that I haven't properly ejected the backup disk ...
Any hints, pointers, tips will be appreciated!
Best regards,
Gabriel.

Thanks a lot for your response
It's easy to check disks by name:
but it's not as easy to determine if the named disk is really the FireWire drive you're looking for, or just some other disk named the same.
Ah, that's OK for me, because I will always give the disks unique names.
2. A way to make an applescript being executed whenever the laptop goes to sleep.
This is harder to do. There is no hook in the system to call a script on sleep (like there is on login or logout),
That's what I was hoping for ...
therefore I don't see any easy way to do what you're asking.
Someone suggested to make a script that does nothing, and which has a handler for the event that the system goes to sleep, and put the eject command there.
But I have no idea how to write such a handler, and how to make the script so that it does not appear in the dock or in the "tab bar", and so that it does not consume CPU power ...
That said, I'm often in the same situation, however, I just pull the FireWire drive anyway, once it's finished going to sleep. Since no data is being read or written there is little or no chance of corruption.
I'd rather be certain
Any ideas?
Regards,
Gabriel.

Similar Messages

  • Automatic unmount when putting laptop to sleep?

    Is there any way I can make my laptop automatically unmount the external harddisk when I put the laptop to sleep?
    That external HD is used as a backup volume with time machine.
    But often times, I forget to unmount it (eject it) before I put the computer to sleep; then I unplug the HD (connected via firewire). Consequently, when I wake the laptop, it complains about an external disk having been disconnected in an unorderly fashion.
    So, any ideas (pointers, applescripts, etc.) that would solve this will be highly appreciated.
    Regards,
    Gabriel.

    Does nobody else have the same problem?
    I.e., do all other people always remember to unmount the external hard disk? or do they just not care about the warning afterwards?
    Regards,
    Gabriel.

  • Hi i need help with applescript to stop downloads when vpn fails

    I am an apple script novice, I would like to be able to have a script run all the time to detect vpn failures and close transmission when this happens:
    so far:
    on idle
              do shell script "ifconfig -lu"
              if "ifconfig -lu" contains "tun0" then
              else if "ifconfig -lu" does not contain "tun0" then
                        tell application "System Events"
                                  tell application "Transmission"
                                            quit
                                  end tell
                        end tell
              end if
    end idle
    it closes transmission and nothing else.  tun0 is my vpn interface and seemed the most fireproof way of understanding the state of the vpn connect.  When VPN is down tun0 doesnt exist.  Please help.
    many thanks

    There are several things wrong with your script.
    First, the glaring one:
              if "ifconfig -lu" contains "tun0" then
    This will never, ever, ever be true. What you're asking AppleScript is whether the string "ifconfig -lu" contains the string "tun0". Never going to happen. Not even close.
    What you really mean is whether the output of the shell command 'ifconfig -lu' contains 'tun0'. The easiest way to do that is to capture the output of the do shell script command in a variable and then test the variable, not the literal string:
    set activeInterfaces to do shell script "ifconfig -lu"
    if activeInterfaces does not contain "tun0" then
      -- stuff goes here
    end if
    Now AppleScript runs the shell script and puts the result in activeInterfaces which you then test to see if it contains (or, in this case, does not contain) the string you're looking for.
    Note that I've also reworked your if statement.. there's no need to have an empty 'if' clause followed by an else if that checks the opposite... by definition if the first one fails the second one will be true.
    Also note that there's no need to tell System Events to tell another application to quit - you can just do that directly.
    Next up is that you don't exit your own script after you quit Transmission. So now you have the scenario where the VPN drops, your script detects it and tells transmission to quit. However, your script keeps running so it then rechecks whether the tunnel is up... since it presumably isn't, it then relaunches Transmission in order to tell it to quit again. Then it rechecks whether the tunnel is up, if it isn't, it relaunches Transmission to tell it to quit... then it rechecks... you get the idea.
    Ideally you should tell your own script to quit after Transmission has exited so that you're not stuck in this loop.
    Lastly you don't include a return value in your idle handler. This means that your idle handler will run every 30 seconds. That might be good enough, or you might want to check more or less frequently. Just return a value indicating the number of seconds to pause between iterations -  realise that the more frequently you check, of course, the more load you put on your system
    Adding that all up you'll end up with something like:
    on idle
              set activeInterfaces to do shell script "ifconfig -lu"
              if activeInterfaces does not contain "tun0" then
                        tell application "Transmission" to quit
                        tell me to quit
              end if
              return 30 -- 30 is default value, but it doesn't hurt to include it here
    end idle

  • I need help with resetting my ichat. When i try to login now it wont let me... it says "AOL Instant Messenger password" and then "iChat can't log in to ... because your login ID or password is incorrect. How do I reset this if I cant log in?

    I need help with resetting my ichat. When i try to login now it wont let me... it says "AOL Instant Messenger password" and then "iChat can't log in to ... because your login ID or password is incorrect. How do I reset this if I cant log in? When I try to press online the same thing pops up and I have no way of logging in or asking for help.

    Hi,
    iChat (it would help to know which version) can accept Apple IDs as valid AIM Screen Names.
    However if you have iChat 5 or earlier you cannot use ones ending in @me.com or @icloud.com issued by iCloud. (they can be used in iChat 6 or Messages as these versions make a double login to AIM and Apple to allow the use of the password).
    In addition if you are using an Apple ID for an AIM Screen Name the password still needs to keep to the 16 character limit that AIM has.
    AN @mac.com name can be used on any version of iChat  (Until the 30th June 2014)
    As it does not need a double check with Apple you can use it to log in to the AIM Web pages
    Login here with an AIM Name registered at AIM or and @mac.com name and see if you get any suspended account messages.
    Sometimes account can be suspended. Usually because something has triggered the "Unusual Activity" item.
    About a year ago many @mac.com users that travelled out of their own country found themselves suspended when they got home.
    If the Name checks out of if an Apple ID the password in known to be 16 characters or Less then do this:-
    In Lion upwards open a Finder Window and use the Go Menu whilst holding down the ALT key.
    Select the Library that appears in the menu list.
    Navigate to Preferences.
    (If you have version earlier than Lion the just navigate to ~/Library/Preferences (that's the Library in you Home - Little House icon - folder)
    Fnd com.apple.ichat.aim.plist (even if you are using Messages)
    Drag the file to the Trash and Restart the app.
    7:39 pm      Thursday; May 29, 2014
    ​  iMac 2.5Ghz i5 2011 (Mavericks 10.9)
     G4/1GhzDual MDD (Leopard 10.5.8)
     MacBookPro 2Gb (Snow Leopard 10.6.8)
     Mac OS X (10.6.8),
     Couple of iPhones and an iPad

  • Hi can anyone help with a mac that had magnet put on it. I turned it on and then off but a white screen appears with a file with a question mark on it?

    Hi can anyone help with a mac that had magnet put on it. I turned it on and then off but a white screen appears with a file with a question mark on it?

    File icon with ? mark on it means it can't read from the hard drive. The hard drive is now wiped or bad. If just wiped then you will need to reinstall your operating system, OS X. If bad you will need to replace the drive.
    Start with booting the computer from the OS X install DVD that came with your system. If the Mac came with Lion Pre-Installed then you use the Lion internet recovery system to reinstall (Hold down Command+r keys or Command+Option+r keys to boot the computer from over the internet to the Lion recovery HD system).
    Good Luck.

  • Hello  I need your help with installing the flash drive into my laptop

    Hi
    I am Rachel Friedman asking for your help with installing the flashdrive player into my laptop.
    Thanks
    Rachel

    To give you any useful advice, I'm going to need to know more about your computer and browser:
    https://forums.adobe.com/message/5249945#5249945

  • Help with applescript to quit certain processes by name?

    Hey, for anyone who knows how to program applescripts well, I could use some help with the script below.
    I'm very new to applescripting and I'm trying to write a script that would automatically quit up to 100 instances of the Google Chrome Renderer process.
    Thanks to google, I found a script similar to what I wanted, and after some tinkering I thought I had it just right. The thing is, if I only set the app_name to Google Chrome, it quits Chrome just fine, but when I try it like this, it doesn't receive any data from grep or awk.
    If anyone can help I'd really appreciate it.
    repeat 100 times
              set app_name to "Google Chrome Renderer"
              set the_pid to (do shell script "ps ax | grep " & (quoted form of app_name) & " | grep -v grep | awk '{print $1}'")
              set new_pid to first word of the_pid
              try
                        if new_pid is not "0" or "1" then do shell script ("kill -9 " & new_pid)
              end try
    end repeat

    try this:
    tell application "System Events"
              set procs to (every process whose name is "Google Chrome Renderer")
              if (count of procs) > 100 then
                        set max to 100
              else
                        set max to count of procs
              end if
              repeat with i from 1 to max
                        tell (item i of procs) to quit
              end repeat
    end tell

  • Help with Applescript - filenames

    Hi!
    I hope there is someone who can help me. I have very little experience with Applescript, and have spent a couple of days scouring these forums amongst others without any luck...
    I have a folder (titled XLS) with about 1000 excel files in it. They are numbered basen on some parametric calculations (1111.xls, 1112.xls, 1113.xls, etc). I have constructed an Automator rutine which, one at a time, can open each excel file, copy some cells and then paste the data into an empty xml-file in TextWrangler. The empty xml-file is also in the XLS folder.
    What I am looking for is an applescript which can rename the open xml-file with the same filename as the xls-file. So, when 1111.xls is open, the xml-file gets renamed 1111-xml; when 1112.xls is open, the xml-file gets renamed 1112-xml, etc. Each new xlm-file is to be saved into a folder XLM, whivh is also in the XLS folder.
    Thanks in advance....
    Rob

    Se below; there are two folders on the desktop; "xls" (with xls-files in) and "xml", as well as the empty Template.xml file. Here it is!:
      --3 XLS to XML
              tell application "Finder"
                        set fileList to every file of entire contents of ("YourHD:Users:You:Desktop:xls" as alias)
              end tell
              repeat with i from 1 to number of items in fileList
                        set currentFile to (item i of fileList)
                        tell application "Microsoft Excel"
                                  set screen updating to false
      open currentFile
      activate currentFile
      activate object worksheet 1
                                  copy range range ("YourRange")
                        end tell
                        tell application "Finder"
                                  copy file "YourHD:Users:You:Desktop:Template.xml" to folder "YourHD:Users:You:Desktop:xml"
                        end tell
                        tell application "Microsoft Excel"
                                  set docName to name of window 1
                        end tell
                        tell application "Finder"
                                  set docName2 to text 1 thru ((offset of "." in docName) - 1) of docName
                                  set theFile to "YourHD:Users:You:Desktop:xml:Template.xml" as alias
                                  set the name of theFile to docName2 & ".xml"
      open file theFile
                        end tell
                        tell application "TextWrangler"
      activate
      paste
      close text document 1 saving yes
                        end tell
                        tell application "Microsoft Excel"
      activate
      close active workbook saving no
                        end tell
              end repeat
              tell application "Microsoft Excel"
                        set screen updating to true
      quit
              end tell
              tell application "TextWrangler"
      quit
              end tell

  • Since downloading latest software update for "numbers", Mac is now extremely slow at loading anything and has trouble playing videos (buffering). Also when put Mac to sleep, it wakes up by itself and then back to sleep, etc. Please help!

    Mac extremely slow since recently downloading latest "numbers" software update. Also Mac when put to sleep, will now wake up by itself and go back to sleep etc, etc. Please Help!

    Macsimple wrote:
    Sorry, I am running version 3.2.2. (1878) for Numbers
    OS X 10.9.4
    OK, thanks. First, open Disk Utility and the Repair Disk Permissions on your internal HD. You can find DU in Applications - Utilitie. After doing so please restart in Safe Mode, this is easily done by holding down the Shift Key on your keyboard when you hear the start up tone, you will see a progress bar appear letting yuo know it's starting in Safe Mode. Then reset the SMC and PRAM, instructions can be found by clicking iMac SMC and PRAM reset. Then retest.

  • FireWire drive unmounting/disapering when computer returns from sleep

    I have a problem since the latest software update 10.4.10
    that my WD 500GB FW800 drive keeps unmounting/disapearing after
    the computer returns from sleep, and subsequently issuing a unclean unmount message!
    Toggling the drive power restores it and so far no data is lost... I hope..

    Well, yesterday I decided to do some troubleshooting to confirm the source of the problem. I connected a different external hard drive using the same USB2 cable that I was using with the problematic WD Mybook. I performed flawlessly and showed no issues with not being accessable after the computer woke from sleep. Next I connected the same drive via Firewire 400. Also no issues. That seemed to confirm that there was a problem with the WD drive! However, just to be sure, I reconected the WD Mybook with the original USB cable and gave it another whirl. It has also been performing flawlessly for the past day!
    Possibilities:
    1 There was minor oxidation on the contacts of the cable or in the drive socket which gave a poor connection resulting in the problem. Removing and replacing the cable several times removed the oxide and restored proper electrical contact and drive operation.
    2 Something in the WD Mybook firmware "reset" when it was unpowered for a few hours, also restoring proper operation. WD's website states that the Mybooks are able to remain in standby mode for long periods of time but that they recommend they be powered down when not in use.
    It would be interesting to see if anyone else can confirm that their Mybooks begin to operate properly after "giving them an unpowered rest" or by cleaning the USB connections.
    I know how to keep my Mybook operational for now, but I will likely have to ditch it when I move to a multi FW bus computer in the future (unless WD can correct their firmware).
    Cheers

  • Help with applescript/workflow/rule that would unflag mail when read (...)

    Here's my scenario:
    I have quite many mail.app rules that automatically filter and file incoming mails from newsletters, SNS, work, friends etc. and they all go in specific mailboxes (200+)
    I also have some rules that I trigger using MailActOn.
    Since with Lion theres now 6 different flags (and that you can rename them) I've included them in the rules actions and set them up to the following categories:
    - To Do
    - To Do Later
    - To File
    - News
    - Personal
    This actually allows me to have these smart mailboxes to appear only when they are flags active.
    Now for the first three I want to keep the flags permanently until I'm actully done with them.
    But for the "news" and "personal" ones I want to have them "unflag" once I read them.
    So to recap, is there a way to systematicall/periodically unflag messages when they are read from specific mailboxes or if they are flagged with a particular flag?
    I'd really appreciate if someone would help me out figure out an adequate solution to what I'd like to achieve.
    I'm not sure if a kind of a combination of either applescript/workflow/rule would actually make it work...

    Here's my scenario:
    I have quite many mail.app rules that automatically filter and file incoming mails from newsletters, SNS, work, friends etc. and they all go in specific mailboxes (200+)
    I also have some rules that I trigger using MailActOn.
    Since with Lion theres now 6 different flags (and that you can rename them) I've included them in the rules actions and set them up to the following categories:
    - To Do
    - To Do Later
    - To File
    - News
    - Personal
    This actually allows me to have these smart mailboxes to appear only when they are flags active.
    Now for the first three I want to keep the flags permanently until I'm actully done with them.
    But for the "news" and "personal" ones I want to have them "unflag" once I read them.
    So to recap, is there a way to systematicall/periodically unflag messages when they are read from specific mailboxes or if they are flagged with a particular flag?
    I'd really appreciate if someone would help me out figure out an adequate solution to what I'd like to achieve.
    I'm not sure if a kind of a combination of either applescript/workflow/rule would actually make it work...

  • Help to eject or unmount disk upon shutdown

    Hello all,
    Please take pity on a newbie and answer what I hope is a really simple script question. This is my first attempt at Apple Script.
    I have searched for a script that will eject (unmount) a disk upon shutdown, but haven't found anything on this board. Do you have a reference to an archived script or an example of such code?
    Background:
    I have a new FireWire drive (Western Digital MyBook). It is OSX compatible, but not well integrated. For example, it should power off when I shut down the computer. It does so, but only if I unmount it first. If you have a similar drive, I should note that this behavior began when I reformatted it to HFS+ (Journaled) from the OEM FAT32. I would like to autmate the un-mounting upon shut-down via an Apple Script.
    I am running OSX 10.3.9 on an E-Mac. As for my programming skills, I used to program in Fortran on both IBM and Unix mainframes, and do some basic Unix system administration tasks. So, I should be able to manage this scripting task if given the right advice.
    Thanks in advance for your help!
    E-Mac   Mac OS X (10.3.9)  
    E-Mac   Mac OS X (10.3.9)  
    E-Mac   Mac OS X (10.3.9)   Western Digital MyBook Firewire Drive

    The issue isn't how to unmount the disk (that's the easy part), the problem is when to trigger it.
    There is no standard mechanism for launching a script at shutdown, so there's no way to tell your script to run prior to the shutdown.
    The best solution I can think of is a stay-open script that sits around doing nothing all day, until it quits. When it quits it unmounts the drive.
    Under normal circumstances you wouldn't quit the script at all - just leave it running, but when the OS tells it to quit as part of the normal shutdown process it does its thing.
    Here's one way of doing it:
    on run
    -- nothing to do here
    end run
    on idle
    return 3600 -- do nothing, and dont' bother me again for an hour
    end idle
    on quit
    tell application "Finder"
    try
    eject disk "diskName"
    end try
    end tell
    continue quit
    end quit
    The 'run' handler is executed when the script is launched, but there's nothing we need to do there.
    The 'idle' handler is run periodically in the background - again, we don't need to do anything here, either. The return value tells AppleScript how long to wait before re-running the idle handler
    The 'quit' handler does the work - as soon as it's called it unmounts the drive, then continues with the normal quit process.
    Of course, there's no checking here to make sure you really are shutting down (vs. just quitting the script manually), so you might want to add some validation (prompt the user, maybe?). You'll notice I wrapped the eject command in a try block - that way it'll fail silently if the disk isn't mounted, otherwise it would post an error dialog "Can't get disk "diskName"".

  • Help with Applescript and Admin Privelages

    I just started using Applestript a few months ago and I can't figure out how to give my script Admin rights. Basically, it turns on and off my internet sharing and file sharing through dialog boxes. I copied and pasted the whole code below if you want to test it, but this is the part that is giving me trouble. There are 4 lines similar to this, the actions that turn on or off the services.
    do shell script "/bin/launchctl load -w /System/Library/LaunchDaemons/com.apple.InternetSharing.plist" with administrator privileges
    I've tried adding "with password _____" and "password_____" but neither worked. Can anyone help me make this script authenticate itself so I don't need to keep typine in my password? I could easily make a keystroke in system events to type it in but it doesn't always ask for it so I don't know how I'd make the script know when it needs to enter the password. any help is much appreciated!
    Some things to clarify: The first shell script is there to invoke the "authentication" dialog so I can sign in once I launch the app and get right into the settings. However, I'd like to make it so the script doesn't even need admin permission to run, or make it somehow have my password built in to it. Security is not an issue, its my personal computer that nobody else has access to so I really don't care if my password is written in the code. Also, if you have any tips on how to streamline the Quit/Hide/Resume dialog I'd appreciate that too. Resume is there because there's a chance I won't have to sign in again if the app does not quit, however more often than not I have to sign in anyways. Thanks again in advance, sorry this post is so long but like I said, I'm pretty new to all this so I don't know exactly what you need to be able to help me.
    The Whole Script:
    -- Variables and Authentication
    set done to "n"
    set quitapp to "no"
    display dialog "Please enter your password to allow Sharing Manager to make changes to your settings." with icon caution
    do shell script "/bin/launchctl unload -w /System/Library/LaunchDaemons/com.apple.AppleFileServer.plist" with administrator privileges
    delay 0.2
    -- Repeats
    repeat while quitapp is "no"
              repeat while done is "n"
      -- Choose Setting
                        display dialog "Choose Setting to Edit" buttons {"Internet", "File Sharing", "Exit"} default button 3
                        set the button_pressed to the button returned of the result
                        if the button_pressed is "Internet" then
      -- Commands for Internet Settings
                                  display dialog "Internet Sharing" buttons {"On", "Off", "Cancel"} default button 3
                                  set the button_pressed to the button returned of the result
                                  if the button_pressed is "On" then
                                            do shell script "/bin/launchctl load -w /System/Library/LaunchDaemons/com.apple.InternetSharing.plist" with administrator privileges
                                  else if the button_pressed is "Off" then
                                            do shell script "/bin/launchctl unload -w /System/Library/LaunchDaemons/com.apple.InternetSharing.plist" with administrator privileges
                                  end if
                        else if the button_pressed is "File Sharing" then
      -- Commands for Sharing Settings
                                  display dialog "File Sharing" buttons {"On", "Off", "Cancel"} default button 3
                                  set the button_pressed to the button returned of the result
                                  if the button_pressed is "On" then
                                            do shell script "/bin/launchctl load -w /System/Library/LaunchDaemons/com.apple.AppleFileServer.plist" with administrator privileges
                                  else if the button_pressed is "Off" then
                                            do shell script "/bin/launchctl unload -w /System/Library/LaunchDaemons/com.apple.AppleFileServer.plist" with administrator privileges
                                  end if
                        else
                                  set done to ""
                        end if
              end repeat
      -- Confirm Quit/Hide
              display dialog "Really quit? You will have to reenter admin info next time." buttons {"Quit", "Hide", "Resume"} default button 1
              if the button returned of the result is "Quit" then
                        set quitapp to ""
              else if the button returned of the result is "Hide" then
                        tell application "System Events"
      keystroke "h" using command down
                        end tell
              else
                        set done to "n"
                        set quitapp to "no"
              end if
    end repeat

    with respect to general improvements, a couple of points:
    If I'm reading this script correctly, it looks like you're putting up an applescript alert and leaving it hanging until it's dismissed.  This is an atypical approach (applescripts aren't really meant to hang around indefinitely waiting for a respons).  If I were doing this I would either go whole-hog and create an applescript application in XCode with a proper interface, or remove the hanging dialog and create a set of toggle scripts that I could use from the script menu.  if you really want to keep the hanging dialog, though, you can streamline it by absorbing the secondary dialogs into the main dialog.  that's like so:
    set netSharingStatus to checkService("com.apple.InternetSharing")
    set fileSharingStatus to checkService("com.apple.AppleFileServer")
    display alert "Current Settings" message "Click to change settings" buttons {"Internet " & netSharingStatus, "File Sharing " & fileSharingStatus, "Exit"} default button 3
    -- choose next action based on the button clicked and the status vairable
    on checkService(service)
              do shell script "launchctl list"
              if the result contains service then
                        return "On"
              else
                        return "Off"
              end if
    end checkService
    using handlers like the above can also streamline the rest of your script.  the following construction means you only have to write the do shell script line once, rather than the four times you currently do, and makes for much cleaner reading.
    if the button_pressed starts with "Internet" then
              toggleService("com.apple.InternetSharing", netSharingStatus)
    else if the button_pressed starts with "File Sharing" then
              toggleService("com.apple.AppleFileServer", fileSharingStatus)
    else
      --exit routine
    end if
    on toggleService(service, currentState)
              if currentState in "On" then
                        set action to "unload"
              else
                        set action to "load"
              end if
              set command to "/bin/launchctl " & action & " -w /System/Library/LaunchDaemons/" & service & ".plist"
              do shell script command user name "adminusername" password "password" with administrator privileges
    end toggleService

  • Help with making start up disk from .dmg image on hard drive

    HI Guys hope you can help i have a .DMG image of my OSX install files and need to know how i burn this onto a dvd so i can use it as a start up disk or do a reinstall.
    Never had to even think about any of this before so an idiots guide would be most useful burned the .dmg image to a disk but it wont work as a start up disk and if i open it once inserted it wont work using the start up disk application within system preferences
    Any help appreciated

    An image of your hard drive? No. A copy of Tiger DVD?
    It could be done under Panther with a program called BootCD, but not Tiger.
    Why? when you can easily clone your system to a FW drive partition and use that as needed. Or use TechTool Pro 4.5.1 to put an "eDrive" on your boot drive or another drive (~7GB) just for emergencies.
    You can use Disk Utility to Restore your boot drive to a disk image and back if you want to store it on another drive and in the event of disaster striking and you need to erase and restore.

  • Need help with internal HD memory problems when using Premiere Pro?

    When using PP I keep loosing memory on my HD.
    Now this seems strange to me since I have every thing, all my video and audio files on external HDs.
    Each time I time I make a new project I end up with less space on my internal HD.
    Information related to these projects is somehow remaining on my internal HD.
    Anyone got any ideas about what I might be doing wrong?
    Dimitrije

    Premiere will slowly compile various files to help the project along, and the default place is usually your internal hard drive. Make sure your scratch disks are pointed to an external hard drive if that is what you want, also, make sure the Media Cache Files are being created on your external as well (and not the default location which is on your local drive).
    Premiere Preferences > Media
    Media Cache Files & Media Cache Database should be changed to an external disk if you don't want them created on your local disk. There are many tutorials and explanations about all of these aspects of Premiere on these forums and from other sources. Hope that helps!

Maybe you are looking for