Warum funktioniert dieses AppleScript nicht?
Vorweg:
Ich habe es von ChatGPT erstellen lassen (ja, ich weiß ...), weil ich das selbst nicht kann. Es soll einen Arbeitsschritt im Computerservice vereinfachen.
Die Anforderung ist so definiert:
Das Ergebnis war:
Als Ergebnis kommt aber:
Syntax error: Zeilenende, etc. erwartet, aber Identifier gefunden.
Ist das so schlecht programmiert, oder was spricht gegen den Code?
Falls da jemand eine Idee hat, wäre ich äußerst dankbar.
Ich habe es von ChatGPT erstellen lassen (ja, ich weiß ...), weil ich das selbst nicht kann. Es soll einen Arbeitsschritt im Computerservice vereinfachen.
Die Anforderung ist so definiert:
There is a folder on the desktop named "VMEDaction". Inside is a certificate named "Proxy2.cer". This certicivate needs to be added to keychain.app. Also the URL "http://vmed.test.wap" needs to be added in network settings as path to a proxy server.
Das Ergebnis war:
Show Plain Text
- -- Add certificate to Keychain.app and set it as trusted
- tell application "Keychain Access"
- set certificatePath to POSIX path of (path to desktop folder) & "VMEDaction/Proxy2.cer"
- set newCert to (contents of certificatePath)
- set certRef to add newCert with password "" to keychain "login.keychain"
- set trust settings of certRef to {always trust}
- end tell
- -- Add URL as a proxy server in network settings
- tell application "System Preferences"
- activate
- reveal pane id "com.apple.preference.network"
- end tell
- tell application "System Events"
- tell process "System Preferences"
- delay 1 -- Wait for the pane to be revealed (adjust delay if needed)
- click button "Proxies" of window "Network"
- delay 1 -- Wait for the Proxies tab to load (adjust delay if needed)
- -- Enable Web Proxy (if not already enabled)
- if value of checkbox "Web Proxy (HTTP)" of tab group 1 of group 1 of window "Network" is 0 then
- click checkbox "Web Proxy (HTTP)" of tab group 1 of group 1 of window "Network"
- end if
- -- Add the URL as a proxy server
- set value of text field "Web Proxy Server" of tab group 1 of group 1 of window "Network" to "http://vmed.test.wap"
- click button "Apply" of window "Network"
- end tell
- end tell
Als Ergebnis kommt aber:
Syntax error: Zeilenende, etc. erwartet, aber Identifier gefunden.
Ist das so schlecht programmiert, oder was spricht gegen den Code?
Falls da jemand eine Idee hat, wäre ich äußerst dankbar.