I auto-hide my taskbar so it's easy to lose track of time when I'm focused on something else and forget to drag my mouse down there every once in a while.
Is there a way to use Task Scheduler to run a batch script every hour or so that brings up a Windows 8 Toast Notification that displays the time?
Check this out.
A wee Win8 console notifications app. Post toast notifications from the console, making it easy to integrate into existing batch scripts etc.
Quickstart: Sending a toast notification from the desktop
Sending toast notifications from desktop apps sample
Used one of the links in Xyroid's answer (uses the program toaster). Batch file is:
#echo off
SET "hh=%time:~0,2%"
SET "mm=%time:~3,2%"
if %hh% == 0 (
SET "hh=12"
)
if %hh% gtr 12 (
echo %hh%
SET "ampm=pm"
SET /a "hh-=12"
) else (
SET "ampm=am"
)
set "tt=The time is %hh%:%mm% %ampm%."
toast "%tt%"
echo on
Try scheduling this: it should bring up a cmd window with the time and wait for a keypress. Add another &pause if you want to be more certain of the window not closing if you are typing at the time.
cmd /c #echo %time%&pause
Or try this variation which will require enter to cancel the dialog window:
cmd /c set /p "v=The time is %time% "
Related
I want to open multiple sessions in one main session with a screen command, and I can do that after opening the main session and then press on the keyboard (CTRL + A + c) but I don't want this way I want to do this using the command line only because I create a script to open the main session with multiple sub-session, so how can I achieve this. And thanks in advance :)
CTRL+A+C doesn't create a new screen session. It creates a new window within the current session.
(With a little environment trickery, you could create a nested screen session within an existing screen session, where the outer screen session and the inner screen session could each have multiple windows, but that's probably not what you want to do.)
Each window within a screen session runs a command. By default, that command is your login shell. Thus you can have multiple shell processes running simultaneously and switch between them.
From any of those shells, you can create a new window under the current screen session using the screen command. It uses the $STY environment variable to recognize that it's inside an existing session, which tells it to create a new window rather than starting a new session. You could also type, for example, screen vi to launch a new window running the vi editor.
All this is covered in the screen documentation (info screen or man screen).
(Personally, I used screen for a long time, but then switched to tmux, which I find to be more flexible, more powerful, and easier to control from the command line. If you haven't invested a lot of time learning screen, you might consider switching. Or not; it's up to you, of course.)
You can do this using by by putting the following in your ~/.screenrc (or using a custom .screenrc file):
$ cat ~/tmp/screenrc_custom
...
<content of ~/.screenrc>
...
screen -t csh 0
screen -t csh 1
screen -t csh 2
$ screen -c ~/tmp/screenrc_custom
I have created an application for a prank on friends using AppleScript. The only thing I haven't managed to figure out is how to change the application contents to make the app automatically open at login. Is there a specific info.plist key I can use for this?
If not how can I get the application to change computer settings, when run, to open the application on login?
This is the script I put into an application. It is a stay-open app.
property idleTime : 10 --seconds
on run
idle
end run
on idle
tell application "Google Chrome"
if it is not running then return idleTime
tell window 1 to if it exists then ¬
tell its active tab
set its URL to "chrome://newtab/"
end tell
end tell
return idleTime
end idle
To get an application to launch on system startup, you can go to System Preferences > Users & Groups; select the appropriate user; then select Login Items. You'll see a screen like this:
Click the + button and select your application to be added to the list. You'll probably want to select the checkbox to hide the application as well, so that it doesn't pop up on the screen. This won't, however, hide it from the dock.
If you really need to set it programmatically for any reason, you can use AppleScript to do it. For example, if I wanted to add Calendar.app to the list of start up items, I would run this command:
tell application "System Events" to ¬
make new login item with properties ¬
{name:"Calendar", path:"/Applications/Calendar.app", hidden:true}
To do so from Terminal, you'd run the same command using osascript, like this:
osascript -e 'tell application "System Events" to ¬' \
-e 'make new login item with properties ¬' \
-e '{name:"Calendar", path:"/Applications/Calendar.app", hidden:true}'
I am trying to make an AppleScript which creates a notification when I receive a specific email.
Rules are set up, and I have a script which launches an app with the following code:
display notification "A newBuild is now available!" with title "New Build"
tell application "Safari"
activate
tell window 1
set current tab to (make new tab with properties URL:"https://latestSuccessful")
end tell
tell application "System Events"
set visible of process "Safari" to true
end tell
end tell
This launches safari and take to the the web page as soon as the notification is displayed.
Ideally I would display the notification as an Alert, with an action on the 'Show' button which then takes me to the web page. The 'Close button' naturally closes the alert.
Is this possible? Thanks in advance for any pointers.
Do you mean something like this?
set alertReply to display alert "New Build" message "A new build is now available!" buttons ["Cancel", "Show"] default button 2 giving up after 5
if button returned of alertReply is equal to "Show" then
tell application "Safari"
activate
tell window 1
set current tab to make new tab with properties {URL:"http://www.google.com"}
end tell
end tell
end if
Notifications with action buttons are not possible in AppleScript,
because AppleScript can't handle the callbacks.
You can definitely do this! You'll have to install Growl for this. It used to be free, but costs $4 now. It's a pretty damn good long-term investment in my opinion, and it'll allow you to do awesome things with notifications in AppleScript. The code to use once it's installed is this:
set notifications to {"EMailNotify"}
tell application "Growl"
register as application "AppleScript App" all notifications notifications default notifications notifications
notify with name "EMailNotify" title "E-Mail received!" description "it's here!" application name "AppleScript App" callback URL "http://www.apple.com/"
end tell
Keep in mind that you must use one of the notification names in the list on the first line, as the name for the notification on the fourth line, and you must use the same application name that you register the application with on the third line, as the "application name" on the fourth line. Growl lets you specify a callback URL as an argument, which should get you exactly what you're looking for!
Keep in mind that you can configure Growl to use OS X notifications in order to get exactly what you were looking for, but Growl's notifications are far more customizable.
I'm trying to work with UIAutomation, and here's a problem. I'm starting to record some actions with my app (like in FoneMonkey).Recording stops when I press the Record button, but how can I replay it?
Playing a script is done by either clicking the play button found below the script editor or by clicking Instruments Record button found in the upper-left of the trace window. In either case, you'll have to have set your target appropriately under the Choose Target popup.
You can also play back scripts via the command line instruments tool. See Can the UI Automation instrument be run from the command line? from more details.
I am wondering if there is a public api/framework where I can set the computer sleep value and the display sleep value in a cocoa application on mac os x? I am interested in making a utility application that will place an icon in the menu bar, allow the user to create different power option settings and what not.
I am not interested in using any private frameworks as I want to develop this application for the Mac App Store.
I always find myself changing the energy saver and screen saver values when i'm a home and when I wont be at home. Because I use Carbonite, I always leave my machine running. When I'm at home, I like the screen saver to come on after so many minutes, but when I away, like when I'm at work or a sleep at night, I prefer the screen saver to be off and the screen to sleep after one minute of inactivity. It would be nice to not have to go into system preferences all the time to do this. Any one else agree?
Thanks,
You can create a wrapper around the pmset utility, which allows you to change the power management settings on the command line, using either system() or (better) an NSTask.