記録された内容: tell application "Finder" activate set sort column of list view options of Finder window 1 to creation date column set sort direction of column id creation date column of list view options of Finder window 1 to normal end tell
set sort column of list viewの行で error "Finder でエラーが起きました:ソート列にするには、その列が可視状態である必要があります。" number -10000 と言われてしまいます。 作成日は可視状態です。
set visible of column id creation date column of list view options of Finder window 1 to true
ASは現状をチェックしない、という事ならソレはソレで何で最初ので動かないのか腑に落ちませんが 何とか動いたので良かったです。 お手を煩わせてすみませんでした。 0167名称未設定2018/06/24(日) 19:03:16.31ID:Vmg1bVKi0 GJ! 0168名称未設定2018/07/05(木) 17:27:56.62ID:HQ3dQZRQ0 set the clipboard to "A" & return & "B"
>>174 違ったような気もする、違ったことがあるような気もする。が、なんだったかなあ。 POSIX file "/Users/hoge/Desktop/hoge.jsx" /Users/hoge/Desktop/hoge.jsx" as POSIX file いちおう、得られる結果は同じだな。 class of POSIX file "/Users/hoge/Desktop/hoge.jsx" class of (/Users/hoge/Desktop/hoge.jsx" as POSIX file) としても得られる結果は同じようだが、POSIX file ~ の方はMacintoshパスに書き換えられるから挙動は違うな。まあ、そんなもんということで 01761732018/07/25(水) 09:46:58.52ID:AQuCr0Br0>>175 基本イラレ、インデザインですが、今まで作成したjsxファイルを使ってshellやアプリ間の連携をさせたいので。 今まではASでやっていたのですが、JXAで書けるなら色々とラクなので。 以下のスクリプトを試しましたが、下2つは動作しません。 INDD = Application("Adobe InDesign CC 2018"); INDD.includeStandardAdditions = true; INDD.displayAlert('alert("Hello from the other side")'); INDD.doJavaScript('alert("Hello from the other side")'); INDD.doScript('/Users/hoge/Desktop/hello.jsx'); 0177名称未設定2018/07/25(水) 10:21:49.37ID:CBkLGNxW0 そもそも用語説明ではどう説明されてんのかと 0178名称未設定2018/07/25(水) 18:47:48.83ID:G7md3iPc0>>176 なんだ、AppleScriptをJXAに書き換えられないってだけか Adobeの公開しているAppleScriptドキュメントではInDesignはdo scriptのようだけど、公開しているドキュメントが古くて新しいのはdo javascriptもサポートしてんのか?? と、しょーーーーがないから試用版入れてみたら... InDesignにdo javascriptなんてないやんっ!
-- AppleScript set theResult to {} set savedDemimiters to AppleScript's text item delimiters set AppleScript's text item delimiters to "/" repeat with theURL in input set theItems to every text item of theURL set theResult to theResult & ((items 4 thru -1 of theItems) as string) end repeat set AppleScript's text item delimiters to savedDemimiters return theResult 0197名称未設定2018/08/06(月) 01:14:31.49ID:/TKVSQZZ0 -- AppleScriptObjC use framework "Foundation" set theResult to {} set regex to current application's NSRegularExpression's regularExpressionWithPattern:"^[^/]*//[^/]*/" options:0 |error|:(missing value) repeat with theURL in input set theResult to theResult & {(regex's stringByReplacingMatchesInString:theURL options:0 range:{location:0, |length|:(length of theURL)} withTemplate:"") as text} end repeat return theResult 0198名称未設定2018/08/06(月) 01:15:15.41ID:/TKVSQZZ0 // JXA ObjC theResult = []; regex = $.NSRegularExpression.regularExpressionWithPatternOptionsError('^[^/]*//[^/]*/', 0, $()); input.forEach(function ( theURL ) { theResult.push(regex.stringByReplacingMatchesInStringOptionsRangeWithTemplate(theURL, 0, $.NSMakeRange(0, theURL.length), '').js); }); return theResult; 0199名称未設定2018/08/06(月) 01:15:40.96ID:/TKVSQZZ0 // JXA っ(ていうかただのJavaScript) theResult = []; input.forEach(function ( theURL ) { theResult.push(theURL.replace(/^[^/]*¥/¥/[^/]*¥//, '')); }); return theResult 0200名称未設定2018/08/06(月) 17:22:44.19ID:D9/5MFlz0 本人不在でやっても仕方ないと思うが 0201名称未設定2018/08/06(月) 18:35:19.86ID:/TKVSQZZ0 元に本人はいないからw 単に「発表」的なです 0202名称未設定2018/08/09(木) 14:46:28.17ID:KT1Ue3i80 BathyScaphe向け、画像をimgurに上げるスクリプト macOS Sierra 10.12.6で作成したもの
use framework "Foundation" use scripting additions
set imgUrl to "" set imgFile to choose file of type {"public.image"} default location (path to desktop) without multiple selections allowed set {imgData, |error|} to current application's NSData's dataWithContentsOfFile:imgFile options:0 |error|:(reference) if imgData is missing value then displayError(|error|'s localizedDescription as string) end if set base64Data to (imgData's base64EncodedStringWithOptions:0) as string try set respJson to do shell script "curl " & apiUrl & authHead & " -F image=" & quoted form of base64Data set respRec to run script "JSON.parse(" & quoted form of respJson & ");" in "JavaScript" on error |error| displayError(|error|) end try 0203202のつづき2018/08/09(木) 14:46:58.04ID:KT1Ue3i80 if success of respRec then set imgUrl to link of |data| of respRec set imgDelUrl to apiUrl & "/" & deleteHash of |data| of respRec current application's NSLog("image uploaded to " & imgUrl & "; to delete, do curl -X DELETE " & imgDelUrl & authHead) else displayError(|error| of |data| of respRec) end if
tell application "BathyScaphe" if (count of documents) is not 0 and class of front document is reply document then set text of front document to text of front document & imgUrl return end if end tell display dialog imgUrl buttons {"Cancel", "Copy to Clipboard"} default button 2 cancel button 1 set the clipboard to imgUrl
set {imgData, |error|} 〜 から set respJson to do shell script "curl " を set respJson to do shell script "curl " & apiUrl & authHead & " -F image=@" & quoted form of (POSIX path of imgFile) もしくは set respJson to do shell script "cat " & quoted form of (POSIX path of imgFile) & " | curl " & apiUrl & authHead & " -F image=@-"