AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
Mac menubar countdown apple scripts11/4/2022 ![]() Set top_spacing_const to content_view's topAnchor's constraintEqualToAnchor:(label_field's topAnchor) |constant|:-10 Set pi_right_margin to content_view's trailingAnchor's constraintEqualToAnchor:(progress_indicator's trailingAnchor) |constant|:10 Set pi_left_margin to content_view's leadingAnchor's constraintEqualToAnchor:(progress_indicator's leadingAnchor) |constant|:-10 Set lf_left_margin to content_view's leadingAnchor's constraintEqualToAnchor:(label_field's leadingAnchor) |constant|:-10 set view_height_constraint to content_view's heightAnchor's constraintEqualToConstant:100 Set content_view's translatesAutoresizingMaskIntoConstraints to falseĬontent_view's addSubview:progress_indicator Set content_view to NSView's alloc's initWithFrame:(ca's NSMakeRect(0, 0, 200, 100)) Set progress_indicator's translatesAutoresizingMaskIntoConstraints to false Progress_indicator's setStyle:(ca's NSProgressIndicatorStyleBar) Set progress_indicator's indeterminate to false Set progress_indicator to NSProgressIndicator's alloc's initWithFrame:(ca's NSMakeRect(0, 0, 200, 20)) Set label_field's translatesAutoresizingMaskIntoConstraints to false Set label_field to NSTextField's labelWithString:label_value Property progress_indicator : missing value ![]() Set statusMenu to status_bar_item's |menu| NSStatusBar's systemStatusBar's removeStatusItem:status_bar_item This_obj's changeLabel("Adding: " & rand_numb) (this_obj's progress_indicator's incrementBy:rand_numb) Set rand_numb to (random number from 1 to 9) My addToStatusMenu(my progress_view_obj("Number 2")) My addToStatusMenu(my progress_view_obj("Number 1")) My setImage(ca's NSImageNameSmartBadgeTemplate) Set status_bar_item's |menu|'s minimumWidth to 220 ![]() Set status_bar_item's |menu| to NSMenu's alloc's initWithTitle:"" Set status_bar_item to NSStatusBar's systemStatusBar's statusItemWithLength:(ca's NSSquareStatusItemLength) Global status_bar_item, progress_views, idx Property NSTextField : class "NSTextField" Property NSProgressIndicator : class "NSProgressIndicator" Property NSStatusBar : class "NSStatusBar" then run the application like normal and see the demo. Copy it into Script Editor and save is as an application: choose "Application" from the File Format pulldown menu on the save screen, and make sure you check the Stay open after run handler checkbox. ![]() This is an AppleScript stay-open application. Based on the link red_menace gave in comments and the screenshot you provided, here's a script that (I think) will give the results you want. ![]()
0 Comments
Read More
Leave a Reply. |