Clearing property upon restart

This pertains to an AppleScript application -- not an AppleScript Studio app.
The script generates information which must persist through relaunches but which becomes totally obsolete if the computer is shut down.
Stored as a property, the information does of course persist through relaunches -- but also through restarts. Thus, after a restart, the script immediately starts working with obsolete information.
I'm looking for a way of clearing the property, but only after the computer is restarted. The only approach that comes to mind is to write another script which clears the property and include it as a login item -- but I'd prefer a simpler approach. Anybody?

Hello
Your script will fail, e.g., in the following scenario:
1) Run the script at 60 seconds after a restart.
2) Restart the computer.
3) Run the script at 65 seconds after the last restart.
After 1), TicksAtPreviousLaunch = 60 * 60.
In 3), property won't be reset though the script is run for first time after the last restart because TicksAtThisLaunch = 60 * 65 > TicksAtPreviousLaunch.
Instead, you may try something like this alternative.
-- SCRIPT1
(* using 'the ticks' of Jon’s Commands (provided that 1 tick = ca. 1/60 second) *)
property lastStartup : (current date) - ((the ticks) div 60)
property lastLaunch : lastStartup - 100
property runCount : 0
initAtFirstRunSinceRestart()
set runCount to runCount + 1
return runCount
on initAtFirstRunSinceRestart()
set lastStartup to (current date) - ((the ticks) div 60)
if lastLaunch < lastStartup then -- 1st launch since last startup (or last compilation)
set lastLaunch to current date
set runCount to 0 -- initialize some properties
end if
end initAtFirstRunSinceRestart
-- END OF SCRIPT1
A few other things.
• As far as I know, Jon's Command is PPC only and cannot be used in x86 Mac.
• In order to pass a name of property to a handler that will set the property's value, you'll have to pass reference to the property and dereference it in the handler. Something like this, if you really want to do it...
-- SCRIPT2
property x : 0
init(a reference to x)
return x
on init(xref)
set xref's contents to 1
end init
-- END OF SCRIPT2
Hope this may help,
H
<br>
  Mac OS 9.1.x  

Similar Messages

  • I did a clear data and reset on my ipod touch and upon restart it is frozen. How do I fix it?

    I did a clear data and reset on my ipod touch and upon restart it is frozen. How do I fix it? I have already done the ten second hold restart with the top button and bottom button, but it still freezes. What should I do?

    If the Reset doesn't work, try a Restore.  Note that it's nowhere near as quick as a Reset.  Connect via cable to the computer that you use for sync.  From iTunes, select the iPad/iPod and then select the Summary tab.  Follow directions for Restore and be sure to say "yes" to the backup.  You will be warned that all data (apps, music, movies, etc.) will be erased but, as the Restore finishes, you will be asked if you wish the contents of the backup to be copied to the iPad/iPod.  Again, say "yes."
    Finally, if the Restore doesn't work, let the battery drain completely.  Then recharge for at least an hour and Restore again.

  • Vertical color bars appear upon restart

    vertical color bars appear upon restart -- why -- tower brand new.

    I too have an Apple 21" Studio Display. I love it as it is very accurate for print based graphic design.
    I also get the weird color bars. Used to work fine on my G4, but on my G5 dual 2g I get the weirdness. Could be the VGA to DVI deal.
    I remedy this by going to the display preferences and changing the resolution to another setting. That clears the mess and then I change it back.
    Simple and quick! Other than that I have no perminant answer.

  • Prompted to install Yahoo Messenger upon restart even though already installed

    I have Yahoo Messenger (3.0.1 beta) installed on my MacBook Air (Lion OS X 10.7.2). It is working fine, however every time I restart my computer and access the Flash Drive (Go - Computer) or the Applications Folder (Go - Applications) I'm prompted to install Yahoo again. I get a Yahoo Messenger installation dialog box asking me to install it. The only way to get rid of this dialog box is to accept the Yahoo agreement and go to the next step for installation - dragging the Yahoo icon into the applications folder. At this stage I can either drag the icon and replace the current one, or just close the drag dialog window. Either way my Yahoo Messenger works fine. If I click the "decline" button the installation dialog box just reappears until I click the "accept" button.
    I like to have Yahoo Messenger installed because it allows me to chat with 2 different Yahoo ID's simultaneously - one in iChat and one in Yahoo Messenger.
    I contacted Yahoo, but was give this info:
    "As of November 15, 2011 Yahoo! Customer Care will no longer provide agent support for Yahoo! Messenger for Mac. If you continue to use this product and have questions or concerns about it, please use the self-service help pages".
    This is a brand new computer (and my very first Mac) and Yahoo Messenger was the very first program I installed. Despite the annoyance upon restart I can use both programs (iChat and Yahoo Messenger) together without problems.
    I have tried removing all traces of the Yahoo Messenger program using "Appcleaner" and downloaded it again and reinstalled it from scratch, but to no avail.
    I would really appreciate some help with this problem.
    Thanks in advance.

    Hi,
    Ok so the Internal "Drive" on your Mac is a Solid State one ?
    You say you put an Shortcut/Alias of it on the Desktop.
    Was this by going to the Finder's Own Menu > Preferences > General section and ticking the Box to Show Hard Drives/Disks ?
    If I "Open" (double Click) an .dmg to Install something I get an icon on the Desktop that looks like  Drive icon (Similar to the USB stick ones) AND I get the item listed as  a "Device"  (in this case GoogleEarth)
    I tend to Drag these to the trash when Finished with them as it "Unmounts"/"ejects" the item.  (I used the quotes to show it is a similar action to removing a USB Drive - obviously a CD or DVD would also pop out of the Optical Drive)
    Based on the way you describe using the Finder > Go Menu > Computer It get this view
    As I Unmount mine I can't really say what happens if I shut the computer down.
    As technically it is a Window (the OS sees icons on the Desktop as windows) then I can imagine Lion is Opening it up again if it was there at Shutdown.  (See Message at Shutdown about restating open Windows on next boot and also the System Preferences > General Section).
    I will try shutting down and will post after I have done that
    8:04 PM      Wednesday; December 7, 2011
    Please, if posting Logs, do not post any Log info after the line "Binary Images for iChat"
      iMac 2.5Ghz 5i 2011 (Lion 10.7.2)
     G4/1GhzDual MDD (Leopard 10.5.8)
     MacBookPro 2Gb (Snow Leopard 10.6.8)
     Mac OS X (10.6.8),
    "Limit the Logs to the Bits above Binary Images."  No, Seriously

  • HT201407 Hi, I upgraded my Iphone 3gs from version 4.1 to 6.0.1 but upon restarting, the sim card is no longer recognized, i cant restore with itune nothing at all!! i'm so confused and ****** off... please provide any help

    Hi, I upgraded my Iphone 3gs from version 4.1 to 6.0.1 but upon restarting, the sim card is no longer recognized, i cant restore with itune nothing at all!! i'm so confused and ****** off... please provide any help

    Is the SIM from the carrier the device is locked to?
    Has the device ever been hacked or jailbroken?
    Have you tried simply removing and re-installing the SIM?  What about replacing the SIM?

  • Macbook Pro seems to be bricked by ML install. Upon restart it shows a progress bar which makes it to about 15%, and then the machine simply shuts off. Help?

    Title pretty much says it all. Install seemed to be going fine, then upon restart it hit a gray screen with a progress bar for about 30 seconds. Once the progress bar makes it to about 15% the machine simply shut off. I tried turning the machine on again a few times, but each time I had the same issue. I then tried running the 10.8 recovery disk, but it just showed the gray spinning wheel for about 6 hours. Any ideas?

    Something similar issue with me too. Intallation went fine. Then it started updating java once reboot it got stuck on grey screen. It wont boot at all. That spinning wheel keeps on going forever. :(

  • Mac randomly crashes, screen turns green and white, and it works fine upon restart. What causes this and how can I fix it?

    My MacBook Pro 13 inch (I've had it for about a year and a half) has started crashing randomly. It happens about once a week and it will happen when I'm in the middle of either watching a video, typing a paper, playing a game, etc. The computer clicks loudly and the screen becomes a series of green and white lines. It works fine upon restart, but it's still annoying whenever it happens. What causes this? Is it fixable?

    The image suggests an issue with the graphics board.
    The issue may happen more when your machine is generating additional heat, as when you're watching or processing video, or gaming. I can't say for certain, of course, but certain things will reduce the chance of the problem recurring:
    1. Keep your machine as cool as possible. When there's additional heat, turn up the fan, or use an app like HD Fan Control to reduce the heat. Use your computer the way you see fit, but be conscious of heat.
    2. Back up on a regular basis. Logic board problems can lead to more serious issues down the line, so backing up is a good way of safeguarding your data.
    3. Look up "Logic Board Woes" on Google for a comprehensive discussion of the issue.

  • CSS problem with the clear property

    This is my actual page
    http://www.martcol.co.uk/abba/
    and I want to swap the paragraphs around. This is what I come up
    with
    http://www.martcol.co.uk/abba/test/test01.php
    I reckon I am getting muddle with the whole clearing the
    float thing.
    Many thanks
    Martin
    Actually, I think it only breaks up in Firefox - bear in mind
    I only tested in IE6 and FF

    http://martcol.co.uk/abba/pages/patch.php
    Oh dear, another problem with my floated elements and the
    clear property....
    Martin
    I think I have this now. Not sure why but picking away at it
    has it fixed.

  • Resetting settings upon restart.  Keyboard won't recognize

    ok so i have this problem, when i restart every time it can't seem to find my keyboard and mouse, i end up having to take they keyboard/mouse out of its original port move it to another one plug the mouse in separately and then it will recognize, then when its restarted i can put it back into the old configuration. Anyone know what the crap is going wrong?
    second problem may be related, upon restart of computer i have to to reset all my preferences in system preferences. I.E. what output port for audio, turn on firewall, and others like that.
    just so you know i did use the transfer wizard to transfer the applications.

    ok i should have remembered about that. It seem to have fixed the remembering settings thing but now one of my usb ports stopped responding. I loaded the install cd and ran system profiler and it shows up under the install. then i restarted and now it seems to have done something because it shows up now. I don't know if it will go away if i restart though.

  • Will the Display Menu app hold mirrored settings upon restart?

    I work at a College and manage over 100 classroom computers. In each classroom the computer is connected to a projector. When we moved to Mavericks we lost the majority of display resolutions formerly available to us and unfortunately, none of the remaining resolutions match the native resolution of our projectors. We primarily set up our computers and projectors in mirrored mode.
    I've been testing a couple apps that help uncover the hidden resolutions. These are: Display Menu, Display Maestro and Switch ResX. All the apps give me the resolution variety I've been looking for but only Switch ResX holds the settings I choose upon restarting the machine. Display Menu and Display Maestro are much cheaper so, I was hoping to use those if possible. Does anyone know how to get either to hold their settings upon restarting? Does anyone recommend Switch ResX ? Any other display apps I should try?
    Thank you.

    Try rebooting the STB and then change the clock setting and change it back. That worked for me when i had this issue. I have seen this reported a couple of times and most of the time if this fix didnt work, the issue resolved itself within a couple of days.
    Also, it should be noted that with the 1.7IMG release they changed the way the front display functioned. It now changes to show the channel number at every program change and then reverts back to showing the clock after about 2 minutes.
    "If your problem has been solved, please mark it as such. Don't forget to hand out your Kudos!"

  • How do I get windows to stay open upon restart?

    I keep my desktop very orgainized. I want my 2 windows to stay open at all times - my HD and my General folder. All files are in one of these and I have thousands of files (graphic designer). The box is checked to reopen all windows upon restart but they never do. And when I double click the HD icon I have to resize it and put it where I want it on the desktop and then I open my General folder and resize and reposition that. I want them to stay as I set them up, like they always did in 10.8. Any help??

    You posted to the older PPC macs that were built before 2006.
    You could write an applescript app and put it in your login items.
    tell application "Finder"
            open folder "Applications" of startup disk
            select Finder window 1
            set bounds of Finder window 1 to {-3, 44, 691, 545}
            --set position of Finder window 1 to {33, 44}
            set position of Finder window 1 to {60, 45}
            activate
    end tell
    --------------------------------- This is an example.  It usese a different applescript program.  It is an example ----------------
    Here is how to create an Applescript Application. 
    Here is the program:
    https://discussions.apple.com/thread/3033221?tstart=30
    Required:
    Turn on accessability GUI in system preferences.
    Optional:
    Full Key Codes
    http://www.versiontracker.com/dyn/moreinfo/macosx/21215
    youpi or iKey
       youpi and iKey are keystroke remapping programs.
       youpi, the free version, works fairly well for me in Mac OS 10.4 although not officially supported.
    http://www.versiontracker.com/dyn/moreinfo/macosx/11485&vid=75326
       iKey is the paid version
    http://www.scriptsoftware.com/ikey/
    on run
        -- Write a message into the event log.
        -- To see, run this applescript in Sript Editor. Click on Event Log tab at bottom of screen.
        -- Click run.
        log "  --- Starting on " & ((current date) as string) & " --- "
        set fromApp to "Safari"
        set toApp to "TextEdit"
        --- We have arrived.
        say "we are beginning now."
        -- Start your application
        tell application fromApp
            activate
        end tell
        delay 1
        say "copy data to clipboard"
        tell application "System Events"
            tell process fromApp
                keystroke "c" using command down
                delay 2
            end tell
        end tell
        -- Start your application
        tell application toApp
            activate
        end tell
        delay 5
        tell application "System Events"
            tell process fromApp
                --  open file menu
                keystroke return
                keystroke return
                keystroke return
                keystroke "v" using command down
            end tell
        end tell
        say "good news, We are done."
    end run
    The first thing that you need to do is to make the text into an AppleScript program.
    Start the AppleScript Editor
    /Applications/AppleScript/Script Editor.app
    In Snow Leopard it's at: /Applications/Utilities/AppleScript Editor
    Copy the script text to the Applescript editor.
    Save the text to a file as an application and do not check any of the boxes below.
    If you want access to the script from your Script Menu, move the script (the saved script application file) to your
    ~/Library/Scripts folder. You can also drag it to your Dock or make an alias for it on the Desktop.<br><br>
    To debug, run the script within the Applescript Editor. Click on the event log tab at the bottom of the window. Click  on the run icon.  The results from the log statement will be shown at the bottom of the screen.

  • Menu and Bookmark toolbars are missing upon restart of Firefox, although they are recoverable by left clicking on remaining toolbar. V31 and Windows 7.

    As question states, the menu toolbar and bookmark toolbars are missing upon restart.
    Both are fully recoverable as customized, but then disappear again upon restart.

    I deleted the localstore.rdf.
    But, I usually run Norton's Utilities 2012 "clean disk" upon closing down computer. The problem is something Norton is doing.
    Firefox is storing my configuration/profile related to showing the two toolbars in some fashion (perhaps as a temp file), that Norton is erasing it.
    Norton isn't deleting the customization/uniqueness of the toolbars.
    Just that they don't show upon restarting.
    There is probably a way for Firefox to store this "permanently".
    Thanks for the help so far. The fix may not be something Firefox can do.

  • Upon restart system folder can not be found

    No problems with machine since last Oct. when I had to replace a stick of ram.
    Run down of what has been happening now:
    Last week - machine was up and running. Went to start Mail (had it open earlier in day) and got spinning ball of death. Could not force quit. Upon restart system folder could not be found. Restarted again, started up fine.
    Yesterday - went to log on in log in screen and once again spinning ball. Upon restart could not find system folder. This time had to restart 4 times and after cutting power and restarting then system folder was found.
    I have repaired premissions, verified disk (ok), ran scripts, made sure software was updated, made sure right startup disk was selected. Found 1 bad font, removed this, re-ran everything, rechecked fonts. CS3/safari/mail seem to be running fine. Although I have not done a lot with them as I'm slow with work this week. Hard drive does not sound like it's making any extra noise. Thought this problem might be fixed. As machine was fine this a.m. shut down machine about an hour ago thinking I wasn't going to use for a day, remembered I had to do something and upon restart again, no system folder. Had to cut power again and then starts up. What could be going on?
    Any suggestions? Ideas?
    Thanks in advance.

    Disk utility shows disk being verified & ok.
    One thing I didn't think of was resetting the PRAM.... which I found this advice under: Recent User Contributed Tips: a brody - Myths of required versus not required maintenance for Mac OS X (Oct 30, 2008)
    3. Repairing the directory. Partially false. Only required if your data is backed up, and access to your files suddenly is limited even after Spotlight indexing is complete. More true if you get a flashing ? disk, though zapping the PRAM sometimes fixes this issue as well.
    after doing this so far no problems.

  • My computer just shut itself down and upon restarting it now will not accept my password to log into my computer desktop

    My computer just shut itself down and upon restarting
    it now will not accept my password to log into my computer desktop
    How can I reset my password!!

    This Apple article has some possible solutions.
    Best of luck.

  • I installed the 829mb Apple software update on my 2011 Macbook Pro. Upon restart, it crashed.  Error message: Panic CPU  0 caller 0xffffff800064ba7b Unable to find driver for this platform \"acpi"\\n"@/sourcecache/xnu/xnu-1699.26.8/iokit/kernel/10platfor

    I installed the 829mb Apple software update on my 2011 Macbook Pro. Upon restart, it crashed.  It instructed me to hold power button to shut off and then press again to restart.  Same error message keeps coming up and computer won't boot to home screen.
    Error message:
    Panic CPU  0 caller 0xffffff800064ba7b Unable to find driver for this platform \"acpi"\\n"@/sourcecache/xnu/xnu-1699.26.8/iokit/kernel/10platform
    \"acpi"\\n"@/sourcecache/xnu/xnu-1699.26.8/iokit/kernel/10platformexpert.cpl:150 4
    Debugger called panic
    Kernal uuid a8ed611fb0f-3729-8392-e7a32c5e7d74
    THANKS FOR ANY HELP.
    ROBB

    Boot into Recovery by holding down the key combination command-R at the startup chime. Release the keys when you see a gray screen with a spinning dial.
    Note: You need an always-on Ethernet or Wi-Fi connection to the Internet to use Recovery. It won’t work with USB or PPPoE modems, or with networks that require any kind of authentication other than a WPA or WPA2 Personal password.
    When the Mac OS X Utilities screen appears, follow the prompts to reinstall the Mac OS. You don't need to erase the boot volume, and you won't need your backup unless something goes wrong. If your Mac didn’t ship with Lion, you’ll need the Apple ID and password you used to upgrade, so make a note of those before you begin.
    Don't install the Thunderbolt update -- it's defective.

Maybe you are looking for

  • An error occurred while verifying disc.

    Hi, whenever I try to burn a CD (any brand) the burn goes through ok and when it gets to verify (any cd burning software) it says "This disc may not work. An error occurred while verifying disc." I have reinstalled, clean installed, done everything e

  • Object '43TH...' (ROUT) of type 'Routine' is not available in version 'A'

    Hello all, I having this situation, first let me tell you that we have transported the queries from dev to qa and then we had to open the qa system to modify our queries. There were a lot of modifications done to the queries in QA and so now I am try

  • Page Curl on a mobile phone

    Does anyone know how to create a page curl effect on the screen of a mobile phone? The effect I am trying to create is to show screen with a screen protector on.

  • Use Enter key to execute report.

    I have a report that needs to be executed in background.It has a selection screen.The program should get executed when user presses 'ENTER' while he is inside the selection screen.At present,when 'ENTER' key is pressed,only validation is done.To exec

  • Maverick will not wake up from sleep

    Maverick will not wake up from sleep. i dont see any related issues. maybe i am the only one? Ive been trying to run maverick for the last 2 months. I thought everything was fine after I erased, reformated and partitioned the HD and installed Maveric