Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 603747
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T16:57:53+00:00 2026-05-13T16:57:53+00:00

I’m starting to poke around with Applescript and am looking at writing a few

  • 0

I’m starting to poke around with Applescript and am looking at writing a few scripts for managing windows. A common task they will all need is to get the current screen size.

I’ve created a screen_size subroutine that seems to work, and I want to be able to share that with all my scripts. However, I can’t figure out a way to put that in a separate file that I can load in my other scripts. I tried creating a separate screen_size.scpt file and use load script "screen_size.scpt", but I get an error about “can’t make “screen_size.scpt” into a type file”.

There has to be a way to do this, but I haven’t been able to find anything online about how to do it.

EDIT:

The POSIX stuff suggested isn’t working for me. I’m able to create the file object, but it refuses to convert to an alias, saying it can’t find the file (looks like the POSIX file stays relative instead of expanding fully).

I found a suggestion online to use Finder, and have gotten the following working to get an alias:

tell application "Finder"
  set _myPath to container of (path to me) as text
end tell

set _loadPath to (_myPath & "screen_size.scpt")
set _loadAlias to alias _loadPath

However, the next line fails with a syntax error, claiming that _loadAlias isn’t a variable:

property _ScreenSize : load script _loadAlias

Every variation of this I’ve tried (doing the alias in the load call, etc) fails, always claiming the variable doesn’t exist, even though I know it’s being set and working as I can display it. What’s going on? Why is it claiming a variable doesn’t exist when it obviously does?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T16:57:53+00:00Added an answer on May 13, 2026 at 4:57 pm

    AppleScript is doing some really weird things when saving and I haven’t figured out what’s going on, but I ended up getting something to work.

    Here’s what I have:

    on load_script(_scriptName)
      tell application "Finder"
        set _myPath to container of (path to me) as text
      end tell
    
      set _loadPath to (_myPath & _scriptName)
      load script (alias _loadPath)
    end load_script
    
    set _ScreenSize to load_script("screen_size.scpt")
    
    set _bounds to _ScreenSize's screen_size()
    -- ...
    

    The other answers were saying to set _ScreenSize as a property, but that would cause a syntax error which prevented me from ever saving the file. When I did it just using set it worked.

    I wasn’t ever able to get the POSIX path stuff suggested to work, but poking Finder for the path worked fine.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I need a function that will clean a strings' special characters. I do NOT
I am writing an app with both english and french support. The app requests
I am using Paperclip to handle profile photo uploads in my app. They upload
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.