• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Error -10000 for one user
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Error -10000 for one user


  • Subject: Re: Error -10000 for one user
  • From: Yvan KOENIG <email@hidden>
  • Date: Fri, 22 Apr 2016 12:39:09 +0200

If there may be several folders whose name starts with Dropbox you may use this piece of code.

set p2Home to path to home folder as text
set p2ApplicationSupport to p2Home & "Library:Application Support:"
set prefName to "DropBoxName"
set prefFile to p2ApplicationSupport & prefName

tell application "System Events"
set prefAvailable to exists file prefFile
end tell
if not prefAvailable then
tell application "System Events"
set DropboxFiles to (name of every folder of p2Home whose name starts with "Dropbox")
end tell
set trueDropbox to choose from list DropboxFiles
if trueDropbox is false then error number -128
set trueDropbox to item 1 of trueDropbox
my writeto(prefFile, trueDropbox, text, false)
else
set trueDropbox to read file prefFile
end if
set p2Dropbox to p2Home & trueDropbox

#=====
(*
Handler borrowed to Regulus6633 - http://macscripter.net/viewtopic.php?id=36861
*)
on writeto(targetFile, theData, dataType, apendData)
-- targetFile is the path to the file you want to write
-- theData is the data you want in the file.
-- dataType is the data type of theData and it can be text, list, record etc.
-- apendData is true to append theData to the end of the current contents of the file or false to overwrite it
try
set targetFile to targetFile as «class furl»
set openFile to open for access targetFile with write permission
if not apendData then set eof of openFile to 0
write theData to openFile starting at eof as dataType
close access openFile
return true
on error
try
close access targetFile
end try
return false
end try
end writeto

#=====

At first run it will ask the user to choose the folder to use and write it in a text file stored in Application Support folder.
At other runs it will read the name to use in the text file.


Yvan KOENIG running El Capitan 10.11.4 in French (VALLAURIS, France) vendredi 22 avril 2016 12:38:49



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >Re: Error -10000 for one user (From: Steve Mills <email@hidden>)
 >Re: Error -10000 for one user (From: RJay Hansen <email@hidden>)
 >Re: Error -10000 for one user (From: Yvan KOENIG <email@hidden>)

  • Prev by Date: Restore FastScripts Keyboard Shortcuts from Backup
  • Next by Date: Re: Acquiring the Dropbox Folder Path $)A!z was: Re: Error -10000 for one user
  • Previous by thread: Re: Error -10000 for one user
  • Next by thread: Re: Error -10000 for one user
  • Index(es):
    • Date
    • Thread