Loosing database and preferences on power loss

If I don’t get to a power cord quick enough for me that’s not really an “abnormal” situation. I’m not expecting to have to add all my databases again on restarting.
I loose Media Preferences and like I said , all View preferences. Also the window size changes radically.
The ‘Already in Use’ error seems odd if the data bases are not loaded.

Me neither but it is a possibility that what I’m saying might have happened?

You dont have to ”add your databases”. You merely need to open them and yes, the warning will be issued for each database that was open.

Also, I strongly suggest you pay closer attention to the battery status on your Mac - and show it in the menubar if you aren’t already.

You should also consider investing in a portable power adapter for emergency situations.

Sorry but that’s not an acceptable response and I object to you treating your customers like they are stupid. “Oh I didn’t realise I could get a portable power supply” How rude.

I have been running Macs for over 20 years and I have NEVER had to deal with a situation where an app looses its basic functionality in a really common situation like this where a Mac goes to sleep but then does not wake up.
I suggest you go out and look at your code.

I will now not use this forum again, I find the overall tone unacceptable. You need to do some basic customer relations courses… there are several online ones available.

Goodbye.

The app does not lose basic functionality. I have experienced many abnormal Mac shutdowns (it’s what happens when you experiment with beta OSes) and have never lost data as a result. I’ve seen the “Already in use” message many times and not lost any data as a result.

1 Like

ANP: When you post a question on a forum and the resulting answer is not what you “want”, suggestion is to step back. Posting a passive-aggressive response does NOTHING to help you or the others who rely on these forums for insights and answers.

If you have been running “Macs for over 20 years” these suggestions should not have come as any surprise to you.

2 Likes

Hey, in case you’re still listening. I think that the issue is that your post includes some fairly loaded terms (in English, at least) that different people may interpret different ways. The way I interpret those terms, your original post is confusing to me, but that doesn’t make it wrong, of course.

The first confusion for me is that if you’re using a laptop running macOS and it gets low on battery, then it should trigger the deeper of the two possible sleep modes and, once power is restored sufficiently, you should be able to come back and pick up where you left off. This shouldn’t normally require a reboot, but sometimes that goes awry.

If it does come back as a reboot, then the computer has essentially crashed the OS and none of the applications have had a chance to exit properly, DT included. That’s what people mean by “abnormal.”

No one is saying that your battery running low is “abnormal,” but your computer needing to “reboot” (your words) is NOT normal, but certainly I’ve had it happen as well.

Next… DT, like many pieces of software, generates lock files on disk so that you don’t do something like try to open the database on two computers at once. If DT does not shut down properly (because it crashes or the computer crashes), then you get a warning message “Database already in use.” If you simply select “Continue,” then your database should be there just fine and you shouldn’t need to “reload” anything. As Bluefrog mentioned, it’s not a bad idea to verify the database in case a write was happening when the computer crashed which, like it or not, is what happened if you needed a REBOOT after going to sleep.

I hope that’s helpful and makes sense.

1 Like

Sure, I suppose. There’s a non-zero probability that any software misfires.

Weisen…thanks.

What is loaded in my post?! I’m English, it’s the only language I speak I was born in England. Please tell me what is loaded in the words above. What I got was a ‘loaded’ response from ‘korm’ and then frankly a totally obnoxious response from Blue Frog.

I repeat…there was nothing loaded in my original post. Perhaps I didn’t explain clearly, granted.

As to the issue: normal and abnormal. OK, it’s not normal…but it’s very common for a Macbook to do this…they do it all the time: I’ve have owned about ten different models over the years and they all have done it. Any my point was that other apps don’t loose their marbles as DT does when this power loss happens.

As I said, I give up on this forum, it’s full of smart arses, present company excepted.

Goodbye again

“Abnormal” means the app crashes, was force quit, or the machine was force shut down. Those things do not occur in normal operation. DEVONthink does not normally crash when the machine sleeps (causing the “in use” messages when it is launched after the machine reboots).

“Abnormal” is not an accusation or inference of incompetence, or any sort of judgment. If the OP read something into my words that the response was negative, sorry. Not true.

I’m not sure if this is what you’re talking about here, but I too found that DEVONthink 3 (which is still a Beta…) “looses” open databases sometimes when something goes wrong (but I never lost preferences or data).

Opening the databases manually that were open before a (forced) quit became a little bit annoying after some time (and I guess this is what the OP is experiencing?) so I added “default databases” to a script I used to open databases.

If that’s not helpful to the OP it would be great to get at screenshot or a more detailed description what’s going on as I’m also on a MacBook Pro 2012 and could try to reproduce.

property thePath : "/DEVONthink Datenbanken/"

set preferredDatabases to {} -- "default" databases

tell application "Finder"
	try
		set theFiles to files of folder (POSIX file thePath as alias)
		set allDatabases to {}
		repeat with thisFile in theFiles
			set theDatabase to my Remove_From_String(name of thisFile, ".dtBase2")
			set end of allDatabases to theDatabase
		end repeat
		
	on error error_message number error_number
		if the error_number is not -128 then display alert "DEVONthink" message error_message as warning
	end try
end tell

tell application id "DNtp" to set openDatabases to name of databases

set theDefaultItems to preferredDatabases & openDatabases
set theDefaultItems to my dedupList(theDefaultItems)
set theDefaultItems to my sort_list(theDefaultItems)

tell application "System Events" to set activeApp to name of first application process whose frontmost is true
tell application "SystemUIServer"
	activate
	set openOrCloseDatabases to choose from list allDatabases with title "Open or close database" default items (theDefaultItems) with multiple selections allowed and empty selection allowed
	
end tell
activate application activeApp
if openOrCloseDatabases is false then return

tell application id "DNtp"
	
	repeat with thisDatabase in allDatabases
		if thisDatabase is in openOrCloseDatabases then
			open database thePath & thisDatabase & ".dtBase2"
		else if thisDatabase is not in openOrCloseDatabases and thisDatabase is in openDatabases then
			close database thisDatabase
		end if
	end repeat
	
	activate
end tell

on Remove_From_String(theText, CharOrString)
	local ASTID, theText, CharOrString, lst
	set ASTID to AppleScript's text item delimiters
	try
		considering case
			if theText does not contain CharOrString then ¬
				return theText
			set AppleScript's text item delimiters to CharOrString
			set lst to theText's text items
		end considering
		set AppleScript's text item delimiters to ASTID
		return lst as text
	on error eMsg number eNum
		set AppleScript's text item delimiters to ASTID
		error "Can't RemoveFromString: " & eMsg number eNum
	end try
end Remove_From_String

on dedupList(theList)
	set dedupedList to {}
	repeat with thisItem in theList
		set thisItem to thisItem as string
		if thisItem is not in dedupedList then set end of dedupedList to thisItem
	end repeat
	
	return dedupedList
end dedupList

on sort_list(theList)
	set old_delims to AppleScript's text item delimiters
	set AppleScript's text item delimiters to {ASCII character 10} -- always a linefeed
	set list_string to (theList as string)
	set new_string to do shell script "echo " & quoted form of list_string & " | sort -f"
	set new_list to (paragraphs of new_string)
	set AppleScript's text item delimiters to old_delims
	return new_list
end sort_list

I have experienced similar problem but on iMac desktop and DT office pro. I used to overcome the problem by force quit but later solved the issue by deselecting in preferences always check for updates.

It would be simpler to just open your databases folder, select the items, and press Command-down arrow to open them.

Also, if a database is already open, explicitly requesting it to open will have no ill effect. It’s essentially ignored.

Lastly, you can easily create a workspace with specific databases open and activate it. This will open the databases that were open at the time you created the workspace. Bear in mind, it will still issue the warning after an abnormal termination of the app.

Thanks for the hint on not asking if a database is opened already, didn’t try (and don’t know why).

But, in my opinion it’s definitively not easier to go to the Finder folder and select all databases I’d like to reopen. I’m sure sure this is not the first kind of script for this task and I’m sure you’re quick with shortcuts, but give it a try - if you know which databases you want to reopen after a forced crash (in DEVONthink 3 Beta) then it’s a nice script as you can prepopulate it :slightly_smiling_face:

Did you try the workspaces option I suggested?

And are you writing all the script from scratch or piecing it together from various sources?

I do this and then assign a custom key command, so I have a quick way to switch among databases when the sidebar is closed (like it usually is).

1 Like

Nice! I have a set for support that I occasionally use. Usually, after I have been doing support for some hours and have all manner of windows everywhere and I’m lost :stuck_out_tongue:

I know of this option but after trying it for some time didn’t stick to it (as I’m not so far already. But I think it will get very helpful if everything’s set up).

Nearly every handler I use was written by somebody else (and I got most of them from a page that seems to be down since some months but if anyone’s interested I would be lucky to share it here.)

I don’t write scripts from scratch, I’ve built several Typinator snippets and they make trying out things very easy (that’s were silly ideas come from too). And I’m a heavily user of script libraries as I got tired of replacing “old” code with new knowledge (I adopted this from Keyboard Maestro).

Truthfully, this has been an irritating issue for me for years – I’ll have several tabs or ‘files’ open (I think that’s what you’re calling “databases” - which for me, are ‘folders’ or ‘groups’ in DT) and then I’ll go to re-launch DT and ‘poof’ everything’s blank, no tabs in sight. And then I have to start from scratch to try to remember which ‘files’ I had open. And that’s a bit annoying. I guess I’m expecting an opportunity to “restore previous session” as I get when I re-boot browsers.
A few years ago DT help suggested something like you suggest here, “create a workspace with specific databases open and activate it. This will open the databases that were open at the time you created the workspace”.
This has never worked very cleanly for me, meaning I might not be doing this correctly. I see a “workspaces” option under the “Go” menu, I’ll press “Add” which I’m guessing is to ‘activate’ it but that does nothing in my experience.
I’d appreciate more info about this.
And I’m not a coder, I’m a researcher working on the fly with hundreds of DT ‘files’ grouped in 7-8 Databases. So I’m not looking for a ‘Scripting’ solution, I’m looking for something easier!
Thanks (And, BTW, I’ve always had really helpful support from the tech team at DT. Always.) I appreciate it.

  • michael maser

This is intentional, e.g. otherwise a crash because of a corrupted document (e.g. PDF or web archives) or database would crash the app again and again after launching.

1 Like

Hi
I’m the OP here and I would …in the spirit of learning… like to make the point that I felt extremely unhappy by Blue Frog’s response to what it now turns out was a problem that many DevonThink users are suffering from.
It might seem to a moderator that the way their software works makes total sense to them but it clearly does not make sense to many users.
I think this is expressed in the michaelmaser’s post really clearly.
And this is not because we need to read the manual. Or follow the advice given to me: “I strongly suggest you pay closer attention to the battery status on your Mac - and show it in the menubar if you aren’t already.” and “You should also consider investing in a portable power adapter for emergency situations.”

Not really OK in my opinion. The point was…“what gives with DevonThink? Maybe you guys need to look at this…this is a really bad way of doing things” as many posters since are expressing.

I rest my case, and like I said before I will not use this forum because of this attitude problem.