Open 1e finder with folder downloads , Open 2e finder window with Documents folder

Discussion in 'Mac Programming' started by mamekedi, Aug 18, 2012.

  1. mamekedi macrumors newbie

    Joined:
    Aug 18, 2012
    #1
    hello You all,

    i have a applescript script to open 2 finder windows below.
    The problem is that i want to open the 1e finder window with the Downloads folder and the 2e finder window with the documents folder.

    Can somebody help me, see script below


    -- Feel free to copy, modify and redistribute this script any way you like
    -- Be careful to run this "AS IS" script on your machine. I've
    -- tested it and it works on my iMac but if you don't know what you're doing,
    -- you could end up hurting your beloved Mac and the data on it.
    -- Cheers, Loek

    -- This script opens two finder windows side-by-side
    property finderWidth : 900 -- MUST BE SMALLER THEN HALF OF THE ACTUAL SCREEN SIZE!
    property finderHeight : 700

    tell application "Finder"
    set screenBounds to bounds of window of desktop
    set screenWidth to item 3 of screenBounds
    set screenHeight to item 4 of screenBounds
    set centerX to screenWidth / 2
    set centerY to screenHeight / 2
    activate
    set visible of (every process whose visible is true and frontmost is false) to false
    set finder1 to make new Finder window
    set the bounds of finder1 to {centerX - finderWidth div 1, centerY - (finderHeight / 2) div 1, centerX - 2 div 1, centerY + (finderHeight / 2) div 1}
    set the current view of finder1 to column view
    set finder2 to make new Finder window
    set the bounds of finder2 to {centerX + 2, centerY - (finderHeight / 2) div 1, centerX + finderWidth, centerY + (finderHeight / 2) div 1}
    set the current view of finder2 to column view
    end tell
     
  2. kryten2 macrumors 6502a

    Joined:
    Mar 17, 2012
    Location:
    Belgium
    #2
    Try this:

    Code:
    property finderWidth : 900 -- MUST BE SMALLER THEN HALF OF THE ACTUAL SCREEN SIZE!
    property finderHeight : 700
    
    tell application "Finder"
    	set screenBounds to bounds of window of desktop
    	set screenWidth to item 3 of screenBounds
    	set screenHeight to item 4 of screenBounds
    	set centerX to screenWidth / 2
    	set centerY to screenHeight / 2
    	activate
    	set visible of (every process whose visible is true and frontmost is false) to false
    	set finder1 to make new Finder window
    	-- Downloads folder
    	set the target of finder1 to path to downloads folder
    	set the bounds of finder1 to {centerX - finderWidth div 1, centerY - (finderHeight / 2) div 1, centerX - 2 div 1, centerY + (finderHeight / 2) div 1}
    	set the current view of finder1 to column view
    	set finder2 to make new Finder window
    	-- Documents folder
    	set the target of finder2 to path to documents folder
    	set the bounds of finder2 to {centerX + 2, centerY - (finderHeight / 2) div 1, centerX + finderWidth, centerY + (finderHeight / 2) div 1}
    	set the current view of finder2 to column view
    end tell
     
  3. mamekedi, Aug 18, 2012
    Last edited: Aug 18, 2012

    mamekedi thread starter macrumors newbie

    Joined:
    Aug 18, 2012
    #3
    Perfect thank you very much

    Now i want to open in finder window 2 a folder on a mounted drive
    How do i do that
     
  4. mamekedi, Aug 18, 2012
    Last edited: Aug 18, 2012

    mamekedi thread starter macrumors newbie

    Joined:
    Aug 18, 2012
    #4
    Now i want to open in finder window 2 a folder on a mounted drive
    How do i do that :confused:
     
  5. kryten2 macrumors 6502a

    Joined:
    Mar 17, 2012
    Location:
    Belgium
    #5
  6. mamekedi thread starter macrumors newbie

    Joined:
    Aug 18, 2012

Share This Page