Scripting

RSS for tag

Scripting allows you to automate complex, repetitive, and time-consuming tasks by writing scripts that interact with apps, processes, and the operating system.

Posts under Scripting tag

29 Posts
Sort by:
Post not yet marked as solved
1 Replies
1.1k Views
Hi all, I am trying to find a way to export the content of a .pages file into .xml format. That can be done saving the file to '09 version and then unzipping and working on the xml file. But I would like to do it also with .iwa files. I am trying to find a workaround to translate pages file on windows platform without need to pass through word extension, or the '09 format (in order to reduce DTP at its minimum). I am coding on Python... Thank you so much for any suggestion!
Posted
by
Post not yet marked as solved
2 Replies
2.9k Views
I'm installing texturepacker in ci_post_clone.sh script using below command in Xcode Cloud workflow. ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null ; brew install caskroom/cask/brew-cask 2> /dev/null brew install --cask texturepacker But I'm getting sudo warning in log. ==> Downloading https://www.codeandweb.com/download/texturepacker/6.0.2/TexturePacker-6.0.2.dmg ==> Installing Cask texturepacker sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required ==> Purging files for version 6.0.2 of Cask texturepacker Error: Permission denied @ dir_s_mkdir - /usr/local/Caskroom How can i fix this issue? Any idea or suggestions would be appreciated. Thank You
Posted
by
Post not yet marked as solved
2 Replies
2.4k Views
Hello, i am currently trying to implement a pre build script execution in a package. I am using this tutorial to implement it. But it only shows how to use the pre build feature with an already existing feature. I want to execute a skript on my pc every time i build the project. I can't use apples prebuild skript feature in the build settings because it is a package. Right now my code looks like this: import Foundation import OSLog import PackagePlugin @main struct GenerateLocalizer: BuildToolPlugin {     do {       let commandlineOutput = try shell("./testScript.sh")     } catch {     }     return [.prebuildCommand(displayName: "Generate Strings", executable: PackagePlugin.Path("./scrips/generate_strings.sh"), arguments: [], outputFilesDirectory: target.directory)]   }   func shell(_ command: String) throws -> String {     let task = Process()     let pipe = Pipe()     task.standardOutput = pipe     task.standardError = pipe     task.arguments = [command]     os_log("%{public}@", log: log, task.arguments?.joined(separator: " ") ?? "not found")     task.launchPath = "/bin/zsh"     task.standardInput = nil     try task.run()     let data = pipe.fileHandleForReading.readDataToEndOfFile()     let output = String(data: data, encoding: .utf8)!     return output   } } and my Package file looks something like that       name: "CustomSdk",       dependencies: ["CustomSdk-Objc"],       path: "CustomSdk",       exclude: ["Info.plist", "CustomSdk.podspec"],       plugins: [         .plugin(name: "GenerateLocalizer")       ]     ),     .plugin(name: "GenerateLocalizer",         capability: .buildTool(),         dependencies: ["CustomSdk-Objc"]     ) It gets called properly but when want to write files in my "testScript.sh" it only says: Operation not permitted. Anyone got any ideas how to fix this or is there another way to utitlize custom scripts with custom packages? Greetings Ben
Posted
by
Post not yet marked as solved
4 Replies
1.2k Views
When running the following AppleScript (other portions were removed for clarity)… set newDate to "1/1/1953 00:00 AM" do shell script "SetFile -d " &amp; quoted form of newDate &amp; " " &amp; quoted form of filePath I can change  the created date to any year from 1970 to 2079 but attempting any year outside that range returns unpredictable results.  For instance, using 1/1/1953, the created date became February 6, 2096. But if I enter 1/1/2096 the created date becomes September 3, 2061. Any year between 1970 and 2079 yields the correct result. So, what’s the workaround? I need to be able set the year to any date from 1920 to the present and SetFile apparently can’t handle that range. 
Posted
by
Post not yet marked as solved
1 Replies
1.1k Views
I'm writing a Cocoa app that scripts various functions of the Music app. I'm successfully scripting a number of operations (create playlist, play tracks), but all AirPlay ops (get devices, set device volume) are failing with a permissions error: "-[Music airplayDevices_]: Music got an error: A privilege violation occurred. (error -10004)"Details:I'm using the AppleScriptObjC framework from Swifttargeting Catalina/Music, but have the same failures in Mojave/iTunescode succeeds when not sandboxed - only fails in the sandboxThe entitlements file includes the following: &lt;key&gt;com.apple.security.scripting-targets&lt;/key&gt; &lt;dict&gt; &lt;key&gt;com.apple.Music&lt;/key&gt; &lt;array&gt; &lt;string&gt;com.apple.Music.device&lt;/string&gt; &lt;string&gt;com.apple.Music.user-interface&lt;/string&gt; &lt;string&gt;com.apple.Music.playback&lt;/string&gt; &lt;string&gt;com.apple.Music.playerInfo&lt;/string&gt; &lt;string&gt;com.apple.Music.library.read&lt;/string&gt; &lt;string&gt;com.apple.Music.library.read-write&lt;/string&gt; &lt;string&gt;com.apple.Music.podcast&lt;/string&gt; &lt;/array&gt; &lt;/dict&gt;i.e. all access-groups I could find using "sdef /System/Applications/Music.app". According to the sdef, AirPlay access is controlled by com.apple.Music.playback, which is included above.I assume I need some other entitlement as well, but I can't for the life of me find out what it is.
Posted
by
Post not yet marked as solved
15 Replies
34k Views
Trying to do a CLI build with XCode (using NativeScript).Was working fine a couple days ago. However, now I cannot get past this error when trying to build:DTDeviceKit: deviceType from 7c64d8a014fd573ca3623ef80b158e57e7aea7c5 was NULL2018-05-07 11:57:54.696 xcodebuild[14808:865317] DVTPortal: Service '&lt;DVTPortalViewDeveloperService: 0x7fe4e17686d0; action='viewDeveloper'&gt;' encountered an unexpected result code from the portal ('1100')2018-05-07 11:57:54.696 xcodebuild[14808:865317] DVTPortal: Error:Error Domain=DVTPortalServiceErrorDomain Code=1100 "Your session has expired. Please log in." UserInfo={payload=&lt;CFBasicHash 0x7fe4e242ed70 [0x7fff9115faf0]&gt;Whenever I open XCode and to go preferences-&gt;account, my team account already reports "Session has expired". I log in successfully, then close Xcode, then login again, and once again it says the "Session has expired".Enabled two factor authentication hasn't helped. I get the identical error from two separate machines (Mac Mini and MacBook Air). Using latest High Sierra OS and XCode.My developer accounts logs in fine to the developer portal on Apple's Developer site, iTunes connect, etc..
Posted
by
Post not yet marked as solved
2 Replies
1.8k Views
I have an applescript that works perfectly on my local machine. It opens the file and writes to it and then closes. My Applescript is being tested and saved as a .app so it is an application. When I put the application on my server to test out the user experience it never propely opens the file and gives me this error:"File not open with write permission.Finder got an error: File not open with write permission. (-61)"Why would this work on my local machine and not work after being downloaded from my server? I have tested that my path's are correct and like I mentioned everything works perfectly on my local MAC machine. Here is the section of my Applescript code that seems to be throwing the error:set motionFullPath to ("" &amp; pathEffects &amp; "" &amp; effectPlugin &amp; ":" &amp; theFolders &amp; ":" &amp; motionFiles &amp; "") as string set myFile to open for access file motionFullPath with write permission set endOfFile to (get eof myFile) as number if result &gt; 0 then set theText to read myFile set eof myFile to endOfFile write "&lt;!--uuid:" &amp; theURL &amp; "--&gt;" &amp; return &amp; theText to myFile end if close access myFile
Posted
by
Post marked as Apple Recommended
2.7k Views
I have started to experiment with Xcode UI testing and with in my first few tests, I am observing that the app state is being retained between tests.How I kill the app completely?http://masilotti.com/xctest-documentation/Classes/XCUIApplication.html#//api/name/terminatecommand only seems to put the app in background/suspend it
Posted
by
Post not yet marked as solved
5 Replies
8.2k Views
Hi, Want to get your opinion on using XCUITest via XCode 7 or would you continue to use the Automation instrument in Instruments. With Instruments, I could run both Automation scripts as well as other Instruments such as allocation, leaks etc. Please share your thoughts on your choice.
Posted
by