how do you make a protected window in applescript?

samrockw22

I am trying to make an app with applescript that you can't close. unfortunately, googling 'protected window with applescript' brings up results such as 'Make a fake virus' and 'make a password protected app'. Please help!

markhunte

You have not really shown what know about Applescript, Objective - c or applescriptObjc.

But I will leave you with this:

use scripting additions
use framework "Foundation"
use framework "cocoa"



property aWindow : class "NSWindow"
property aWindow2 : class "NSWindow"
set height to 350
set width to 250
set winRect to current application's NSMakeRect(500, 500, width, height)
set aWindow to current application's NSWindow's alloc()'s initWithContentRect:winRect styleMask:1 backing:2 defer:false




set winRect to current application's NSMakeRect(751, 500, width, height)

--resizable window
set aWindow2 to current application's NSWindow's alloc()'s initWithContentRect:winRect styleMask:9 backing:2 defer:false


(* Thiese button is for when you test in SE, otherwise you will need to quit SE*)

set closeButtonFrame to current application's NSMakeRect(25, (height - 40), 200, 25)

set closeBtn1 to current application's NSButton's alloc's initWithFrame:closeButtonFrame
closeBtn1's setTitle:"close (for testing)"
set closeBtn1's bezelStyle to 12 --NSRoundedBezelStyle
closeBtn1's setButtonType:0 --NSMomentaryLightButton
closeBtn1's setTarget:me
closeBtn1's setAction:"closeWindow1:"
aWindow's contentView's addSubview:closeBtn1


set closeBtn to current application's NSButton's alloc's initWithFrame:closeButtonFrame
closeBtn's setTitle:"close (for testing)"
set closeBtn's bezelStyle to 12 --NSRoundedBezelStyle
closeBtn's setButtonType:0 --NSMomentaryLightButton
closeBtn's setTarget:me
closeBtn's setAction:"closeWindow:"
aWindow2's contentView's addSubview:closeBtn


aWindow2's makeKeyAndOrderFront:aWindow2
aWindow's makeKeyAndOrderFront:aWindow

on closeWindow1:sender

    aWindow's orderOut:aWindow
end closeWindow1:
on closeWindow:sender

    aWindow2's orderOut:aWindow2
end closeWindow:

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

how do you make something happen if a button is pressed in applescript

From Dev

How do you make an animation with the title of a Tkinter window?

From Dev

How do you make changes from a new windowManager window?

From Dev

How do you make a basic fullscreen window in Python?

From Dev

Make the "display dialog" window the front window in applescript

From Dev

Make the "display dialog" window the front window in applescript

From Dev

How do I automate clicking a button in an application's window with AppleScript?

From Dev

How do I get a Word document window by name in Applescript?

From Dev

How do I target and close a specific Terminal window in AppleScript?

From Java

How do you make a calculator?

From Dev

How do you specify multiple AppleScript child elements of the same class?

From Dev

how do you find the square root of a number in applescript

From Dev

How do I make this AppleScript Folder Watch ignore hidden items?

From Dev

How do I make applescript not wait for sound effect to finish?

From Dev

How do you capture mouseout on window?

From Dev

How with HTML do you make a site with two columns, where one column stays a constant pixel size where the other changes with the size of the window?

From Dev

How do I make a window transparent in KDE?

From Dev

How to make a pendrive write protected?

From Java

Flutter: How do you make a card clickable?

From Dev

How do you make a static class in swift?

From Dev

How do you make speech bubble with Tooltipsy?

From Dev

How do you make a circle from origin

From Dev

How do you make a changing background in rails?

From Dev

How do you join a 'Collection' to make a string

From Dev

How do you make an email go to spam

From Dev

How do you make a UIWebView content editable?

From Dev

How do you make a clickable sprite in SFML?

From Dev

How do you make relative references in R?

From Dev

How do you make this plist file programmatically?

Related Related

  1. 1

    how do you make something happen if a button is pressed in applescript

  2. 2

    How do you make an animation with the title of a Tkinter window?

  3. 3

    How do you make changes from a new windowManager window?

  4. 4

    How do you make a basic fullscreen window in Python?

  5. 5

    Make the "display dialog" window the front window in applescript

  6. 6

    Make the "display dialog" window the front window in applescript

  7. 7

    How do I automate clicking a button in an application's window with AppleScript?

  8. 8

    How do I get a Word document window by name in Applescript?

  9. 9

    How do I target and close a specific Terminal window in AppleScript?

  10. 10

    How do you make a calculator?

  11. 11

    How do you specify multiple AppleScript child elements of the same class?

  12. 12

    how do you find the square root of a number in applescript

  13. 13

    How do I make this AppleScript Folder Watch ignore hidden items?

  14. 14

    How do I make applescript not wait for sound effect to finish?

  15. 15

    How do you capture mouseout on window?

  16. 16

    How with HTML do you make a site with two columns, where one column stays a constant pixel size where the other changes with the size of the window?

  17. 17

    How do I make a window transparent in KDE?

  18. 18

    How to make a pendrive write protected?

  19. 19

    Flutter: How do you make a card clickable?

  20. 20

    How do you make a static class in swift?

  21. 21

    How do you make speech bubble with Tooltipsy?

  22. 22

    How do you make a circle from origin

  23. 23

    How do you make a changing background in rails?

  24. 24

    How do you join a 'Collection' to make a string

  25. 25

    How do you make an email go to spam

  26. 26

    How do you make a UIWebView content editable?

  27. 27

    How do you make a clickable sprite in SFML?

  28. 28

    How do you make relative references in R?

  29. 29

    How do you make this plist file programmatically?

HotTag

Archive