0

My question somewhat has 2 parts. I'll give you some background:

I decided to build an AppleScript that pulls old time machine backups when someone's Time Machine isn't recognized. It prompts for the old Username, HDD name, and the external HDD name. Those variables are then put into a ditto script that will run to copy everything to a folder that is created on the desktop using mkdir.

I'm quite new to Xcode, Cocoa and Obj-C so hopefully my questions aren't annoying. First: I'm not really sure if I need to edit the actual code in the frameworks folders e.g., NSAlert.h, NSButton.h, etc...

Second: In the following screenshot I am trying to get the placeholder text to be centered and then when the user inputs information, the user input is justified to the left. I noticed when I run my app, it tries to center everything, including user input. The script I'm using is a script I'm trying to piece together that I've been using from some tutorials I've been going through, but these languages are far different from the CSS, HTML, and AppleScript that I am used to.

Screenie

script AppDelegate

--inheritance
    property parent : class "NSObject"
    property NSTextFields : class "NSTextFields"
--IBOutlets
    property textView: missing value
    property textField: missing value
    property textHdd: missing value
    property textAccount: missing value
    property textExternal: missing value
--IBActions (button clicks)

on setold_account_nameFromtextAccount_(sender)
    set textAccountValue to textAccount's stringValue()
    textView's setString_(textFieldValue)
end setTextViewFromTextField_

And an example of my AppleScript, how the variables will be implemented.

   display dialog "Would you like to copy the" & old_time_name & " directory now?"¬ 
with icon caution with title "Time Machine Extractor" & return buttons {"Cancel", "Copy   Now"}¬ 
default button "Copy Now"
   set theButton to button returned of the result
     if theButton is "Cancel" then
       error number -128
     end if
set shellCopy to "sudo ditto -V /Volumes/" & quoted form of old_time_name & ¬ "/Backups.backupdb/" & quoted form of old_hdd_name & "/Users/" & quoted form of ¬
old_account_name & " ~/Desktop/Backup\\ Files/"

So I think I'm on the right track, but I obviously need some guidance. Thank you!

4

0 回答 0