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 3874992
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T22:12:56+00:00 2026-05-19T22:12:56+00:00

I am a fairly exceptional applescripter, and have been writing scripts for a long

  • 0

I am a fairly exceptional applescripter, and have been writing scripts for a long time. The application I am currently creating involves the use of the “Database Events” application. I am trying to set the value of a field by using a subroutine. Apparently, I “can’t continue set_duration” and I have no idea what could be wrong. The current source code is below.

property first_run : true
on run
if first_run then
display dialog "THIS APPLICATION IS DESIGNED TO CLEAN UP THE FOLDER CONTAINING IT." & return & return & "After a certain number of days that you set, every item in that folder that has not been used for that duration will automatically be moved to a folder named \"Unused Items\"." with icon 1 buttons {"Cancel", "OK"} default button 2
set first_run to false
end if
tell application "Database Events"
set quit delay to 0
try
get database "Folder Cleanup Wizard"
on error
make new database with properties {name:"Folder Cleanup Wizard"}
tell database "Folder Cleanup Wizard"
make new record with properties {name:"Duration"}
tell record "Duration" to make new field with properties {name:"Days", value:set_duration()} --> UNKNOWN ERROR
end tell
end try
end tell
end run

on set_duration()
try
set duration to the text returned of (display dialog "Enter the minimum duration period (in days) that files and folders can remain inactive before they are moved to the \"Unused Items\" folder." default answer "" with title "Set Duration") as integer
if the duration is less than 0 then
display alert "Invalid Duration" message "Error: The duration cannot be a negative number." buttons {"OK"} default button 1
set_duration()
end if
on error
display alert "Invalid Duration" message "Error: \"" & (duration as string) & "\" is not a valid duration time." buttons {"OK"} default button 1
set_duration()
end try
end set_duration
  • 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-19T22:12:56+00:00Added an answer on May 19, 2026 at 10:12 pm

    The problem is that AppleScript is treating set_duration as a term from database "Folder Cleanup Wizard" or from application "Database Events", thanks to the tell blocks. (Outside a tell block, just plain set_duration() will work.) In order to get around this, you need to use my set_duration(), which tells AppleScript to look in the current script for the function. So, in this case, you’d have

    ...
    tell record "Duration" to ¬
      make new field with properties {name:"Days", value:my set_duration()}
    ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a fairly simple program that's used for creating backups. I'm attempting to
I have a fairly long list in python which I want to return parts
I have written a fairly large program in Fortran 90. It has been working
I am fairly new to iOS development, and currently an app I am creating
I have a fairly complex application in Delphi 2006 that communicates through an ApdComport
Fairly simple question: I have an init method on my class that has the
I work on a fairly complex Open Source project ( opensimulator.org ). It's currently
I have a fairly substantial library of web services built in .NET that I
I'm writing some fairly complex C# code. I'm finding that my code is throwing
This seems like a fairly straightforward question, but I couldn't find this particular use-case

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.