I have a nicely working bash script, and want to change the default setting so that it will run on a double-click, but don't know the proper "open by" name. Please?
Brighten your iPad with a colorful cover, stream to your TV, download pictures from your digital camera, and more. There’s already so much you can do with iPad and iPad mini
The incredibly thin Apple Wireless Keyboard uses Bluetooth technology, which makes it compatible with iPad
iPad inspires creativity and hands-on learning with features you won’t find in any other educational tool
Apple announces 4th generation iPad packing an A6X CPU
I have a nicely working bash script, and want to change the default setting so that it will run on a double-click, but don't know the proper "open by" name. Please?
I have a nicely working bash script, and want to change the default setting so that it will run on a double-click, but don't know the proper "open by" name. Please?
Im am working on a project in apple script where basically you can talk to the computer in a way by pressing buttons for your response. But that is no the important part.... Whenever I try to run it it stops running at a certain point. Why is this?
Im am working on a project in apple script where basically you can talk to the computer in a way by pressing buttons for your response. But that is no the important part.... Whenever I try to run it it stops running at a certain point. Why is this?
I am trying to make an apple script that will detect when an application (minecraft) is open and then bring up a dialog that wont go away so that only I.T. can remove it.
It's a school project that im working on, we have to figure out a way (through applescript) to help students be more productive, everyone else has no experience with apple script but me. I managed to create this in a couple of minutes but there is a couple glitches and problems i cant solve.
here's the script:
repeat
if appIsRunning("Minecraft") then
display dialog "Gaming is not allowed, Your log of your computer programs running has been emailed to the I.T. department. Please visit the I.T. department immedietly to remove this message" buttons {"Report To I.T."} default button 1 with title "Gaming Alert" with icon stop
end if
tell application "Minecraft"
quit
end tell
end repeat
on appIsRunning(appName)
tell application "System Events" to (name of processes) contains appName
end appIsRunning
end
it works ok...
exept for the fact it works on every application exept minecraft...
Minecraft just freezes and then the script just says error.
Im also trying to design a way that applescript will send an email to the school I.T. desk with the students user name. I have this so far...
tell application "Mail"
set theNewMessage to make new outgoing message with properties {subject:"Gaming Alert [username here]"
, content:"[username here] has been gaming, he is to report to I.T. by the end of the day", visible:true}
tell theNewMessage
make new to recipient at end of to recipients with properties {address:"itdesk@blahblahblah.net"}
send
end tell
end tell
exept the school uses office 365 mail not inbuilt mail, is there any way to make this work?
My key issues are
1. how to fix the bug
2. how can i combne the scripts?
3.will this work for other games?
4.Can this work with online email bases
5.any other genreral comments on the scripts.
The following script application should combine your previous examples and allow for multiple applications - save it as a stay-open application. You should also add a LSUIElement key set to true in the application Info.plist so that it doesn't show a menu or appear in the Dock.
property illegalApps : {"MineCraft"} -- add application names as needed
property longName : missing value
property shortName : missing value
on run -- setup
tell (get system info)
set longName to long user name -- for use in the email message
set shortName to short user name -- for use in the shell script
end tell
end run
on idle -- repeatedly executes after the run handler completes
tell application "System Events" to set appList to get name of processes whose background only is false
set editedList to {}
repeat with anApp in appList -- filter for illegal apps
set anApp to contents of anApp
if anApp is in illegalApps then set end of editedList to anApp
end repeat
if editedList is not {} then notifyAndQuit(editedList) -- illegals found
return 60 -- do it again in 60 seconds
end idle
on notifyAndQuit(quitList)
tell application "Mail" -- send mail
set theNewMessage to make new outgoing message with properties {subject:"Gaming Alert [" & longName & "]", content:"[" & longName & "] has been gaming, he is to report to I.T. by the end of the day", visible:true}
tell theNewMessage
make new to recipient at end of to recipients with properties {address:"itdesk@blahblahblah.net"}
send
end tell
end tell
repeat with anApp in quitList -- kill user processes with extreme prejudice
do shell script "killall -9 -u " & shortName & " -c " & quoted form of anApp
end repeat
activate me
display dialog "Gaming is not allowed, Your log of your computer programs running has been emailed to the I.T. department. Please visit the I.T. department immedietly to remove this message" buttons {"Report To I.T."} default button 1 with title "Gaming Alert" with icon stop
end notifyAndQuit
Hi guys,
I am looking for the correct syntax for a
do shell script command in applescript,
where the results of the do shell script command are displayed as a list in applescript,
whereupon i can then choose one of these given results and move on from there, this is where i have gotten to:
my issue is that the results are as follows when done in terminal:
but when done in applescript i only see this:
obviously the terminal results need to be handled in some special manner that i am unaware of,
to handle each line in the terminal results as a single option in my list. Anyone got any idea how to do this?
cheers
figured it out mate, my sound output app had a space in the name which was making applescript skitz out, i just placed an underscore to make it sound_output and all problems were solved, thx dude you're a legend, also had to remove SwitchAudioSource as it was now redundant, here is the finished and working script, thankyou so much for your help:
Hi guys,
i have made an applescript with the following source code:
"
set sound_output to button returned of (display dialog "Select Output Source" buttons {"Computer", "TV"} default button "TV")
if sound_output is "Computer" then do shell script ("cd /Applications/SwitchAudioSource-v1; ./SwitchAudioSource -s 'Built-in Output'")
if sound_output is "TV" then do shell script ("cd /Applications/SwitchAudioSource-v1; ./SwitchAudioSource -s 'HDMI'")
"
I am wondering if there is a way to refer to the abovementioned executable ./SwitchAudioSource (currently located in /Applications) in my compiled applescript somewhere? That is:
Show Package Contents > Contents > Resources > and dump the executabe ./SwitchAudioSource here, and then modify my script to somehow refer to within itself so that my applescript will work regardless of where i place it. Desktop, /Users, even pictures,
i hope this makes sense, thankyou for all your help in advance, cheers mate
Hi guys,
I am looking for the correct syntax for a
do shell script command in applescript,
where the results of the do shell script command are displayed as a list in applescript,
whereupon i can then choose one of these given results and move on from there, this is where i have gotten to:
my issue is that the results are as follows when done in terminal:
but when done in applescript i only see this:
obviously the terminal results need to be handled in some special manner that i am unaware of,
to handle each line in the terminal results as a single option in my list. Anyone got any idea how to do this?
cheers
Hi guys,
i have made an applescript with the following source code:
"
set sound_output to button returned of (display dialog "Select Output Source" buttons {"Computer", "TV"} default button "TV")
if sound_output is "Computer" then do shell script ("cd /Applications/SwitchAudioSource-v1; ./SwitchAudioSource -s 'Built-in Output'")
if sound_output is "TV" then do shell script ("cd /Applications/SwitchAudioSource-v1; ./SwitchAudioSource -s 'HDMI'")
"
I am wondering if there is a way to refer to the abovementioned executable ./SwitchAudioSource (currently located in /Applications) in my compiled applescript somewhere? That is:
Show Package Contents > Contents > Resources > and dump the executabe ./SwitchAudioSource here, and then modify my script to somehow refer to within itself so that my applescript will work regardless of where i place it. Desktop, /Users, even pictures,
i hope this makes sense, thankyou for all your help in advance, cheers mate
I have a txt file which has data written in a particular format as below:
My requirement is to copy the data within each tags to a separate file . eg: File1 should have
Please help..!!
I'm using PackageMaker to install an app update and want to add a preinstall script to delete some files in the /Applications/
folder. The script is simply:
#!/bin/bash rm /Applications/...
etc.
If I run this script with Terminal using
bash preinstall.sh
it works fine.
However, when I add it to PackageMaker and run the .mpkg file the script opens in Text Edit but does not run. How do I get it to run but not open?
here is the sctipt ive tried to write, its not finished so some of the things my seem a bit weird at the moment but here it is as it stands
global okflag
set okflag to false
set front_app to (path to frontmost application as Unicode text)
-- check if iTunes is running
tell application "System Events"
if process "iTunes" exists then
set okflag to true --iTunes is running
end if
end tell
if okflag is true then
set Timer to ""
display dialog "Sleep Time (Minutes)" default answer Timer buttons {"Cancel", "OK"} default button 2
set Timer to text returned of the result
delay Timer * 60
tell application "iTunes"
set currentVolume to the sound volume
if (player state is playing) then
repeat
--Fade down
repeat with i from currentVolume to 0 by -1
set the sound volume to i
delay 1
end repeat
pause
--Restore original volume
set the sound volume to currentVolume
exit repeat
end repeat
if okflag is false then
display dialog "iTunes not playing" buttons {"OK"} default button 1 with icon stop
end if
end
it doesnt seem to work after the tell "iTunes part i copied and pasted from another applescript
(the purple text)
I am trying to make an application apple scriptable. I have created a scripting definition by copying mail.sdef and modifying it to suit my needs as the documentation recommends. My app suite at this point only has one command in it. Here is the definition:
I am not sure what is wrong with my definition above, but AppleScript Editor keeps complaining: "Expected end of line but found identifier." at the statement where command is invoked. Here is how my test sript looks like:
tell application "NAZone"
launch
try
accountlogin loginName "test@mail.com" passwordStr "abcdef12345"
on error errStr number errNum
display dialog errStr & errNum
end try
end tell
AppleScript Editor complains anything following the command name. I don't think my command is somehow recognized.
I new to making applications scriptable as well as apple scripting.
Does your app show up in the Applescript Dictionary and if so what does it show for it?
Does your app show up in the Applescript Dictionary and if so what does it show for it?
I am trying to make an application apple scriptable. I have created a scripting definition by copying mail.sdef and modifying it to suit my needs as the documentation recommends. My app suite at this point only has one command in it. Here is the definition:
I am not sure what is wrong with my definition above, but AppleScript Editor keeps complaining: "Expected end of line but found identifier." at the statement where command is invoked. Here is how my test sript looks like:
tell application "NAZone"
launch
try
accountlogin loginName "test@mail.com" passwordStr "abcdef12345"
on error errStr number errNum
display dialog errStr & errNum
end try
end tell
AppleScript Editor complains anything following the command name. I don't think my command is somehow recognized.
I new to making applications scriptable as well as apple scripting.
I have a friend who is running Tiger on a PPC Mac and wants to download a large number of files from the web. Unfortunately, this friend is barely able to do basic web browsing with Safari or Firefox.
I thought of just sending him a shell script with a lot of curl commands, but I don't suppose making it executable on my Mac would make it executable on his. I would like to be able to send him an Applescript that he could just run by clicking on it, but it would be awkward to make each curl command a separete shell script within the applescript..
Is there a way of directly including in an applescript a multi-line shell script as a single entity that invokes only one shell? I know I can do it by putting the shell script in a separate file and have the applescript give it the necessary permissions, but then I'd have to explain to my friend where to put the shell script!
The path to resource command has an optional in directory parameter that can be used to get resources in subdirectories such as the Scripts folder - see the StandardAdditions scripting dictionary.