applescript

Click on safari web page button using AppleScript

给你一囗甜甜゛ 提交于 2019-12-06 14:36:21
I'm trying to figure out how to click on the button in a webpage. For example click on the "I'm Feeling Lucky" button in google web page. This is what I have tried: tell application "Safari" make new document with properties {URL:"https://www.google.com/"} do JavaScript "eval(document.getElementById('I'm Feeling Lucky').parentNode.href.substring(11))" in document 1 delay 1 end tell But it doesn't work. Any of you knows how can I click on the button using applescript? I'll really appreciate your help jweaks Couple things: Best practice in the safari tell block is to also tell document 1. Also,

How to get values from JSON file using AppleScript?

允我心安 提交于 2019-12-06 14:08:23
问题 In reference to this question, How to download and get values from JSON file using VBScript or batch file? how to get the values from JSON file that looks like this, ["AA-BB-CC-MAKE-SAME.json","SS-ED-SIXSIX-TENSE.json","FF-EE-EE-EE-WW.json","ZS-WE-AS-FOUR-MINE.json","DD-RF-LATERS-LATER.json","FG-ER-DC-ED-FG.json"] using AppleScript in MAC OS? Here is part of VBScript code in Windows provided by Hackoo, strJson = http.responseText Result = Extract(strJson,"(\x22(.*)\x22)") Arr = Split(Result,"

How to programmatically make Mac OS X ICNS with 10 different images using sips or other

有些话、适合烂在心里 提交于 2019-12-06 13:58:43
问题 My issue is that i need have. I need to achieve this programmatically. So for mac os x an application icon should have these sizes: I have 10 images. Each one i placed a badge in the right corner, the placement and position of this badge does not scale. So i 10 different images. How to make a ICNS out of this? I thought to use sips, however sips only takes one file and it does all the scalings: http://cc.bingj.com/cache.aspx?q=mac+icns+sips+argument+list&d=5035141870911884&mkt=en-US&setlang

Sending data from AppleScript to FileMaker records

家住魔仙堡 提交于 2019-12-06 13:50:46
I'm computing some data in AppleScript that I'd like to then insert into a specific FileMaker record. Here's my AppleScript: on sendDataToFM(FileNameWithExtension, ClipLength) tell application "FileMaker Pro Advanced" show every record of database 1 show (every record whose cell "File Name" = FileNameWithExtension) repeat with i from 1 to (count record) set MatchingRecord to record i set data cell "CLIP LENGTH" of MatchingRecord to ClipLength end repeat end tell end sendDataToFM ... my sendDataToFM('Some Video.mov', '00:01:22.55') Everything works except the line set data cell "CLIP LENGTH" of

Get modifier keys, which have been pressed while starting an app / applescript

泄露秘密 提交于 2019-12-06 13:32:33
I need to get a list of keys (e.g. the shift key, alt, command ...) which have been pressed when i started an app, especially an ApplesScript on Mac OS X. A shorter form of Mike Woodfill's answer: set {shiftDown, ctrlDown, altDown, cmdDown} to words of (do shell script "python -c 'import Cocoa;m=Cocoa.NSEvent.modifierFlags();print m&Cocoa.NSShiftKeyMask>0,m&Cocoa.NSControlKeyMask>0,m&Cocoa.NSAlternateKeyMask>0,m&Cocoa.NSCommandKeyMask>0'") Note, that you get the modifiers as strings, so you have to compare them like this if (altDown = "True") then ... If you really want boolean modifiers, look

Scriptability (AppleScript) in a Mac Carbon application

元气小坏坏 提交于 2019-12-06 13:25:31
问题 I am trying to add AppleScripting support to my non-Cocoa based application. I'm working the low level functions such as AEGetParamDesc, handling the form / want / seld parameters myself. My vocabulary offers a class, let's call it "Image". It has a property "name". I've gotten some Applescript code working, such as: get Images get name of every Image get count Images get every Image get first Image get Image 1 So, basically, access to both the objects and its properties works. However, when

How do I make a Safari window active using AppleScript (elegantly)?

北城余情 提交于 2019-12-06 13:23:35
While one can simulate command-shift-` using System Events to change windows in Safari, is there no better way to do this with AppleScript? I can change the index of Safari's windows, this changes their ordering on the screen but does not make them active. Suppose you have two Safari windows containing about:blank -- how could you bring the one in the back to the front and make it active? Granted, command-shift-` works, so maybe there only needs to be one way to skin this cat. regulus6633 I also noticed that changing the index does reorder the windows however the new window does not actually

Applescript Error cannot make to unicode text

偶尔善良 提交于 2019-12-06 13:14:19
I'm trying to write a simple applescript script to get the contents of WriteRoom (a simple text editor) and run it through a markdown parser then copy the resulting html to the clipboard: tell application "WriteRoom" to activate tell application "System Events" to keystroke "a" using command down tell application "System Events" to keystroke "c" using command down set the clipboard to (do shell script "cd ~;echo \"" & (the clipboard) & "\" >> writeroom.md; /usr/local/bin/markdown writeroom.md") but when I run it I get an error sometimes : Can’t make {«class RTF »:«data RTF

AppleScript: Create new folder from file name and move file into that folder

旧巷老猫 提交于 2019-12-06 12:10:35
Basically, I'm trying to create a folder action in Automator so whenever a file is added to a specific folder, it will create a subfolder that matches the filename (without the extension), then move the file into that subfolder. So far, I have successfully used a post from this site ( Create new folder named with a specified file name in Automator ) to create a script that will create the new folder. However, I have been unable to modify the script to move the original file into the new folder. Any help would be appreciated. Here is the full script I am working with for reference: on run

Check is phone registered in iMessage

谁都会走 提交于 2019-12-06 11:45:50
I'm trying to check if phone not from my contact list is registered in the iMessage. There is two general approaches that I've tryed. Send message to phone number if it's in buddy list on run argv set toAddress to "+380631111111" set message to "Test" tell application "Messages" set targetService to 1st service whose service type = iMessage set targetBuddy to buddy toAddress of targetService delay 1 if targetBuddy exists then send message to targetBuddy end if #delay 5 end tell end run Why it doesn't work? Even tho it can send messages by removing "delay 1" I don't want to spam users. With