PCBUILD Archives

Personal Computer Hardware discussion List

PCBUILD@LISTSERV.ICORS.ORG

Options: Use Forum View

Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Jacob Smith <[log in to unmask]>
Reply To:
Personal Computer Hardware discussion List <[log in to unmask]>
Date:
Tue, 10 Jun 2014 12:00:21 -0500
Content-Type:
text/plain
Parts/Attachments:
text/plain (72 lines)
I'm trying to create an Applescript using a similar algorithm that I used
for the previous script I made for Windows. I'm sort of walking in the dark
with Apple script. I want to check if a file exists, then rename it if it
does, or rename a different file if it doesn't. Here's what I have so far,
I'm sure it won't work, but it should show you what I'm trying to do.

FileExists

if active = "true" then

tell appliation "Finder"

set theFile to (desktop as text) &
"MySSD!/System/Library/Extensions/file.kext" as alias

set the name of theFile to "MySSD!/System/Library/Extensions/file.waskext"

set theFile to (desktop as text) &
"MySSD!/Library/LaunchDaemons/file.plist" as alias

set the name of theFile to "MySSD!/Library/LaunchDaemons/file.wasplist"

end tell


else


tell appliation "Finder"

set theFile to (desktop as text) &
"MySSD!/System/Library/Extensions/file.waskext" as alias

set the name of theFile to "MySSD!/System/Library/Extensions/file.kext"

set theFile to (desktop as text) &
"MySSD!/Library/LaunchDaemons/file.wasplist" as alias

set the name of theFile to "MySSD!/Library/LaunchDaemons/file.plist"

end if



on FileExists(System/Library/Extensions/file.kext) -- (active) as Boolean

    tell application "System Events"

        if exists file theFile then

            return true

        else

            return false

        end if

    end tell

end FileExists

--
 Blessings,
Jacob Smith

Blessed are those who fear the Lord, who walk in his ways. Psalm 128:1

                          PCSOFT's List Owners:
                      Bob Wright<[log in to unmask]>
                        Mark Rode<[log in to unmask]>

ATOM RSS1 RSS2