Simple Unix/Osascript CMDs


Index…

DRC

TestNav

Accuplacer

WorkKeys Asse.

KENN REG

TIES Login

REG Year

Creating Users

Users Permissions

Create a Diskimage

Creating & Supporting OS X Users





Testing

DRC

osascript -e 'tell application "System Events" to keystroke "b"'; \
osascript -e 'tell application "System Events" to keystroke return'
osascript -e 'tell application "System Events" to delay 8'; \
osascript -e 'tell application "System Events" to keystroke "bps"'; \
osascript -e 'tell application "System Events" to delay 8'; \
osascript -e 'tell application "System Events" to keystroke return'
osascript -e 'tell application "System Events" to delay 15'; \
open /Applications/DRC\ INSIGHT\ Online\ Assessments/DRC\ INSIGHT\ Online\ Assessments.app
osascript -e 'tell application "System Events" to keystroke "XyzpBNmQZ"'; \


TestNav
rm -R /Users/reserve/
osascript -e 'tell application "System Events" to keystroke "r"'; \
osascript -e 'tell application "System Events" to keystroke return'
osascript -e 'tell application "System Events" to delay 8'; \
osascript -e 'tell application "System Events" to keystroke "sub"'; \
osascript -e 'tell application "System Events" to delay 8'; \
osascript -e 'tell application "System Events" to keystroke return'
osascript -e 'tell application "System Events" to delay 15'; \

Test
open -a "Safari" http://testnav.com/mn/testnav-7.5.22.44/selfRegistration.htm

Sampler
open -a "Safari" http://bit.ly/1EbP85s

osascript -e 'tell application "Safari" to activate'; \
osascript -e 'tell application "System Events" to keystroke "w" using command down'; \
killall Safari

Pearson Testing Video
https://www.pearsonaccess.com/media/MN/MCA_Student_Directions/module/multiscreen.html


Accuplacer 
osascript -e 'tell application "System Events" to keystroke "r"'; \
osascript -e 'tell application "System Events" to keystroke return'
osascript -e 'tell application "System Events" to delay 8'; \
osascript -e 'tell application "System Events" to keystroke "sub"'; \
osascript -e 'tell application "System Events" to delay 8'; \
osascript -e 'tell application "System Events" to keystroke return'

open -a "Safari" https://www.accuplacer.org/cat

osascript -e 'tell application "Safari" to activate'; \
osascript -e 'tell application "System Events" to keystroke "w" using command down'; \

osascript -e 'tell application "System Events" to keystroke "lowerl"'; \
osascript -e 'tell application "System Events" to keystroke tab'; \
osascript -e 'tell application "System Events" to keystroke "Phoenix53*"'; \
osascript -e 'tell application "System Events" to keystroke return'

 


WorkKeys Asse. (USE FIREFOX)

osascript -e 'tell application "System Events" to keystroke "r"'; \
osascript -e 'tell application "System Events" to keystroke return'
osascript -e 'tell application "System Events" to delay 8'; \
osascript -e 'tell application "System Events" to keystroke "sub"'; \
osascript -e 'tell application "System Events" to delay 8'; \
osascript -e 'tell application "System Events" to keystroke return'
osascript -e 'tell application "System Events" to delay 15'; \

killall Safari;
killall Google\ Chrome;
killall firefox;
killall Secure\ Browser;
killall Pages;
killall Keynote;
killall Adobe\ Photoshop\ CS6;
killall MNSecureBrowser6.2;
killall Microsoft\ Word

open -a "firefox" "https://testregistration.org/rsp/Login.do;jsessionid=
4529cb63c43d6dce24b5fd5644b6f35be0451b0d6444a5fe0cf2c830dd0aba50.e38Lc3qKb3qSbO0MaxmMe0.0?event=go&realm=1129410979" 

osascript -e 'tell application "Safari" to activate'; \
osascript -e 'tell application "System Events" to keystroke "w" using command down'; \

NWEA – MAP

open /Applications/NWEA\ Lockdown\ Browser.app
open /Applications/TestNav.app
osascript -e 'tell application "System Events" to keystroke "r"'; \
osascript -e 'tell application "System Events" to keystroke return'
osascript -e 'tell application "System Events" to delay 8'; \
osascript -e 'tell application "System Events" to keystroke "sub"'; \
osascript -e 'tell application "System Events" to delay 8'; \
osascript -e 'tell application "System Events" to keystroke return'
osascript -e 'tell application "System Events" to delay 15'; \

killall Safari;
killall Google\ Chrome;
killall firefox;
killall Secure\ Browser;
killall Pages;
killall Keynote;
killall Adobe\ Photoshop\ CS6;
killall MNSecureBrowser6.2;
killall Microsoft\ Word


KENN REG


//Launch Browser, URL, 2017Login\\

open -a Safari http://www.tiescloud.net/toas/sr_tsis_login.asp
osascript -e 'tell application "System Events" to delay 7'; \
osascript -e 'tell application "System Events" to keystroke "271"'; \
osascript -e 'tell application "System Events" to keystroke tab'; \
osascript -e 'tell application "System Events" to keystroke "11"'; \
osascript -e 'tell application "System Events" to keystroke tab'; \
osascript -e 'tell application "System Events" to keystroke "School*2016"'; \
osascript -e 'tell application "System Events" to keystroke return'


//KennREG Year\\
osascript -e 'tell application "System Events" to keystroke "2017"'; \
osascript -e 'tell application "System Events" to keystroke tab'; \
osascript -e 'tell application "System Events" to keystroke "0007"'; \
osascript -e 'tell application "System Events" to keystroke tab'; \
osascript -e 'tell application "System Events" to keystroke "02"'; \
osascript -e 'tell application "System Events" to keystroke tab'; \
osascript -e 'tell application "System Events" to keystroke "2a"'; \
osascript -e 'tell application "System Events" to keystroke return'


Creating OS X Users

Add Users
dscl . -create /Users/DigitalImaging
dscl . -create /Users/DigitalImaging UserShell /bin/bash
dscl . -create /Users/DigitalImaging RealName DigitalImaging
dscl . -create /Users/DigitalImaging UniqueID 506
dscl . -create /Users/DigitalImaging PrimaryGroupID 20
dscl . -create /Users/DigitalImaging NFSHomeDirectory /Users/DigitalImaging
dscl . -passwd /Users/DigitalImaging imaging

osascript -e 'tell application "System Events" to keystroke "d"'; \
osascript -e 'tell application "System Events" to keystroke return'
osascript -e 'tell application "System Events" to delay 8'; \
osascript -e 'tell application "System Events" to keystroke "imaging"'; \
osascript -e 'tell application "System Events" to delay 8'; \
osascript -e 'tell application "System Events" to keystroke return'

Create

dscl . -create /Users/testuser
dscl . -create /Users/testuser UserShell /bin/bash
dscl . -create /Users/testuser RealName Test User
dscl . -create /Users/testuser UniqueID 502
dscl . -create /Users/testuser PrimaryGroupID 80**
dscl . -create /Users/testuser NFSHomeDirectory /Users/testuser
dscl . -passwd /Users/testuser PASSWORD

dscl . -create /Users/student
dscl . -create /Users/student UserShell /bin/bash
dscl . -create /Users/student RealName student
dscl . -create /Users/student UniqueID 505
dscl . -create /Users/student PrimaryGroupID 20
dscl . -create /Users/student NFSHomeDirectory /Users/student
dscl . -passwd /Users/student ***

Delete user test
sudo dscl . delete /Users/test

Make the home folder for test
sudo cp -R "/System/Library/User Template/English.lproj" /Users/test
sudo chown -Rf test /Users/test

Delete

dscl . -delete /Groups/admin GroupMembership testuser
dscl . -delete /Users/testuser
rm -rf /Users/testuser

User Permissions

chmod -R 770 /Users/teacher/
chown -R user:group /Users/teacher/

Make test an admin
sudo dscl . merge /Groups/admin users test

“chown” Examples
Assign Ursula as the owner of “MyFile.txt” file in the Shared directory.

sudo chown Ursula /Users/Shared/MyFile.txt

Creating a Disk Image
sudo chown Ursula /Users/Shared/MyFile.txt

Assign Ursula as the owner, and staff as the group for everything in the “tmp” folder
sudo chown -R Ursula:staff /Users/Shared/tmp/


MAC Sys. Settings

Auto Login

Adjust Dock

Adjust Wallpaper

Adjust Volume

BackingUp

Disabling Spaces

Disable Wi-Fi

Disk Utility

Empty Trash

Finder

Garageband Loops admin permissions

Hidden Files

MAC Setup Assistant

Name Change

Osascript Keyboard Shortcuts

Print Jobs

Restart

Safari Popup Blocker

ScreenSaver Time

Screen Capture

Set Startup Disk

Software Updates

SOFTWARE

 

Disabling Spaces in Mission Control For MCA Testing

Screen Shot 2014-04-15 at 8.31.56 AM


Reboot
sudo shutdown -r now


Disable Wi-Fi
networksetup -setnetworkserviceenabled Wi-Fi off
or
networksetup -setairportpower en0 off


Empty Trash
sudo rm -rf /Users/-------/.Trash/*


Repair Permissions
diskutil repairPermissions /


open finder Window
open .

View all running applications
osascript -e 'tell application "Finder" to get name of every process whose visible is true'

open Apps Window
open /Applications/


Force Name Change in Terminal
sudo scutil --set HostName name-you-want
OR
sudo scutil --set ComputerName "newname"
sudo scutil --set LocalHostName "newname"
sudo scutil --set HostName "newname"


‘diskutil’: Disk Utility commands in Terminal

diskutil help – will list help for the command
diskutil mount – will list help about mount (because of missing args)
diskutil list – will list connected drives (whether mounted or not)
from that list select the identifier to mount eg…
diskutil mount disk0s1
diskutil mountDisk MyDriveName


Backing up files
Deleting these folders to speed up the backup process and save space:

/Users/teacher/Library/Caches
/Users/teacher/Library/PubSub/Feeds


Bypass MAC Setup Assistant
touch /var/db/.AppleSetupDone


OS X Software Updates
sudo softwareupdate -i -a


Set Startup Disk
bless -mount /Volumes/Boot\ Camp -setBoot
bless -mount /Volumes/Macintosh\ HD -setBoot


ScreenSaver Time
defaults -currentHost write com.apple.screensaver idleTime 180


Adjust Wallpaper
osascript -e 'tell application "Finder" to set desktop picture to POSIX file "/Library/Desktop Pictures/wave.jpg"'
osascript -e 'tell application "Finder" to set desktop picture to POSIX file "/Library/Desktop Pictures/Yosemite1.jpg"'


Adjust the volume
osascript -e "set Volume 0"
defaults write -g "com.apple.sound.beep.feedback" -int 0
defaults write "com.apple.systemsound" "com.apple.sound.uiaudio.enabled" -int 0
killall -HUP SystemUIServer


Disable Auto Login
sudo defaults delete /Library/Preferences/com.apple.loginwindow autoLoginUser


Adjust Dock
defaults write com.apple.dock no-glass -boolean YES
killall Dock

defaults write com.apple.dock no-glass -boolean NO
killall Dock


Hidden Files

chflags nohidden ~/Library/

defaults write com.apple.finder AppleShowAllFiles -boolean true ; killall Finder
defaults write com.apple.finder AppleShowAllFiles -boolean false ; killall Finder

To show removable media (cards, etc):

defaults write com.apple.finder ShowRemovableMediaOnDesktop -bool true

To show external hard drives (USB, Thunderbolt, firewire, etc):

defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool true

To show mounted servers (AFP, SMB, NFS, etc):

defaults write com.apple.finder ShowMountedServersOnDesktop -bool true

To show internal hard drives:

defaults write com.apple.finder ShowHardDrivesOnDesktop -bool true


Screen Capture – Location/File Format
defaults write com.apple.screencapture type png
defaults write com.apple.screencapture location /users/name/folder


Cancel Print Jobs
cancel -a -

To remove any and all printers, simply remove the file printers.conf
Workgroup Manager will then re-add the correct printers after reboot.

rm /etc/cups/printers.conf

Alternatively
rm /etc/cups/printers.conf; reboot


Disable Safari Popup Blocker (As of Safari 7.1.3)

defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2JavaScriptCanOpenWindowsAutomatically -bool TRUE

defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2JavaScriptCanOpenWindowsAutomatically -bool FALSE
RUN AS THE USER YOU WANT TO EFFECT


Osascript Keyboard Shortcuts

osascript -e 'tell application "Safari" to activate'; \
osascript -e 'tell application "System Events" to keystroke "w" using command down'; \
killall Safari

osascript -e 'tell application "System Events" to keystroke "w" using command down'

osascript -e 'tell application "System Events" to keystroke "q" using command down'


SOFTWARE

iWork apps
Here’s how to disable OS X’s built-in spellcheck, which applies to all iWork apps:

sudo mv /System/Library/Services/AppleSpell.service/Contents/Resources/English.lproj /System/Library/Services/AppleSpell.service/Contents/Resources/English.lproj.disabled

And here’s how to re-enable it:

sudo mv /System/Library/Services/AppleSpell.service/Contents/Resources/English.lproj.disabled /System/Library/Services/AppleSpell.service/Contents/Resources/English.lproj



Give Garageband Loops Admin Permissions

chown -R Garageband /Library/Audio
chmod -R 770 /Library/Audio



Safe Mode without a keyboard

Starting in Safe Mode without a keyboard
If you don’t have a keyboard available to start in Safe Mode but you have remote access to your computer, you can configure the computer to startup in Safe Mode using the command line.
Access the command line by either opening Terminal remotely, or by logging into the computer using SSH.
Use the following Terminal command:
sudo nvram boot-args=”-x”
If you want to start in Verbose mode as well, use this instead:
sudo nvram boot-args=”-x -v”

After using Safe Mode, use this Terminal command to return to a normal startup:
sudo nvram boot-args=”"


Using Hosts File to Block Sites
Another way to do this is to redirect the DNS to point to a false IP address. The easy way to do this is to use /etc/hosts. By aliasing the DNS name of a site I want to block to 127.0.0.1, I can block all traffic to that site. Using sudo nano -w /etc/hosts, add the DNS names of the sites you want to block after the IPv4 localhost entry, separated by spaces.
127.0.0.1 localhost ads.site1.com ads.site2.com
255.255.255.255 broadcasthost
::1 localhost

:

Remove Dir
rm -r /Applications/MNSecureBrowser5.0.app

THANKS T0 MAC|LIFE

1.Control + Option + Command + Eject

2. Command + Shift + A/U/D

3. Shift + Command + I

4. Control + D

5. Control + Option + Command + 8

6. Control + Command + D

7. Command + Shift + 4 + Space bar

8. Option + Command + M

9. Option + Shift + Command + Esc

10. Command +

Follow this article’s author, Cory Bohon on Twitter.

 

________________________________________________________________________
Thanks to http://www.applevis.com/guides/voiceover-keyboard-shortcuts-mac-os-x

Getting Started
Basics
Turn VoiceOver on or off:
Command+F5

Stop speech:
Ctrl

Repeat the last spoken phrase:
VO+Z

Help
VoiceOver Quick Start tutorial:
VO+Command+F8

Open the VoiceOver Help menu:
VO+H

VoiceOver Commands Help menu:
VO+HH

Start keyboard help:
VO+K (Esc to exit keyboard help)

Configuration
Typing Echo (verbosity):
VO+V

Open VoiceOver Utility:
VO+F8

Cycle through speech attributes:
VO+Command+LeftArrow (or RightArrow)

Change current speech attribute:
VO+Command+UpArrow (or DownArrow)

Close a menu or rotor, stop an action, or exit a mode:
Escape

Lock and unlock the VO (Control and Option) keys:
VO+;

Orientation Commands
Hear the application summary:
VO+F1

Hear the window summary
VO+F2

Describe the item in the VoiceOver cursor:
VO+F3

Describe the item that has the keyboard focus:
VO+F4

Describe the selected item:
VO+F6

Navigation Commands
General
Move VO cursor left, right, up or down:
VO+Arrow keys

Move to start of list or document:
VO+Shift+Home

Move to end of list or document:
VO+Shift+End

Move to top/start of window, Dock, etc:
VO+Command+Home

Move to bottom/end of window, Dock, etc:
VO+Command+End

Directly Accessing Items
Move to the menu bar:
VO+M (Control-F2)
(NB: VO+Shift+M opens context menu)

Move to the Dock:
VO+D (or Control-F3)

Move to the desktop:
VO+Shift+D

Open the Item Chooser (to go to item on the screen or in a window):
VO+I

Jump to a linked item (for example, from a Mail message in the Inbox to its message text):
VO+J

Hot Spots
Set or remove a hot spot:
VO+Shift+[number key]

Open the Hot Spot Chooser (to browse and jump to hot spots):
VO+[number key]+[number key] (i.e. VO & same number key twice)

Jump to a hot spot:
VO+[number key]

Hear a description of a hot spot:
VO+Command+[number key]

QuickNav
Toggle QuickNav on/off:
LeftArrow+RightArrow

Move VoiceOver cursor:
Cursor keys (equals VO+Arrow keys)

Perform action:
Up+Down (equals VO+Spacebar)

Interact with item:
Right/Down (equals VO+Shift+DownArrow)

Stop interacting with item:
Left/Down (equals VO+Shift+UpArrow)

VoiceOver Cursor Visual Commands
Magnify item in VoiceOver cursor:
VO+Shift+[

Shrink item in cursor:
VO+Shift+]

Toggle VoiceOver focus rectangle (& other visuals):
VO+F11

Displays Caption panel (of where VO cursor is):
VO+Command+F10

Finding
Find text:
VO+F

Find next (after using VO+F):
VO+G

Find previous:
VO+Shift+G

Find the next misspelled word:
VO+Command+E

Reading commands (TextEdit, Safari, etc)
Before you can use most of these commands, you must interact with text in a text area.

General
Read from VoiceOver cursor to end:
VO+A

Read from beginning to cursor:
VO+B

Speak text attributes:
VO+T

Speaks line number, word and character in VoiceOver cursor:
VO+F3

Characters
Read character in VoiceOver cursor:
VO+C

Read next character:
VO+Shift+Right Arrow

Read previous character:
VO+Shift+Left Arrow

Words
Read word in VoiceOver cursor:
VO+W

Spell word:
VO+WW

Spell word phonetically:
VO+WWW

Read next word:
VO+Right Arrow

Read previous word:
VO+Left Arrow

Lines
Read line in VoiceOver cursor:
VO+L

Read next line:
VO+Down Arrow

Read previous line:
VO+Up Arrow

Sentences
Read sentence in VoiceOver cursor:
VO+S

Read next sentence:
VO+Command+Page Down

Read previous sentence:
VO+Command+Page Up

Paragraphs
Read paragraph in VoiceOver cursor:
VO+P

Read next paragraph:
VO+Shift+Page Down

Read previous paragraph:
VO+Shift+Page Up

Tables
Read a row in a table:
VO+R

Read a column in a table:
VO+C+C

Read the column header in a table:
VO+C

Interaction commands
General
Interact with an item:
VO+Shift+DownArrow

Stop interacting with an item:
VO+Shift+Up Arrow

Perform the default action for the item in the VoiceOver cursor (e.g. open active item):
VO+Spacebar

Open application, documents or download folders on Dock:
VO+Spacebar, down arrow, Enter

QuickNav
Perform action:
Up+Down (equals VO+Spacebar)

Interact with item:
Right/Down (equals VO+Shift+DownArrow)

Stop interacting with item:
Left/Down (equals VO+Shift+UpArrow)

Web commands (Safari)
Navigation – General
Move to next heading:
VO+Command+H

Move to next heading of the same level:
VO+Command+M

Move to next plain text:
VO+Command+P

Move to next link:
VO+Command+L

Move to next visited link:
VO+Command+V

Move to next control:
VO+Command+J

Move to next table:
VO+Command+T

Move to the next column:
VO+Command+Y

Move to the next frame:
VO+Command+F

Move to the next auto web spot:
VO+Command+N

To move to a previous item, use Shift with above commands.
e.g. VO+Command+Shift+H to move to next heading

Navigation – Web Spots
Set a web spot:
VO+Command+Shift+}

Remove a web spot:
VO+Command+Shift+{

Set the sweet spot:
VO+Command+Shift+}+}

Move to the next web spot:
VO+Command+]

Move to the previous web spot:
VO+Command+[Navigation – General

Navigation – Web Item Rotor
Open the Web Item rotor:
VO+U

Navigate lists:
Left & right arrow keys

Navigate items in selected list:
Up & down arrow keys

In Headers List, list only headings of a particular level
Type level number

Miscellaneous
Read a link address (URL):
VO+Shift+U

Read webpage statistics:
VO+Shift+I

Method #1: Reset an iPad Previously Synced With Your Computer’s iTunes

Connect your iPad to the computer via USB cable
Launch iTunes
Remove iPad from computer if iTunes prompts for passcode. If this happens move on to method #2
Right click on the iPad icon found within the iTunes left column & click “Back Up” (only perform this step if you want to restore your data after restore)
Click “Restore” when your back up has finished. This will cause your iPad to enter “Recovery Mode” which will reset all its settings.
After the device reboots, right-click the iPad icon and choose “Restore from Backup” This will replace all the content you previously backed up before the reset. This step is only necessary if you are looking to restore your data which was deleted during the reset.

Method #2: Reset An iPad That Was Never Synced With Your Computer’s iTunes

Disconnect iPad from computer
Hold down the top “Sleep/Wake” button until the red slider appears & proceed to turn the iPad off
While holding the bottom “Home” button down, reinsert the USB connector and the iPad will turn back on
When the screen shows a message saying “Connect to iTunes”, let go of the “Home” button
Launch iTunes again and it will initiate the Recovery Mode process.
You will likely have to wait several minutes for the reset to take place, but when finished you will receive a message that the reset was successful and the iPad will reboot itself
You will now have a blank iPad with factory settings


Apple Configurator cannot open ….
camblair
Nov 13, 2012 11:08 PM
Re: Apple Configurator 1.2 “The file couldn’t be opened”
in response to SkaggsCC
I started getting the “The file couldn’t be opened.” error and found this thread … which started for me as I was preparing a set of 30 iPads with 2 left and Apple Configurator unexpectadly quit…and then wouldn’t reopen.

Steps I took to fix it were based on suggestions in this thread. (THANK YOU)

I’m running on an MBP 10.8.2 with AC 1.2.1

I renamed ~/Library/Containers/com.apple.configurator to com.apple.configurator_LKG

I then opened Apple Configurator which opened right up brand new and fresh and created that folder of the same name again for me…and then quit AC.

I then went into the old / oringial AC folder now located at ~/Library/Containers/com.apple.configurator_LKG/Data/Library/Application Support/com.apple.configurator and copied all of the files EXCEPT the one named “AppleConfigurator.storedata-journal” (since this is (as I understand) a sort of temporary working database file) to the newly created ~/Library/Containers/com.apple.configurator/Data/Library/Application Support/com.apple.configurator folder and then opened AC again and BOOM! All was there. I continued preparing the 2 iPads that didn’t finish and I am seemingly back in business…voucher codes and ALL.

I hope this helps someone else…

Leave a Reply