Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to look for a way to set reminders between my homepc and work pc. And I need it something like this:

  1. I put a text file in dropbox on homepc, and let it get uploaded to dropbox (synced)
  2. When I open my WorkPC, the file gets downloaded to my pc via dropbox.
  3. The program on my workpc sees a modified file in the dropbox folder, and opens it.

This way whenever I set changes to that text file, the program (homepc or workpc) opens it on windows start. This should only occur once on startup, and should be set up on both the homepc and the work pc?

Can this be done by a batch script? Or some freeware/portable (preferably portable!)

Another Alternative could be, it just copies the modified text file from the dropbox folder to the desktop. My desktop on both PC's is clean (without any icons), so any file copied to desktop is clearly visible and then I can just see the reminders and delete the copied text file... This could be easy, but I don't know batch script programming..

Thanks!

share|improve this question
    
How about just dragging the .txt file into your Startup folder in the Start menu? –  Oliver Salzburg Jun 13 '13 at 19:29
add comment

1 Answer

up vote 1 down vote accepted

This should be doable.

It's already possible using Dropbox and torrents using utorrent. You have utorrent check a folder in your Dropbox for torrents, and if it finds one, it loads it and then deletes it (if you want).

I would dedicate a folder for this use. Use login scripts such that when you log in (there really isn't a way of going by startup), it will check the dropbox folder, and then bring it up in the editor of your choice. You may want the script to wait 30 seconds or so to make sure that Dropbox is running and has completely synced.

So a psuedo login script for both computers would look like this.

@echo off
wait 60 : seconds, hopefully
if exist d:\Dropbox\Reminders\* uedit32 d:\Dropbox\Reminders\*

This waits one minute and then, if there are files in that directory, use my editor to open up every file that is in that directory

d:\Dropbox\ would be your Dropbox location. Mine is actually d:\dropbox\dropbox (and used to be d:\My Dropbox\Dropbox ...)

Alternatively, I guess:

for %%j in (d:\Dropbox\Reminders\*) do notepad %%j

would then bring up each individual in the directory. Replace notepad with your editor of choice. My original works with my editor. :p

You would then be responsible for deleting them from the directory.

If you just want to bring up the NEW reminders, put the new reminders in Reminders, and keep the old (still worthwhile reminders) around,

@echo off
wait 60 : seconds, hopefully
for %%j in (d:\dropbox\reminders\*) do (move %%j d:\dropbox\oldrems & youreditor "d:\dropbox\oldrems\%%~nxj")

Again, we wait 60 seconds to get dropbox loaded and synced. Then, for every reminder in the new reminder folder, we move it to the old reminders folder (oldrems), and if successful, we then run youreditor on the new file.

The %%~nxj takes the batch variable j and strips it down to just the filename and extension. Otherwise it would render to d:\dropbox\oldrems\d:\dropbox\reminders\whatthefilenameis.ext See FOR /? for more information.

The problem with this is that there could be file name collisions. In which case, move will NOT move the file, and it will be kept there until you remove it, or remove the file collision and log in again, in which case it will then get moved.

Does this help?

EDIT: To open a file with it's default opener, replace youreditor with start ""

@echo off
wait 60 : seconds, hopefully
for %%j in (d:\dropbox\reminders\*) do (move %%j d:\dropbox\oldrems & start "" "d:\dropbox\oldrems\%%~nxj")

I always add "" as a title for start, because if you put your file in quotes (which I have done here, just in case the filename contains spaces) it will take the filename as the window name and then complain that there is nothing to open. Alternatively, if you are worried you may get a blank window title, you can just double the "d:\dropbox\oldrems\%%~nxj"

start "d:\dropbox\oldrems\%%~nxj" "d:\dropbox\oldrems\%%~nxj"

Which would then give you the name of the file for the window title.

Windows 95/98(/ME?) used start.exe (start in Win NT and above is embedded in CMD.EXE), and it never suffered this problem (and exists in my library as st.exe ;) )

Technically, just

"d:\dropbox\oldrems\%%~nxj"

should work. But not always. start "" "d:\dropbox\oldrems\%%~nxj" always does.

This will start all executable programs, so if you just want to have a .CMD file for further editing, you will have to change the extension, otherwise it will actually execute the .CMD file. Same with .BAT, .COM, .EXE, .PS1, .VBS and any other extensions. You have been warned.

share|improve this answer
    
Thank bytehead! –  mk117 Jun 15 '13 at 5:18
    
One question: Instead of asking for the file to open in youreditor, which is notepad for text and photoshop for psd... can this script be changed to just open the files irrespective of program-preference? For eg., if I keep three files, txt, jpg, and psd, then an "open" command only could open these files in their default programs? –  mk117 Jun 15 '13 at 6:31
    
Hopefully my edit shows you the way to do what you want. –  bytehead Jun 15 '13 at 15:36
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.