Where I doing wrong ?

Discussion in 'Mac Programming' started by maxrealqnx, Sep 2, 2011.

  1. maxrealqnx macrumors newbie

    Joined:
    Sep 2, 2011
    #1
    Hi my friends.

    it says always, there is not file. Please help me :eek:



    tell application "Finder"
    set MyName to do shell script "whoami"
    if {exists POSIX file "/Users/" & MyName & "/Library/Preferences/pbs.plist"} then
    try
    display dialog "File Exist" buttons {"OK"} default button 1 with title "Test1" with icon 0
    end try
    else
    display dialog "File Not Exist" buttons {"OK"} default button 1 with title "Test1" with icon 0

    end if
    end tell
     
  2. maxrealqnx, Sep 3, 2011
    Last edited by a moderator: Sep 3, 2011

    maxrealqnx thread starter macrumors newbie

    Joined:
    Sep 2, 2011
    #2
    Thank you for not helping me. Goodbye forever. :p
    Code:
    set MyName to do shell script "whoami"
    set openfile to "/Users/" & MyName & "/Library/Preferences/pbs.plist"
    set pbsplist to POSIX file openfile
    
    tell application "Finder"
    	if {exists pbsplist} then
    		try
    			display dialog "File Exist" buttons {"OK"} default button 1 with title "Test 2" with icon 0
    		end try
    	else
    		display dialog "File Not Exist" buttons {"OK"} default button 1 with title "Test 2" with icon 0
    	end if
    end tell
     
  3. hayesk macrumors 65816

    Joined:
    May 20, 2003

Share This Page