p r o p e r t y   p r e f s F i l e N a m e   :   " c o m . a p p r e n t i c e a l f . d e d r m . p l i s t " 
 
 p r o p e r t y   t e m p F i l e N a m e   :   " D e D R M _ t e m p . l o g " 
 
 p r o p e r t y   p r e f s F o l d e r N a m e   :   " c o m . a p p r e n t i c e a l f . d e d r m " 
 
 p r o p e r t y   n e w K e y s F o l d e r N a m e   :   " n e w K e y s " 
 
 p r o p e r t y   h a n d l e d E x t e n s i o n s   :   { " e p u b " ,   " p d f " ,   " p r c " ,   " a z w " ,   " a z w 1 " ,   " t p z " ,   " a z w 3 " ,   " a z w 4 " ,   " m o b i " ,   " p o b i " ,   " p d b " } 
 
 
 
 g l o b a l   p y t h o n 
 
 g l o b a l   o l d A p p l e S c r i p t 
 
 
 
 g l o b a l   e R e a d e r T o o l 
 
 g l o b a l   M o b i p o c k e t T o o l 
 
 g l o b a l   K i n d l e P I D T o o l 
 
 g l o b a l   B N K e y G e n T o o l 
 
 g l o b a l   B N K e y F e t c h T o o l 
 
 g l o b a l   B N e P u b T o o l 
 
 g l o b a l   K i n d l e K e y T o o l 
 
 g l o b a l   N o o k K e y T o o l 
 
 g l o b a l   A d o b e K e y G e n T o o l 
 
 g l o b a l   A d o b e e P u b T o o l 
 
 g l o b a l   e P u b T e s t T o o l 
 
 g l o b a l   A d o b e P D F T o o l 
 
 g l o b a l   Z i p F i x T o o l 
 
 g l o b a l   P r o g r e s s A p p 
 
 
 
 g l o b a l   P I D s 
 
 g l o b a l   U D I D s 
 
 g l o b a l   b n K e y s 
 
 g l o b a l   K i n d l e S e r i a l L i s t 
 
 g l o b a l   A n d r o i d K e y L i s t 
 
 g l o b a l   K i n d l e K e y L i s t 
 
 g l o b a l   A d e p t K e y L i s t 
 
 
 
 g l o b a l   E r r o r L i s t 
 
 g l o b a l   W a r n i n g L i s t 
 
 g l o b a l   C o m p l e t e d L i s t 
 
 g l o b a l   E r r o r C o u n t 
 
 g l o b a l   W a r n i n g C o u n t 
 
 g l o b a l   C o m p l e t e d C o u n t 
 
 g l o b a l   t o t a l e b o o k s 
 
 g l o b a l   c o m p l e t e d e b o o k s 
 
 g l o b a l   o u t p u t F o l d e r 
 
 g l o b a l   l o g F i l e P a t h 
 
 g l o b a l   t e m p f i l e p a t h 
 
 
 
 g l o b a l   p a r a e n d 
 
 
 
 o n   w r i t e t o l o g ( l o g s t r i n g ) 
 
 	 t r y 
 
 	 	 s e t   f i l e R e f   t o   o p e n   f o r   a c c e s s   l o g F i l e P a t h   w i t h   w r i t e   p e r m i s s i o n 
 
 	 	 w r i t e   l o g s t r i n g   &   " 
 
 "   t o   f i l e R e f   s t a r t i n g   a t   e o f   a s    c l a s s   u t f 8  
 
 	 	 c l o s e   a c c e s s   f i l e R e f 
 
 	 e n d   t r y 
 
 e n d   w r i t e t o l o g 
 
 
 
 o n   c l e a r l o g ( ) 
 
 	 t r y 
 
 	 	 s e t   f i l e R e f   t o   o p e n   f o r   a c c e s s   l o g F i l e P a t h   w i t h   w r i t e   p e r m i s s i o n 
 
 	 	 s e t   e o f   f i l e R e f   t o   0 
 
 	 	 c l o s e   a c c e s s   f i l e R e f 
 
 	 e n d   t r y 
 
 e n d   c l e a r l o g 
 
 
 
 o n   c l e a r t e m p ( ) 
 
 	 t r y 
 
 	 	 s e t   f i l e R e f   t o   o p e n   f o r   a c c e s s   t e m p f i l e p a t h   w i t h   w r i t e   p e r m i s s i o n 
 
 	 	 s e t   e o f   f i l e R e f   t o   0 
 
 	 	 c l o s e   a c c e s s   f i l e R e f 
 
 	 e n d   t r y 
 
 e n d   c l e a r t e m p 
 
 
 
 o n   r e a d t e m p ( ) 
 
 	 s e t   t e m p C o n t e n t s   t o   " " 
 
 	 t r y 
 
 	 	 s e t   f i l e R e f   t o   o p e n   f o r   a c c e s s   t e m p f i l e p a t h 
 
 	 	 i f   ( g e t   e o f   f i l e R e f )   >   0   t h e n 
 
 	 	 	 s e t   t e m p C o n t e n t s   t o   r e a d   f i l e R e f   f r o m   1   a s    c l a s s   u t f 8  
 
 	 	 e n d   i f 
 
 	 	 c l o s e   a c c e s s   f i l e R e f 
 
 	 e n d   t r y 
 
 	 r e t u r n   t e m p C o n t e n t s 
 
 e n d   r e a d t e m p 
 
 
 
 o n   r e a d t e m p l i s t ( ) 
 
 	 s e t   t e m p l i s t   t o   { } 
 
 	 t r y 
 
 	 	 s e t   f i l e R e f   t o   o p e n   f o r   a c c e s s   t e m p f i l e p a t h 
 
 	 	 i f   ( g e t   e o f   f i l e R e f )   >   0   t h e n 
 
 	 	 	 s e t   t e m p C o n t e n t s   t o   p a r a g r a p h s   o f   ( r e a d   f i l e R e f   f r o m   1   a s    c l a s s   u t f 8  ) 
 
 	 	 e n d   i f 
 
 	 	 c l o s e   a c c e s s   f i l e R e f 
 
 	 e n d   t r y 
 
 	 r e p e a t   w i t h   n e x t L i n e   i n   t e m p C o n t e n t s 
 
 	 	 i f   l e n g t h   o f   n e x t L i n e   i s   g r e a t e r   t h a n   0   t h e n 
 
 	 	 	 c o p y   n e x t L i n e   t o   t h e   e n d   o f   t e m p l i s t 
 
 	 	 e n d   i f 
 
 	 e n d   r e p e a t 
 
 	 r e t u r n   t e m p l i s t 
 
 e n d   r e a d t e m p l i s t 
 
 
 
 o n   q u o t e d t e m p p a t h ( ) 
 
 	 s e t   t e m p F i l e   t o   P O S I X   p a t h   o f   f i l e   t e m p f i l e p a t h 
 
 	 r e t u r n   q u o t e d   f o r m   o f   t e m p F i l e 
 
 e n d   q u o t e d t e m p p a t h 
 
 
 
 o n   f o l d e r e x i s t s ( i n p u t F o l d e r ) 
 
 	 t r y 
 
 	 	 - - d i s p l a y   d i a l o g   " t e s t   - d   "   &   q u o t e d   f o r m   o f   ( P O S I X   p a t h   o f   i n p u t F o l d e r ) 
 
 	 	 d o   s h e l l   s c r i p t   " t e s t   - d   "   &   q u o t e d   f o r m   o f   ( P O S I X   p a t h   o f   i n p u t F o l d e r ) 
 
 	 	 r e t u r n   t r u e 
 
 	 e n d   t r y 
 
 	 
 
 	 r e t u r n   f a l s e 
 
 e n d   f o l d e r e x i s t s 
 
 
 
 o n   f i l e e x i s t s ( i n p u t F i l e ) 
 
 	 t r y 
 
 	 	 d o   s h e l l   s c r i p t   " t e s t   - f   "   &   q u o t e d   f o r m   o f   ( P O S I X   p a t h   o f   i n p u t F i l e ) 
 
 	 	 r e t u r n   t r u e 
 
 	 e n d   t r y 
 
 	 
 
 	 r e t u r n   f a l s e 
 
 e n d   f i l e e x i s t s 
 
 
 
 o n   G e t F i l e E x t e n s i o n ( f i l e N a m e ) 
 
 	 s e t   f i l e E x t e n s i o n   t o   " " 
 
 	 i f   f i l e N a m e   c o n t a i n s   " . "   t h e n 
 
 	 	 s e t   o l d T I D s   t o   A p p l e S c r i p t ' s   t e x t   i t e m   d e l i m i t e r s 
 
 	 	 s e t   A p p l e S c r i p t ' s   t e x t   i t e m   d e l i m i t e r s   t o   " . " 
 
 	 	 s e t   f i l e E x t e n s i o n   t o   t h e   l a s t   t e x t   i t e m   o f   f i l e N a m e 
 
 	 	 s e t   A p p l e S c r i p t ' s   t e x t   i t e m   d e l i m i t e r s   t o   o l d T I D s 
 
 	 e n d   i f 
 
 	 r e t u r n   f i l e E x t e n s i o n 
 
 e n d   G e t F i l e E x t e n s i o n 
 
 
 
 o n   G e t F i l e N a m e O n l y ( f i l e N a m e ) 
 
 	 s e t   f i l e N a m e O n l y   t o   f i l e N a m e 
 
 	 i f   f i l e N a m e   c o n t a i n s   " . "   t h e n 
 
 	 	 s e t   o l d T I D s   t o   A p p l e S c r i p t ' s   t e x t   i t e m   d e l i m i t e r s 
 
 	 	 s e t   A p p l e S c r i p t ' s   t e x t   i t e m   d e l i m i t e r s   t o   " . " 
 
 	 	 s e t   f i l e N a m e O n l y   t o   ( t e x t   i t e m s   1   t h r o u g h   - 2   o f   f i l e N a m e )   a s   s t r i n g 
 
 	 	 s e t   A p p l e S c r i p t ' s   t e x t   i t e m   d e l i m i t e r s   t o   o l d T I D s 
 
 	 e n d   i f 
 
 	 r e t u r n   f i l e N a m e O n l y 
 
 e n d   G e t F i l e N a m e O n l y 
 
 
 
 o n   G e t T o o l s ( ) 
 
 	 s e t   p a r a e n d   t o   " 
 
 " 
 
 	 s e t   A S n u m b e r   t o   ( t e x t   1   t h r u   3   o f   ( A p p l e S c r i p t ' s   v e r s i o n   a s   t e x t )   a s   r e a l ) 
 
 	 s e t   o l d A p p l e S c r i p t   t o   ( A S n u m b e r   <   2 . 0 ) 
 
 	 s e t   p y t h o n   t o   " / u s r / l o c a l / b i n / p y t h o n " 
 
 	 i f   n o t   f i l e e x i s t s ( p y t h o n )   t h e n 
 
 	 	 s e t   p y t h o n   t o   " / u s r / b i n / p y t h o n " 
 
 	 e n d   i f 
 
 	 s e t   p y t h o n v e r s i o n   t o   " 2 . 3 " 
 
 	 t r y 
 
 	 	 s e t   p y t h o n v e r s i o n   t o   d o   s h e l l   s c r i p t   p y t h o n   &   "   - c   \ " f r o m   s y s   i m p o r t   v e r s i o n ;   p r i n t   v e r s i o n [ : 3 ] \ " " 
 
 	 e n d   t r y 
 
 	 - -   d i s p l a y   d i a l o g   p y t h o n v e r s i o n 
 
 	 i f   ( p y t h o n v e r s i o n   i s   n o t   " 2 . 5 " )   a n d   ( p y t h o n v e r s i o n   i s   n o t   " 2 . 6 " )   a n d   ( p y t h o n v e r s i o n   i s   n o t   " 2 . 7 " )   t h e n 
 
 	 	 s e t   d i a l o g r e s u l t   t o   ( d i s p l a y   d i a l o g   " T h i s   A p p l e S c r i p t   r e q u i r e s   P y t h o n   2 . 7 x . 
 
 
 
 	 P l e a s e   i n s t a l l   p y t h o n   2 . 7 x   a n d   t r y   a g a i n . "   b u t t o n s   { " Q u i t " }   d e f a u l t   b u t t o n   1   w i t h   t i t l e   " D e D R M "   w i t h   i c o n   s t o p ) 
 
 	 	 r e t u r n   f a l s e 
 
 	 e n d   i f 
 
 	 - -   w e   a l w a y s   w a n t   a   s p a c e   a f t e r   t h e   c o m m a n d 
 
 	 s e t   p y t h o n   t o   p y t h o n   &   "   " 
 
 	 
 
 	 s e t   e R e a d e r T o o l   t o   P O S I X   p a t h   o f   ( p a t h   t o   r e s o u r c e   " e r d r 2 p m l . p y " ) 
 
 	 s e t   M o b i p o c k e t T o o l   t o   P O S I X   p a t h   o f   ( p a t h   t o   r e s o u r c e   " k 4 m o b i d e d r m . p y " ) 
 
 	 s e t   K i n d l e P I D T o o l   t o   P O S I X   p a t h   o f   ( p a t h   t o   r e s o u r c e   " k i n d l e p i d . p y " ) 
 
 	 s e t   B N K e y G e n T o o l   t o   P O S I X   p a t h   o f   ( p a t h   t o   r e s o u r c e   " i g n o b l e k e y g e n . p y " ) 
 
 	 s e t   B N K e y F e t c h T o o l   t o   P O S I X   p a t h   o f   ( p a t h   t o   r e s o u r c e   " i g n o b l e k e y f e t c h . p y " ) 
 
 	 s e t   B N e P u b T o o l   t o   P O S I X   p a t h   o f   ( p a t h   t o   r e s o u r c e   " i g n o b l e e p u b . p y " ) 
 
 	 s e t   K i n d l e K e y T o o l   t o   P O S I X   p a t h   o f   ( p a t h   t o   r e s o u r c e   " k i n d l e k e y . p y " ) 
 
 	 s e t   N o o k K e y T o o l   t o   P O S I X   p a t h   o f   ( p a t h   t o   r e s o u r c e   " i g n o b l e k e y . p y " ) 
 
 	 s e t   A d o b e K e y G e n T o o l   t o   P O S I X   p a t h   o f   ( p a t h   t o   r e s o u r c e   " a d o b e k e y . p y " ) 
 
 	 s e t   A d o b e e P u b T o o l   t o   P O S I X   p a t h   o f   ( p a t h   t o   r e s o u r c e   " i n e p t e p u b . p y " ) 
 
 	 s e t   e P u b T e s t T o o l   t o   P O S I X   p a t h   o f   ( p a t h   t o   r e s o u r c e   " e p u b t e s t . p y " ) 
 
 	 s e t   A d o b e P D F T o o l   t o   P O S I X   p a t h   o f   ( p a t h   t o   r e s o u r c e   " i n e p t p d f . p y " ) 
 
 	 s e t   Z i p F i x T o o l   t o   P O S I X   p a t h   o f   ( p a t h   t o   r e s o u r c e   " z i p f i x . p y " ) 
 
 	 s e t   P r o g r e s s A p p   t o   P O S I X   p a t h   o f   ( p a t h   t o   r e s o u r c e   " D e D R M   P r o g r e s s . a p p " ) 
 
 	 i f   n o t   f i l e e x i s t s ( e R e a d e r T o o l )   t h e n 
 
 	 	 s e t   d i a l o g r e s u l t   t o   ( d i s p l a y   d i a l o g   " T h e   e R e a d e r   s c r i p t   ( e r d r 2 p m l . p y )   i s   m i s s i n g   f r o m   t h i s   p a c k a g e .   G e t   a   f r e s h   c o p y . "   b u t t o n s   { " Q u i t " ,   " C o n t i n u e   A n y w a y " }   d e f a u l t   b u t t o n   1   w i t h   t i t l e   " D e D R M "   w i t h   i c o n   s t o p ) 
 
 	 	 i f   b u t t o n   r e t u r n e d   o f   d i a l o g r e s u l t   i s   " Q u i t "   t h e n 
 
 	 	 	 r e t u r n   f a l s e 
 
 	 	 e n d   i f 
 
 	 e n d   i f 
 
 	 i f   n o t   f i l e e x i s t s ( M o b i p o c k e t T o o l )   t h e n 
 
 	 	 - - d i s p l a y   d i a l o g   M o b i p o c k e t T o o l 
 
 	 	 s e t   d i a l o g r e s u l t   t o   ( d i s p l a y   d i a l o g   " T h e   M o b i p o c k e t   s c r i p t   ( k 4 m o b i d e d r m . p y )   i s   m i s s i n g   f r o m   t h i s   p a c k a g e .   G e t   a   f r e s h   c o p y . "   b u t t o n s   { " Q u i t " ,   " C o n t i n u e   A n y w a y " }   d e f a u l t   b u t t o n   1   w i t h   t i t l e   " D e D R M "   w i t h   i c o n   s t o p ) 
 
 	 	 i f   b u t t o n   r e t u r n e d   o f   d i a l o g r e s u l t   i s   " Q u i t "   t h e n 
 
 	 	 	 r e t u r n   f a l s e 
 
 	 	 e n d   i f 
 
 	 e n d   i f 
 
 	 i f   n o t   f i l e e x i s t s ( K i n d l e P I D T o o l )   t h e n 
 
 	 	 - - d i s p l a y   d i a l o g   K i n d l e P I D T o o l 
 
 	 	 s e t   d i a l o g r e s u l t   t o   ( d i s p l a y   d i a l o g   " T h e   K i n d l e P I D   s c r i p t   ( k i n d l e p i d . p y )   i s   m i s s i n g   f r o m   t h i s   p a c k a g e .   G e t   a   f r e s h   c o p y . "   b u t t o n s   { " Q u i t " ,   " C o n t i n u e   A n y w a y " }   d e f a u l t   b u t t o n   1   w i t h   t i t l e   " D e D R M "   w i t h   i c o n   s t o p ) 
 
 	 	 i f   b u t t o n   r e t u r n e d   o f   d i a l o g r e s u l t   i s   " Q u i t "   t h e n 
 
 	 	 	 r e t u r n   f a l s e 
 
 	 	 e n d   i f 
 
 	 e n d   i f 
 
 	 i f   n o t   f i l e e x i s t s ( B N K e y G e n T o o l )   t h e n 
 
 	 	 s e t   d i a l o g r e s u l t   t o   ( d i s p l a y   d i a l o g   " T h e   B & N   K e y   G e n e r a t i o n   s c r i p t   ( i g n o b l e k e y g e n . p y )   i s   m i s s i n g   f r o m   t h i s   p a c k a g e .   G e t   a   f r e s h   c o p y . "   b u t t o n s   { " Q u i t " ,   " C o n t i n u e   A n y w a y " }   d e f a u l t   b u t t o n   1   w i t h   t i t l e   " D e D R M "   w i t h   i c o n   s t o p ) 
 
 	 	 i f   b u t t o n   r e t u r n e d   o f   d i a l o g r e s u l t   i s   " Q u i t "   t h e n 
 
 	 	 	 r e t u r n   f a l s e 
 
 	 	 e n d   i f 
 
 	 e n d   i f 
 
 	 i f   n o t   f i l e e x i s t s ( B N K e y F e t c h T o o l )   t h e n 
 
 	 	 s e t   d i a l o g r e s u l t   t o   ( d i s p l a y   d i a l o g   " T h e   B & N   K e y   F e t c h   s c r i p t   ( i g n o b l e k e y f e t c h . p y )   i s   m i s s i n g   f r o m   t h i s   p a c k a g e .   G e t   a   f r e s h   c o p y . "   b u t t o n s   { " Q u i t " ,   " C o n t i n u e   A n y w a y " }   d e f a u l t   b u t t o n   1   w i t h   t i t l e   " D e D R M "   w i t h   i c o n   s t o p ) 
 
 	 	 i f   b u t t o n   r e t u r n e d   o f   d i a l o g r e s u l t   i s   " Q u i t "   t h e n 
 
 	 	 	 r e t u r n   f a l s e 
 
 	 	 e n d   i f 
 
 	 e n d   i f 
 
 	 i f   n o t   f i l e e x i s t s ( B N e P u b T o o l )   t h e n 
 
 	 	 s e t   d i a l o g r e s u l t   t o   ( d i s p l a y   d i a l o g   " T h e   B & N   s c r i p t   ( i g n o b l e e p u b . p y )   i s   m i s s i n g   f r o m   t h i s   p a c k a g e .   G e t   a   f r e s h   c o p y . "   b u t t o n s   { " Q u i t " ,   " C o n t i n u e   A n y w a y " }   d e f a u l t   b u t t o n   1   w i t h   t i t l e   " D e D R M "   w i t h   i c o n   s t o p ) 
 
 	 	 i f   b u t t o n   r e t u r n e d   o f   d i a l o g r e s u l t   i s   " Q u i t "   t h e n 
 
 	 	 	 r e t u r n   f a l s e 
 
 	 	 e n d   i f 
 
 	 e n d   i f 
 
 	 i f   n o t   f i l e e x i s t s ( N o o k K e y T o o l )   t h e n 
 
 	 	 s e t   d i a l o g r e s u l t   t o   ( d i s p l a y   d i a l o g   " T h e   B & N   K e y   R e t r i e v a l   s c r i p t   ( i g n o b l e k e y . p y )   i s   m i s s i n g   f r o m   t h i s   p a c k a g e .   G e t   a   f r e s h   c o p y . "   b u t t o n s   { " Q u i t " ,   " C o n t i n u e   A n y w a y " }   d e f a u l t   b u t t o n   1   w i t h   t i t l e   " D e D R M "   w i t h   i c o n   s t o p ) 
 
 	 	 i f   b u t t o n   r e t u r n e d   o f   d i a l o g r e s u l t   i s   " Q u i t "   t h e n 
 
 	 	 	 r e t u r n   f a l s e 
 
 	 	 e n d   i f 
 
 	 e n d   i f 
 
 	 i f   n o t   f i l e e x i s t s ( K i n d l e K e y T o o l )   t h e n 
 
 	 	 s e t   d i a l o g r e s u l t   t o   ( d i s p l a y   d i a l o g   " T h e   K i n d l e   K e y   G e n e r a t i o n   s c r i p t   ( k i n d l e k e y . p y )   i s   m i s s i n g   f r o m   t h i s   p a c k a g e .   G e t   a   f r e s h   c o p y . "   b u t t o n s   { " Q u i t " ,   " C o n t i n u e   A n y w a y " }   d e f a u l t   b u t t o n   1   w i t h   t i t l e   " D e D R M "   w i t h   i c o n   s t o p ) 
 
 	 	 i f   b u t t o n   r e t u r n e d   o f   d i a l o g r e s u l t   i s   " Q u i t "   t h e n 
 
 	 	 	 r e t u r n   f a l s e 
 
 	 	 e n d   i f 
 
 	 e n d   i f 
 
 	 i f   n o t   f i l e e x i s t s ( A d o b e K e y G e n T o o l )   t h e n 
 
 	 	 s e t   d i a l o g r e s u l t   t o   ( d i s p l a y   d i a l o g   " T h e   A d o b e   K e y   G e n e r a t i o n   s c r i p t   ( a d o b e k e y . p y )   i s   m i s s i n g   f r o m   t h i s   p a c k a g e .   G e t   a   f r e s h   c o p y . "   b u t t o n s   { " Q u i t " ,   " C o n t i n u e   A n y w a y " }   d e f a u l t   b u t t o n   1   w i t h   t i t l e   " D e D R M "   w i t h   i c o n   s t o p ) 
 
 	 	 i f   b u t t o n   r e t u r n e d   o f   d i a l o g r e s u l t   i s   " Q u i t "   t h e n 
 
 	 	 	 r e t u r n   f a l s e 
 
 	 	 e n d   i f 
 
 	 e n d   i f 
 
 	 i f   n o t   f i l e e x i s t s ( A d o b e P D F T o o l )   t h e n 
 
 	 	 s e t   d i a l o g r e s u l t   t o   ( d i s p l a y   d i a l o g   " T h e   A d o b e   P D F   s c r i p t   ( i n e p t p d f . p y )   i s   m i s s i n g   f r o m   t h i s   p a c k a g e .   G e t   a   f r e s h   c o p y . "   b u t t o n s   { " Q u i t " ,   " C o n t i n u e   A n y w a y " }   d e f a u l t   b u t t o n   1   w i t h   t i t l e   " D e D R M "   w i t h   i c o n   s t o p ) 
 
 	 	 i f   b u t t o n   r e t u r n e d   o f   d i a l o g r e s u l t   i s   " Q u i t "   t h e n 
 
 	 	 	 r e t u r n   f a l s e 
 
 	 	 e n d   i f 
 
 	 e n d   i f 
 
 	 i f   n o t   f i l e e x i s t s ( A d o b e e P u b T o o l )   t h e n 
 
 	 	 s e t   d i a l o g r e s u l t   t o   ( d i s p l a y   d i a l o g   " T h e   A d o b e   e P u b   s c r i p t   ( i n e p t e p u b . p y )   i s   m i s s i n g   f r o m   t h i s   p a c k a g e .   G e t   a   f r e s h   c o p y . "   b u t t o n s   { " Q u i t " ,   " C o n t i n u e   A n y w a y " }   d e f a u l t   b u t t o n   1   w i t h   t i t l e   " D e D R M "   w i t h   i c o n   s t o p ) 
 
 	 	 i f   b u t t o n   r e t u r n e d   o f   d i a l o g r e s u l t   i s   " Q u i t "   t h e n 
 
 	 	 	 r e t u r n   f a l s e 
 
 	 	 e n d   i f 
 
 	 e n d   i f 
 
 	 i f   n o t   f i l e e x i s t s ( e P u b T e s t T o o l )   t h e n 
 
 	 	 s e t   d i a l o g r e s u l t   t o   ( d i s p l a y   d i a l o g   " T h e   e P u b   e n c r y p t i o n   t e s t   s c r i p t   ( e p u b t e s t t o o l . p y )   i s   m i s s i n g   f r o m   t h i s   p a c k a g e .   G e t   a   f r e s h   c o p y . "   b u t t o n s   { " Q u i t " ,   " C o n t i n u e   A n y w a y " }   d e f a u l t   b u t t o n   1   w i t h   t i t l e   " D e D R M "   w i t h   i c o n   s t o p ) 
 
 	 	 i f   b u t t o n   r e t u r n e d   o f   d i a l o g r e s u l t   i s   " Q u i t "   t h e n 
 
 	 	 	 r e t u r n   f a l s e 
 
 	 	 e n d   i f 
 
 	 e n d   i f 
 
 	 i f   n o t   f o l d e r e x i s t s ( P r o g r e s s A p p )   t h e n 
 
 	 	 s e t   d i a l o g r e s u l t   t o   ( d i s p l a y   d i a l o g   " T h e   P r o g r e s s   d i a l o g   a p p l i c a t i o n   ( D e D R M   P r o g r e s s . a p p )   i s   m i s s i n g   f r o m   t h i s   p a c k a g e .   G e t   a   f r e s h   c o p y . "   b u t t o n s   { " Q u i t " ,   " C o n t i n u e   A n y w a y " }   d e f a u l t   b u t t o n   1   w i t h   t i t l e   " D e D R M "   w i t h   i c o n   s t o p ) 
 
 	 	 i f   b u t t o n   r e t u r n e d   o f   d i a l o g r e s u l t   i s   " Q u i t "   t h e n 
 
 	 	 	 r e t u r n   f a l s e 
 
 	 	 e n d   i f 
 
 	 e n d   i f 
 
 	 r e t u r n   t r u e 
 
 e n d   G e t T o o l s 
 
 
 
 o n   u n l o c k m o b i f i l e ( e n c r y p t e d F i l e ) 
 
 	 - - c h e c k   i t ' s   a   m o b i   f i l e . 
 
 	 s e t   B O O K M O B I   t o   " N O T A M O B I " 
 
 	 t r y 
 
 	 	 s e t   B O O K M O B I   t o   r e a d   f i l e   e n c r y p t e d F i l e   f r o m   6 1   f o r   8 
 
 	 e n d   t r y 
 
 	 i f   B O O K M O B I   i s   n o t   " B O O K M O B I "   a n d   B O O K M O B I   i s   n o t   " T E X t R E A d "   t h e n 
 
 	 	 s e t   T O P A Z   t o   " N O T " 
 
 	 	 t r y 
 
 	 	 	 s e t   T O P A Z   t o   r e a d   f i l e   e n c r y p t e d F i l e   f r o m   1   f o r   4 
 
 	 	 e n d   t r y 
 
 	 	 i f   T O P A Z   i s   n o t   " T P Z 0 "   t h e n 
 
 	 	 	 s e t   E r r o r C o u n t   t o   E r r o r C o u n t   +   1 
 
 	 	 	 s e t   E r r o r L i s t   t o   E r r o r L i s t   &   e n c r y p t e d F i l e   &   "   i s   n e i t h e r   a   K i n d l e   n o t   a   M o b i p o c k e t   f i l e . 
 
 " 
 
 	 	 	 r e t u r n 
 
 	 	 e n d   i f 
 
 	 e n d   i f 
 
 	 s e t   e n c r y p t e d F i l e P a t h   t o   P O S I X   p a t h   o f   f i l e   e n c r y p t e d F i l e 
 
 	 t e l l   a p p l i c a t i o n   " F i n d e r " 
 
 	 	 s e t   p a r e n t _ f o l d e r   t o   ( c o n t a i n e r   o f   f i l e   e n c r y p t e d F i l e )   a s   t e x t 
 
 	 	 s e t   f i l e N a m e   t o   ( n a m e   o f   f i l e   e n c r y p t e d F i l e )   a s   t e x t 
 
 	 e n d   t e l l 
 
 	 s e t   f i l e E x t e n s i o n   t o   " . "   &   G e t F i l e E x t e n s i o n ( f i l e N a m e ) 
 
 	 s e t   f i l e N a m e   t o   G e t F i l e N a m e O n l y ( f i l e N a m e ) 
 
 	 i f   o u t p u t F o l d e r   i s   " "   o r   n o t   f o l d e r e x i s t s ( o u t p u t F o l d e r )   t h e n 
 
 	 	 s e t   d e d r m F o l d e r   t o   P O S I X   p a t h   o f   f i l e   p a r e n t _ f o l d e r 
 
 	 e l s e 
 
 	 	 s e t   d e d r m F o l d e r   t o   P O S I X   p a t h   o f   f i l e   o u t p u t F o l d e r 
 
 	 e n d   i f 
 
 	 s e t   s h e l l c o m m a n d   t o   p y t h o n   &   ( q u o t e d   f o r m   o f   M o b i p o c k e t T o o l ) 
 
 	 r e p e a t   w i t h   K i n d l e K e y P a t h   i n   K i n d l e K e y L i s t 
 
 	 	 s e t   s h e l l c o m m a n d   t o   s h e l l c o m m a n d   &   "   - k   "   &   q u o t e d   f o r m   o f   K i n d l e K e y P a t h 
 
 	 e n d   r e p e a t 
 
 	 r e p e a t   w i t h   A n d r o i d K e y P a t h   i n   A n d r o i d K e y L i s t 
 
 	 	 s e t   s h e l l c o m m a n d   t o   s h e l l c o m m a n d   &   "   - a   "   &   q u o t e d   f o r m   o f   A n d r o i d K e y P a t h 
 
 	 e n d   r e p e a t 
 
 	 s e t   S e r i a l s t r i n g   t o   G e t S e r i a l s t r i n g ( ) 
 
 	 i f   S e r i a l s t r i n g   i s   n o t   " "   t h e n   s e t   s h e l l c o m m a n d   t o   s h e l l c o m m a n d   &   "   - s   "   &   q u o t e d   f o r m   o f   S e r i a l s t r i n g 
 
 	 s e t   P I D s t r i n g   t o   G e t P I D s t r i n g ( ) 
 
 	 i f   P I D s t r i n g   i s   " "   t h e n 
 
 	 	 s e t   P I D s t r i n g   t o   G e t U D I D P I D s ( ) 
 
 	 e l s e 
 
 	 	 s e t   P I D s t r i n g   t o   P I D s t r i n g   &   " , "   &   G e t U D I D P I D s ( ) 
 
 	 e n d   i f 
 
 	 
 
 	 i f   P I D s t r i n g   i s   n o t   " "   t h e n   s e t   s h e l l c o m m a n d   t o   s h e l l c o m m a n d   &   "   - p   "   &   q u o t e d   f o r m   o f   P I D s t r i n g 
 
 	 s e t   s h e l l c o m m a n d   t o   s h e l l c o m m a n d   &   "   "   &   ( q u o t e d   f o r m   o f   e n c r y p t e d F i l e P a t h )   &   "   "   &   ( q u o t e d   f o r m   o f   d e d r m F o l d e r ) 
 
 	 s e t   s h e l l c o m m a n d   t o   s h e l l c o m m a n d   &   "   >   "   &   q u o t e d t e m p p a t h ( ) 
 
 	 - - d i s p l a y   d i a l o g   " s h e l l c o m m a n d :   "   d e f a u l t   a n s w e r   s h e l l c o m m a n d   b u t t o n s   { " O K " }   d e f a u l t   b u t t o n   1   g i v i n g   u p   a f t e r   1 0 
 
 	 w r i t e t o l o g ( " s h e l l c o m m a n d :   "   &   s h e l l c o m m a n d ) 
 
 	 c l e a r t e m p ( ) 
 
 	 s e t   D e c o d i n g E r r o r   t o   f a l s e 
 
 	 s e t   s h e l l r e s u l t   t o   " " 
 
 	 s e t   E r r o r T e x t   t o   " " 
 
 	 s e t   d e c o d e d   t o   t r u e 
 
 	 t r y 
 
 	 	 d o   s h e l l   s c r i p t   s h e l l c o m m a n d 
 
 	 o n   e r r o r   E r r o r T e x t   n u m b e r   e r r n u m 
 
 	 	 s e t   D e c o d i n g E r r o r   t o   t r u e 
 
 	 	 s e t   d e c o d e d   t o   f a l s e 
 
 	 e n d   t r y 
 
 	 s e t   s h e l l r e s u l t   t o   r e a d t e m p ( ) 
 
 	 w r i t e t o l o g ( " s h e l l r e s u l t :   "   &   s h e l l r e s u l t   &   "   "   &   E r r o r T e x t ) 
 
 	 i f   d e c o d e d   t h e n 
 
 	 	 s e t   d e c o d e d   t o   ( ( o f f s e t   o f   " N o   k e y   f o u n d "   i n   s h e l l r e s u l t )   i s   0 ) 
 
 	 e n d   i f 
 
 	 i f   n o t   d e c o d e d   t h e n 
 
 	 	 D e c o d i n g E r r o r   =   t r u e 
 
 	 	 s e t   n e w K e y L i s t   t o   G e t K i n d l e K e y s ( ) 
 
 	 	 i f   l e n g t h   o f   n e w K e y L i s t   >   0   t h e n 
 
 	 	 	 s e t   s h e l l c o m m a n d   t o   p y t h o n   &   ( q u o t e d   f o r m   o f   M o b i p o c k e t T o o l ) 
 
 	 	 	 r e p e a t   w i t h   K i n d l e K e y P a t h   i n   n e w K e y L i s t 
 
 	 	 	 	 s e t   s h e l l c o m m a n d   t o   s h e l l c o m m a n d   &   "   - k   "   &   q u o t e d   f o r m   o f   K i n d l e K e y P a t h 
 
 	 	 	 e n d   r e p e a t 
 
 	 	 	 s e t   s h e l l c o m m a n d   t o   s h e l l c o m m a n d   &   "   "   &   ( q u o t e d   f o r m   o f   e n c r y p t e d F i l e P a t h )   &   "   "   &   ( q u o t e d   f o r m   o f   d e d r m F o l d e r ) 
 
 	 	 	 s e t   s h e l l c o m m a n d   t o   s h e l l c o m m a n d   &   "   >   "   &   q u o t e d t e m p p a t h ( ) 
 
 	 	 	 - - d i s p l a y   d i a l o g   " s h e l l c o m m a n d :   "   d e f a u l t   a n s w e r   s h e l l c o m m a n d   b u t t o n s   { " O K " }   d e f a u l t   b u t t o n   1   g i v i n g   u p   a f t e r   1 0 
 
 	 	 	 w r i t e t o l o g ( " s h e l l c o m m a n d :   "   &   s h e l l c o m m a n d ) 
 
 	 	 	 c l e a r t e m p ( ) 
 
 	 	 	 s e t   D e c o d i n g E r r o r   t o   f a l s e 
 
 	 	 	 s e t   s h e l l r e s u l t   t o   " " 
 
 	 	 	 s e t   E r r o r T e x t   t o   " " 
 
 	 	 	 s e t   d e c o d e d   t o   t r u e 
 
 	 	 	 t r y 
 
 	 	 	 	 d o   s h e l l   s c r i p t   s h e l l c o m m a n d 
 
 	 	 	 o n   e r r o r   E r r o r T e x t   n u m b e r   e r r n u m 
 
 	 	 	 	 s e t   D e c o d i n g E r r o r   t o   t r u e 
 
 	 	 	 	 s e t   d e c o d e d   t o   f a l s e 
 
 	 	 	 e n d   t r y 
 
 	 	 	 s e t   s h e l l r e s u l t   t o   r e a d t e m p ( ) 
 
 	 	 	 w r i t e t o l o g ( " s h e l l r e s u l t :   "   &   s h e l l r e s u l t   &   "   "   &   E r r o r T e x t ) 
 
 	 	 	 i f   d e c o d e d   t h e n 
 
 	 	 	 	 s e t   D e c o d i n g E r r o r   t o   n o t   ( ( o f f s e t   o f   " N o   k e y   f o u n d "   i n   s h e l l r e s u l t )   i s   0 ) 
 
 	 	 	 e n d   i f 
 
 	 	 	 i f   n o t   D e c o d i n g E r r o r   t h e n 
 
 	 	 	 	 s e t   K i n d l e K e y L i s t   t o   K i n d l e K e y L i s t   &   n e w K e y L i s t 
 
 	 	 	 e n d   i f 
 
 	 	 e n d   i f 
 
 	 e n d   i f 
 
 	 i f   D e c o d i n g E r r o r   t h e n 
 
 	 	 s e t   E r r o r C o u n t   t o   E r r o r C o u n t   +   1 
 
 	 	 s e t   E r r o r L i s t   t o   E r r o r L i s t   &   f i l e N a m e   &   f i l e E x t e n s i o n   &   "   c o u l d n ' t   b e   d e c r y p t e d . 
 
 " 
 
 	 e l s e   i f   ( o f f s e t   o f   " n o t   e n c r y p t e d "   i n   s h e l l r e s u l t )   >   0   t h e n 
 
 	 	 s e t   W a r n i n g C o u n t   t o   W a r n i n g C o u n t   +   1 
 
 	 	 s e t   W a r n i n g L i s t   t o   W a r n i n g L i s t   &   f i l e N a m e   &   f i l e E x t e n s i o n   &   "   i s   n o t   e n c r y p t e d . 
 
 " 
 
 	 e l s e 
 
 	 	 s e t   C o m p l e t e d C o u n t   t o   C o m p l e t e d C o u n t   +   1 
 
 	 	 s e t   C o m p l e t e d L i s t   t o   C o m p l e t e d L i s t   &   f i l e N a m e   &   f i l e E x t e n s i o n   &   p a r a e n d 
 
 	 e n d   i f 
 
 e n d   u n l o c k m o b i f i l e 
 
 
 
 o n   u n l o c k p d b f i l e ( e n c r y p t e d F i l e ) 
 
 	 - - c h e c k   i t ' s   a n   e R e a d e r   f i l e . 
 
 	 s e t   P N R d P P r s   t o   " N O T _ e R E A D E R " 
 
 	 t r y 
 
 	 	 s e t   P N R d P P r s   t o   r e a d   f i l e   e n c r y p t e d F i l e   f r o m   6 1   f o r   8 
 
 	 e n d   t r y 
 
 	 i f   P N R d P P r s   i s   n o t   " P N R d P P r s "   t h e n 
 
 	 	 s e t   E r r o r C o u n t   t o   E r r o r C o u n t   +   1 
 
 	 	 s e t   E r r o r L i s t   t o   E r r o r L i s t   &   e n c r y p t e d F i l e   &   "   i s   n o t   a n   e R e a d e r   f i l e . 
 
 " 
 
 	 	 r e t u r n 
 
 	 e n d   i f 
 
 	 s e t   e n c r y p t e d F i l e P a t h   t o   P O S I X   p a t h   o f   f i l e   e n c r y p t e d F i l e 
 
 	 t e l l   a p p l i c a t i o n   " F i n d e r " 
 
 	 	 s e t   p a r e n t _ f o l d e r   t o   ( c o n t a i n e r   o f   f i l e   e n c r y p t e d F i l e )   a s   t e x t 
 
 	 	 s e t   f i l e N a m e   t o   ( n a m e   o f   f i l e   e n c r y p t e d F i l e )   a s   t e x t 
 
 	 e n d   t e l l 
 
 	 s e t   f i l e E x t e n s i o n   t o   " . "   &   G e t F i l e E x t e n s i o n ( f i l e N a m e ) 
 
 	 s e t   f i l e N a m e   t o   G e t F i l e N a m e O n l y ( f i l e N a m e ) 
 
 	 i f   o u t p u t F o l d e r   i s   " "   o r   n o t   f o l d e r e x i s t s ( o u t p u t F o l d e r )   t h e n 
 
 	 	 s e t   d e d r m F o l d e r   t o   p a r e n t _ f o l d e r 
 
 	 e l s e 
 
 	 	 s e t   d e d r m F o l d e r   t o   o u t p u t F o l d e r 
 
 	 e n d   i f 
 
 	 s e t   p m l F i l e   t o   d e d r m F o l d e r   &   f i l e N a m e   &   " _ S o u r c e : "   &   f i l e N a m e   &   " . p m l " 
 
 	 s e t   c l e a r F i l e   t o   d e d r m F o l d e r   &   f i l e N a m e   &   " _ S o u r c e : "   &   f i l e N a m e   &   " . p d b " 
 
 	 s e t   c l e a r F i l e N e w   t o   d e d r m F o l d e r   &   f i l e N a m e   &   " _ S o u r c e : "   &   f i l e N a m e   &   " _ n o d r m . p d b " 
 
 	 s e t   c l e a r F i l e N e w N a m e   t o   f i l e N a m e   &   " _ n o d r m . p d b " 
 
 	 s e t   s o u r c e P a t h   t o   P O S I X   p a t h   o f   f i l e   d e d r m F o l d e r   &   f i l e N a m e   &   " _ S o u r c e / " 
 
 	 s e t   p m l z F i l e P a t h   t o   P O S I X   p a t h   o f   f i l e   d e d r m F o l d e r   &   f i l e N a m e   &   " _ n o d r m . p m l z " 
 
 	 i f   l e n g t h   o f   G e t e R e a d e r K e y s t r i n g ( )   i s   0   t h e n 
 
 	 	 G e t e R e a d e r K e y s ( " D e D R M   C o n f i g u r e   f o r   e R e a d e r " ) 
 
 	 e n d   i f 
 
 	 s e t   s h e l l r e s u l t   t o   " E r r o r :   N o   e R e a d e r   k e y s   s u p p l i e d .   C a n ' t   d e c r y p t . " 
 
 	 r e p e a t   w i t h   B N K e y   i n   b n K e y s 
 
 	 	 s e t   e n c r y p t i o n N a m e   t o   f i r s t   i t e m   o f   B N K e y 
 
 	 	 s e t   e n c r y p t i o n N u m b e r   t o   s e c o n d   i t e m   o f   B N K e y 
 
 	 	 i f   l e n g t h   o f   e n c r y p t i o n N a m e   >   0   a n d   l e n g t h   o f   e n c r y p t i o n N u m b e r   >   0   t h e n 
 
 	 	 	 s e t   s h e l l c o m m a n d   t o   p y t h o n   &   ( q u o t e d   f o r m   o f   e R e a d e r T o o l )   &   "   "   &   ( q u o t e d   f o r m   o f   e n c r y p t e d F i l e P a t h )   &   "   "   &   ( q u o t e d   f o r m   o f   s o u r c e P a t h )   &   "   "   &   ( q u o t e d   f o r m   o f   e n c r y p t i o n N a m e )   &   "   "   &   ( q u o t e d   f o r m   o f   e n c r y p t i o n N u m b e r ) 
 
 	 	 	 s e t   s h e l l c o m m a n d   t o   s h e l l c o m m a n d   &   "   >   "   &   q u o t e d t e m p p a t h ( ) 
 
 	 	 	 - - d i s p l a y   d i a l o g   " s h e l l c o m m a n d :   "   &   s h e l l c o m m a n d   b u t t o n s   { " O K " }   d e f a u l t   b u t t o n   1   g i v i n g   u p   a f t e r   1 0 
 
 	 	 	 w r i t e t o l o g ( " s h e l l c o m m a n d :   "   &   s h e l l c o m m a n d ) 
 
 	 	 	 s e t   s h e l l r e s u l t   t o   " n o   r e s u l t " 
 
 	 	 	 c l e a r t e m p ( ) 
 
 	 	 	 s e t   D e c o d i n g E r r o r   t o   f a l s e 
 
 	 	 	 s e t   E r r o r T e x t   t o   " " 
 
 	 	 	 t r y 
 
 	 	 	 	 d o   s h e l l   s c r i p t   s h e l l c o m m a n d 
 
 	 	 	 o n   e r r o r   E r r o r T e x t 
 
 	 	 	 	 s e t   D e c o d i n g E r r o r   t o   t r u e 
 
 	 	 	 e n d   t r y 
 
 	 	 	 s e t   s h e l l r e s u l t   t o   r e a d t e m p ( ) 
 
 	 	 	 w r i t e t o l o g ( " s h e l l r e s u l t :   "   &   s h e l l r e s u l t   &   "   "   &   E r r o r T e x t ) 
 
 	 	 	 - - d i s p l a y   d i a l o g   s h e l l r e s u l t 
 
 	 	 	 i f   n o t   D e c o d i n g E r r o r   t h e n 
 
 	 	 	 	 - -   t r y   t o   r u n   d r o p b o o k   a n d   m o v e   c o m p i l e d   b o o k   t o   s a m e   f o l d e r   a s   e n c r y p t e d   b o o k 
 
 	 	 	 	 t r y 
 
 	 	 	 	 	 t r y 
 
 	 	 	 	 	 	 t e l l   a p p l i c a t i o n   " F i n d e r "   t o   s e t   D r o p B o o k   t o   ( a p p l i c a t i o n   f i l e   i d   " P P D r " )   a s   s t r i n g 
 
 	 	 	 	 	 o n   e r r o r 
 
 	 	 	 	 	 	 e r r o r   " C o u l d n ' t   f i n d   D r o p B o o k   a p p l i c a t i o n " 
 
 	 	 	 	 	 e n d   t r y 
 
 	 	 	 	 	 - -   n o w   a l s o   c o m p i l e   b a c k   u p   i n t o   p d b   f i l e   u s i n g   D r o p B o o k   i f   i t ' s   o n   t h i s   s y s t e m 
 
 	 	 	 	 	 t e l l   a p p l i c a t i o n   D r o p B o o k   t o   o p e n   f i l e   p m l F i l e 
 
 	 	 	 	 	 d e l a y   1   - -   p r o b a b l y   d o n ' t   n e e d   t h i s ,   b u t   j u s t   i n   c a s e . 
 
 	 	 	 	 	 t e l l   a p p l i c a t i o n   D r o p B o o k   t o   q u i t   - -   D r o p B o o k   w i l l   q u i t   o n l y   a f t e r   t h e   c o m p i l a t i o n   h a s   h a p p e n e d 
 
 	 	 	 	 	 t r y 
 
 	 	 	 	 	 	 t e l l   a p p l i c a t i o n   " F i n d e r " 
 
 	 	 	 	 	 	 	 s e t   n a m e   o f   f i l e   c l e a r F i l e   t o   c l e a r F i l e N e w N a m e 
 
 	 	 	 	 	 	 	 m o v e   c l e a r F i l e N e w   t o   d e d r m F o l d e r 
 
 	 	 	 	 	 	 e n d   t e l l 
 
 	 	 	 	 	 o n   e r r o r   e r r m s g 
 
 	 	 	 	 	 	 e r r o r   " D r o p B o o k   f a i l e d   t o   c o m p i l e   t h e   s o u r c e   f o l d e r   i n t o   a   p d b   f i l e . " 
 
 	 	 	 	 	 e n d   t r y 
 
 	 	 	 	 o n   e r r o r   e r r m s g 
 
 	 	 	 	 	 s e t   W a r n i n g C o u n t   t o   W a r n i n g C o u n t   +   1 
 
 	 	 	 	 	 s e t   W a r n i n g L i s t   t o   ( W a r n i n g L i s t   &   f i l e N a m e   &   f i l e E x t e n s i o n   &   "   c o u l d n ' t   b e   c o m p i l e d   b a c k   t o   p d b : 
 
 "   &   e r r m s g   a s   t e x t )   &   " 
 
 " 
 
 	 	 	 	 e n d   t r y 
 
 	 	 	 	 - -   t r y   t o   c o m p r e s s   s o u r c e   f o l d e r   c o n t e n s t s   t o   a   p m l z   f i l e   f o r   e a s y   i m p o r t   i n t o   C a l i b r e 
 
 	 	 	 	 t r y 
 
 	 	 	 	 	 s e t   s h e l l c o m m a n d   t o   " c d   "   &   q u o t e d   f o r m   o f   s o u r c e P a t h   &   " ;   z i p   - r   "   &   q u o t e d   f o r m   o f   p m l z F i l e P a t h   &   "   * " 
 
 	 	 	 	 	 - - d i s p l a y   d i a l o g   s h e l l c o m m a n d 
 
 	 	 	 	 	 w r i t e t o l o g ( " s h e l l c o m m a n d :   "   &   s h e l l c o m m a n d ) 
 
 	 	 	 	 	 s e t   z i p s h e l l r e s u l t   t o   " " 
 
 	 	 	 	 	 s e t   z i p s h e l l r e s u l t   t o   d o   s h e l l   s c r i p t   s h e l l c o m m a n d 
 
 	 	 	 	 	 w r i t e t o l o g ( " s h e l l r e s u l t :   "   &   z i p s h e l l r e s u l t ) 
 
 	 	 	 	 	 - - d i s p l a y   d i a l o g   z i p s h e l l r e s u l t 
 
 	 	 	 	 	 t e l l   a p p l i c a t i o n   " F i n d e r " 
 
 	 	 	 	 	 	 - -   m o v e   s o u r c e   f o l d e r   t o   t h e   t r a s h 
 
 	 	 	 	 	 	 m o v e   d e d r m F o l d e r   &   f i l e N a m e   &   " _ S o u r c e "   t o   t r a s h 
 
 	 	 	 	 	 e n d   t e l l 
 
 	 	 	 	 o n   e r r o r   e r r m s g 
 
 	 	 	 	 	 s e t   W a r n i n g C o u n t   t o   W a r n i n g C o u n t   +   1 
 
 	 	 	 	 	 s e t   W a r n i n g L i s t   t o   ( W a r n i n g L i s t   &   f i l e N a m e   &   f i l e E x t e n s i o n   &   " s o u r c e   f o l d e r   c o u l d n ' t   b e   c o m p r e s s e d   t o   p m l z : 
 
 "   &   e r r m s g   a s   t e x t )   &   " 
 
 
 
 " 
 
 	 	 	 	 e n d   t r y 
 
 	 	 	 	 - -   w e ' v e   d o n e   t h e   d e c r y p t i n g   s o   e x i t   t h e   l o o p . 
 
 	 	 	 	 e x i t   r e p e a t 
 
 	 	 	 e n d   i f 
 
 	 	 e n d   i f 
 
 	 e n d   r e p e a t 
 
 	 t r y 
 
 	 	 i f   ( o f f s e t   o f   " i n c o r r e c t   e R e a d e r   v e r s i o n   1 0 "   i n   s h e l l r e s u l t )   >   0   t h e n 
 
 	 	 	 s e t   W a r n i n g C o u n t   t o   W a r n i n g C o u n t   +   1 
 
 	 	 	 s e t   W a r n i n g L i s t   t o   W a r n i n g L i s t   &   f i l e N a m e   &   f i l e E x t e n s i o n   &   "   i s   n o t   e n c r y p t e d . 
 
 " 
 
 	 	 e l s e   i f   D e c o d i n g E r r o r   t h e n 
 
 	 	 	 s e t   E r r o r C o u n t   t o   E r r o r C o u n t   +   1 
 
 	 	 	 s e t   E r r o r L i s t   t o   ( E r r o r L i s t   &   f i l e N a m e   &   f i l e E x t e n s i o n   &   "   c o u l d n ' t   b e   d e c o d e d : 
 
 "   &   E r r o r T e x t   a s   t e x t )   &   " 
 
 " 
 
 	 	 e l s e 
 
 	 	 	 s e t   C o m p l e t e d C o u n t   t o   C o m p l e t e d C o u n t   +   1 
 
 	 	 	 s e t   C o m p l e t e d L i s t   t o   C o m p l e t e d L i s t   &   f i l e N a m e   &   f i l e E x t e n s i o n   &   p a r a e n d 
 
 	 	 e n d   i f 
 
 	 e n d   t r y 
 
 e n d   u n l o c k p d b f i l e 
 
 
 
 o n   u n l o c k e p u b f i l e ( e n c r y p t e d F i l e ) 
 
 	 s e t   e n c r y p t e d F i l e P a t h   t o   P O S I X   p a t h   o f   f i l e   e n c r y p t e d F i l e 
 
 	 t e l l   a p p l i c a t i o n   " F i n d e r " 
 
 	 	 s e t   p a r e n t _ f o l d e r   t o   ( c o n t a i n e r   o f   f i l e   e n c r y p t e d F i l e )   a s   t e x t 
 
 	 	 s e t   f i l e N a m e   t o   ( n a m e   o f   f i l e   e n c r y p t e d F i l e )   a s   t e x t 
 
 	 e n d   t e l l 
 
 	 s e t   f i l e E x t e n s i o n   t o   " . "   &   G e t F i l e E x t e n s i o n ( f i l e N a m e ) 
 
 	 s e t   f i l e N a m e   t o   G e t F i l e N a m e O n l y ( f i l e N a m e ) 
 
 	 
 
 	 s e t   d e c o d e d   t o   f a l s e 
 
 	 - -   f i r s t   w e   m u s t   f i x   a n y   p o s s i b l e   z i p   p r o b l e m s   w i t h   t h e   e p u b 
 
 	 i f   o u t p u t F o l d e r   i s   " "   o r   n o t   f o l d e r e x i s t s ( o u t p u t F o l d e r )   t h e n 
 
 	 	 s e t   f i x e d F i l e P a t h   t o   P O S I X   p a t h   o f   f i l e   ( p a r e n t _ f o l d e r   &   f i l e N a m e   &   " _ f i x e d "   &   f i l e E x t e n s i o n ) 
 
 	 e l s e 
 
 	 	 s e t   f i x e d F i l e P a t h   t o   P O S I X   p a t h   o f   f i l e   ( o u t p u t F o l d e r   &   f i l e N a m e   &   " _ f i x e d "   &   f i l e E x t e n s i o n ) 
 
 	 e n d   i f 
 
 	 s e t   s h e l l c o m m a n d   t o   p y t h o n   &   ( q u o t e d   f o r m   o f   Z i p F i x T o o l )   &   "   "   &   ( q u o t e d   f o r m   o f   e n c r y p t e d F i l e P a t h )   &   "   "   &   ( q u o t e d   f o r m   o f   f i x e d F i l e P a t h ) 
 
 	 s e t   s h e l l c o m m a n d   t o   s h e l l c o m m a n d   &   "   >   "   &   q u o t e d t e m p p a t h ( ) 
 
 	 w r i t e t o l o g ( " s h e l l c o m m a n d :   "   &   s h e l l c o m m a n d ) 
 
 	 c l e a r t e m p ( ) 
 
 	 s e t   Z i p E r r o r T e x t   t o   " " 
 
 	 s e t   Z i p F i x E r r o r   t o   f a l s e 
 
 	 t r y 
 
 	 	 - - d i s p l a y   d i a l o g   " s h e l l c o m m a n d :   "   d e f a u l t   a n s w e r   s h e l l c o m m a n d   b u t t o n s   { " O K " }   d e f a u l t   b u t t o n   1   g i v i n g   u p   a f t e r   1 0 
 
 	 	 d o   s h e l l   s c r i p t   s h e l l c o m m a n d 
 
 	 o n   e r r o r   e r r m s g 
 
 	 	 s e t   Z i p E r r o r T e x t   t o   e r r m s g 
 
 	 	 s e t   Z i p F i x E r r o r   t o   t r u e 
 
 	 e n d   t r y 
 
 	 s e t   s h e l l r e s u l t   t o   r e a d t e m p ( ) 
 
 	 w r i t e t o l o g ( " s h e l l r e s u l t :   "   &   s h e l l r e s u l t   &   "   "   &   Z i p E r r o r T e x t ) 
 
 	 - - d i s p l a y   d i a l o g   s h e l l r e s u l t 
 
 	 
 
 	 i f   Z i p F i x E r r o r   t h e n 
 
 	 	 s e t   E r r o r C o u n t   t o   E r r o r C o u n t   +   1 
 
 	 	 s e t   E r r o r L i s t   t o   ( ( E r r o r L i s t   &   f i l e N a m e   &   f i l e E x t e n s i o n   &   "   h a d   a   p r o b l e m   w i t h   Z i p F i x : 
 
 "   &   Z i p E r r o r T e x t   a s   t e x t )   &   " 
 
 " ) 
 
 	 	 r e t u r n 
 
 	 e n d   i f 
 
 	 
 
 	 - - c h e c k   i t ' s   a n   e P u b   f i l e . 
 
 	 s e t   e P u b S i g   t o   " N O T _ e P u b " 
 
 	 t r y 
 
 	 	 s e t   e P u b S i g   t o   r e a d   P O S I X   f i l e   f i x e d F i l e P a t h   f r o m   3 1   f o r   2 8 
 
 	 e n d   t r y 
 
 	 - - d i s p l a y   d i a l o g   e P u b S i g 
 
 	 i f   e P u b S i g   i s   n o t   " m i m e t y p e a p p l i c a t i o n / e p u b + z i p "   t h e n 
 
 	 	 s e t   E r r o r C o u n t   t o   E r r o r C o u n t   +   1 
 
 	 	 s e t   E r r o r L i s t   t o   E r r o r L i s t   &   e n c r y p t e d F i l e   &   "   i s   n o t   a n   e P u b   f i l e . 
 
 " 
 
 	 	 t e l l   a p p l i c a t i o n   " F i n d e r " 
 
 	 	 	 m o v e   a l i a s   ( ( P O S I X   f i l e   f i x e d F i l e P a t h )   a s   t e x t )   t o   t r a s h 
 
 	 	 e n d   t e l l 
 
 	 	 r e t u r n 
 
 	 e n d   i f 
 
 	 
 
 	 i f   o u t p u t F o l d e r   i s   " "   o r   n o t   f o l d e r e x i s t s ( o u t p u t F o l d e r )   t h e n 
 
 	 	 s e t   u n l o c k e d F i l e P a t h   t o   P O S I X   p a t h   o f   f i l e   ( p a r e n t _ f o l d e r   &   f i l e N a m e   &   " _ n o d r m "   &   f i l e E x t e n s i o n ) 
 
 	 e l s e 
 
 	 	 s e t   u n l o c k e d F i l e P a t h   t o   P O S I X   p a t h   o f   f i l e   ( o u t p u t F o l d e r   &   f i l e N a m e   &   " _ n o d r m "   &   f i l e E x t e n s i o n ) 
 
 	 e n d   i f 
 
 	 s e t   s h e l l r e s u l t   t o   " n o   k e y s " 
 
 	 s e t   E r r o r T e x t   t o   " " 
 
 	 
 
 	 - -   g e t   e n c r y p t i o n   t y p e 
 
 	 s e t   T r y B a n d N e P u b   t o   t r u e 
 
 	 s e t   T r y A d o b e e P u b   t o   t r u e 
 
 	 s e t   s h e l l c o m m a n d   t o   p y t h o n   &   ( q u o t e d   f o r m   o f   e P u b T e s t T o o l )   &   "   "   &   ( q u o t e d   f o r m   o f   f i x e d F i l e P a t h ) 
 
 	 s e t   s h e l l c o m m a n d   t o   s h e l l c o m m a n d   &   "   >   "   &   q u o t e d t e m p p a t h ( ) 
 
 	 - - d i s p l a y   d i a l o g   " s h e l l c o m m a n d :   "   &   s h e l l c o m m a n d   b u t t o n s   { " O K " }   d e f a u l t   b u t t o n   1   g i v i n g   u p   a f t e r   1 0 
 
 	 w r i t e t o l o g ( " s h e l l c o m m a n d :   "   &   s h e l l c o m m a n d ) 
 
 	 c l e a r t e m p ( ) 
 
 	 s e t   T e s t E r r o r   t o   f a l s e 
 
 	 s e t   E r r o r T e x t   t o   " " 
 
 	 t r y 
 
 	 	 d o   s h e l l   s c r i p t   s h e l l c o m m a n d 
 
 	 o n   e r r o r   E r r o r T e x t 
 
 	 	 s e t   T e s t E r r o r   t o   t r u e 
 
 	 e n d   t r y 
 
 	 s e t   s h e l l r e s u l t   t o   r e a d t e m p ( ) 
 
 	 w r i t e t o l o g ( " s h e l l r e s u l t :   "   &   s h e l l r e s u l t   &   "   "   &   E r r o r T e x t ) 
 
 	 - - d i s p l a y   d i a l o g   s h e l l r e s u l t 
 
 	 i f   n o t   T e s t E r r o r   t h e n 
 
 	 	 i f   ( o f f s e t   o f   " B & N "   i n   s h e l l r e s u l t )   >   0   t h e n 
 
 	 	 	 s e t   T r y A d o b e e P u b   t o   f a l s e 
 
 	 	 e l s e   i f   ( o f f s e t   o f   " A d o b e "   i n   s h e l l r e s u l t )   >   0   t h e n 
 
 	 	 	 s e t   T r y B a n d N e P u b   t o   f a l s e 
 
 	 	 e l s e   i f   ( o f f s e t   o f   " U n e n c r y p t e d "   i n   s h e l l r e s u l t )   >   0   t h e n 
 
 	 	 	 s e t   T r y A d o b e e P u b   t o   f a l s e 
 
 	 	 	 s e t   T r y B a n d N e P u b   t o   f a l s e 
 
 	 	 e n d   i f 
 
 	 e n d   i f 
 
 	 
 
 	 
 
 	 - -   f i r s t   w e ' l l   t r y   t h e   B a r n e s   &   N o b l e   k e y s 
 
 	 i f   T r y B a n d N e P u b   t h e n 
 
 	 	 s e t   d e c o d e d   t o   d e c o d e b a n d n e p u b ( f i x e d F i l e P a t h ,   u n l o c k e d F i l e P a t h ,   b n K e y s ) 
 
 	 	 i f   n o t   d e c o d e d   t h e n 
 
 	 	 	 s e t   n e w K e y L i s t   t o   G e t N o o k K e y s ( ) 
 
 	 	 	 s e t   d e c o d e d   t o   d e c o d e b a n d n e p u b ( f i x e d F i l e P a t h ,   u n l o c k e d F i l e P a t h ,   n e w K e y L i s t ) 
 
 	 	 	 i f   d e c o d e d   t h e n 
 
 	 	 	 	 s e t   b n K e y s   t o   b n K e y s   &   n e w K e y L i s t 
 
 	 	 	 e n d   i f 
 
 	 	 e n d   i f 
 
 	 	 
 
 	 e n d   i f 
 
 	 
 
 	 i f   ( n o t   d e c o d e d )   a n d   T r y A d o b e e P u b   t h e n 
 
 	 	 s e t   d e c o d e d   t o   d e c o d e a d o b e e p u b ( f i x e d F i l e P a t h ,   u n l o c k e d F i l e P a t h ,   A d e p t K e y L i s t ) 
 
 	 	 i f   n o t   d e c o d e d   t h e n 
 
 	 	 	 s e t   n e w K e y L i s t   t o   G e t A d e p t K e y s ( ) 
 
 	 	 	 s e t   d e c o d e d   t o   d e c o d e a d o b e e p u b ( f i x e d F i l e P a t h ,   u n l o c k e d F i l e P a t h ,   n e w K e y L i s t ) 
 
 	 	 	 i f   d e c o d e d   t h e n 
 
 	 	 	 	 s e t   A d e p t K e y L i s t   t o   A d e p t K e y L i s t   &   n e w K e y L i s t 
 
 	 	 	 e n d   i f 
 
 	 	 e n d   i f 
 
 	 e n d   i f 
 
 	 
 
 	 i f   d e c o d e d   t h e n 
 
 	 	 s e t   C o m p l e t e d C o u n t   t o   C o m p l e t e d C o u n t   +   1 
 
 	 	 s e t   C o m p l e t e d L i s t   t o   C o m p l e t e d L i s t   &   f i l e N a m e   &   f i l e E x t e n s i o n   &   p a r a e n d 
 
 	 e l s e   i f   n o t   T r y A d o b e e P u b   a n d   n o t   T r y B a n d N e P u b   t h e n 
 
 	 	 s e t   W a r n i n g C o u n t   t o   W a r n i n g C o u n t   +   1 
 
 	 	 s e t   W a r n i n g L i s t   t o   ( W a r n i n g L i s t   &   f i l e N a m e   &   "   d o e s n ' t   s e e m   t o   b e   e n c r y p t e d . 
 
 " ) 
 
 	 e l s e   i f   s h e l l r e s u l t   i s   " n o   k e y s "   t h e n 
 
 	 	 s e t   E r r o r C o u n t   t o   E r r o r C o u n t   +   1 
 
 	 	 s e t   E r r o r L i s t   t o   ( E r r o r L i s t   &   f i l e N a m e   &   f i l e E x t e n s i o n   &   "   c o u l d n ' t   b e   d e c o d e d :   n o   k e y s . 
 
 " ) 
 
 	 e l s e 
 
 	 	 s e t   E r r o r C o u n t   t o   E r r o r C o u n t   +   1 
 
 	 	 s e t   E r r o r L i s t   t o   ( ( E r r o r L i s t   &   f i l e N a m e   &   f i l e E x t e n s i o n   &   "   c o u l d n ' t   b e   d e c o d e d : 
 
 "   &   E r r o r T e x t   a s   t e x t )   &   " 
 
 " ) 
 
 	 e n d   i f 
 
 	 
 
 	 t e l l   a p p l i c a t i o n   " F i n d e r " 
 
 	 	 m o v e   a l i a s   ( ( P O S I X   f i l e   f i x e d F i l e P a t h )   a s   t e x t )   t o   t r a s h 
 
 	 e n d   t e l l 
 
 e n d   u n l o c k e p u b f i l e 
 
 
 
 o n   d e c o d e b a n d n e p u b ( f i x e d F i l e P a t h ,   u n l o c k e d F i l e P a t h ,   k e y L i s t ) 
 
 	 s e t   d e c o d e d   t o   f a l s e 
 
 	 r e p e a t   w i t h   B N K e y   i n   k e y L i s t 
 
 	 	 s e t   k e y f i l e p a t h   t o   t h i r d   i t e m   o f   B N K e y 
 
 	 	 i f   l e n g t h   o f   k e y f i l e p a t h   >   0   t h e n 
 
 	 	 	 s e t   s h e l l c o m m a n d   t o   p y t h o n   &   ( q u o t e d   f o r m   o f   B N e P u b T o o l )   &   "   "   &   ( q u o t e d   f o r m   o f   k e y f i l e p a t h )   &   "   "   &   ( q u o t e d   f o r m   o f   f i x e d F i l e P a t h )   &   "   "   &   ( q u o t e d   f o r m   o f   u n l o c k e d F i l e P a t h ) 
 
 	 	 	 s e t   s h e l l c o m m a n d   t o   s h e l l c o m m a n d   &   "   >   "   &   q u o t e d t e m p p a t h ( ) 
 
 	 	 	 - - d i s p l a y   d i a l o g   " s h e l l c o m m a n d :   "   &   s h e l l c o m m a n d   b u t t o n s   { " O K " }   d e f a u l t   b u t t o n   1   g i v i n g   u p   a f t e r   1 0 
 
 	 	 	 w r i t e t o l o g ( " s h e l l c o m m a n d :   "   &   s h e l l c o m m a n d ) 
 
 	 	 	 c l e a r t e m p ( ) 
 
 	 	 	 s e t   D e c o d i n g E r r o r   t o   f a l s e 
 
 	 	 	 s e t   E r r o r T e x t   t o   " " 
 
 	 	 	 t r y 
 
 	 	 	 	 d o   s h e l l   s c r i p t   s h e l l c o m m a n d 
 
 	 	 	 o n   e r r o r   E r r o r T e x t 
 
 	 	 	 	 s e t   D e c o d i n g E r r o r   t o   t r u e 
 
 	 	 	 e n d   t r y 
 
 	 	 	 s e t   s h e l l r e s u l t   t o   r e a d t e m p ( ) 
 
 	 	 	 w r i t e t o l o g ( " s h e l l r e s u l t :   "   &   s h e l l r e s u l t   &   "   "   &   E r r o r T e x t ) 
 
 	 	 	 - - d i s p l a y   d i a l o g   s h e l l r e s u l t 
 
 	 	 	 i f   n o t   D e c o d i n g E r r o r   t h e n 
 
 	 	 	 	 s e t   d e c o d e d   t o   t r u e 
 
 	 	 	 	 e x i t   r e p e a t 
 
 	 	 	 e n d   i f 
 
 	 	 e n d   i f 
 
 	 e n d   r e p e a t 
 
 	 r e t u r n   d e c o d e d 
 
 e n d   d e c o d e b a n d n e p u b 
 
 
 
 o n   d e c o d e a d o b e e p u b ( f i x e d F i l e P a t h ,   u n l o c k e d F i l e P a t h ,   k e y L i s t ) 
 
 	 s e t   d e c o d e d   t o   f a l s e 
 
 	 r e p e a t   w i t h   A d e p t K e y   i n   k e y L i s t 
 
 	 	 s e t   s h e l l c o m m a n d   t o   p y t h o n   &   ( q u o t e d   f o r m   o f   A d o b e e P u b T o o l )   &   "   "   &   ( q u o t e d   f o r m   o f   A d e p t K e y )   &   "   "   &   ( q u o t e d   f o r m   o f   f i x e d F i l e P a t h )   &   "   "   &   ( q u o t e d   f o r m   o f   u n l o c k e d F i l e P a t h ) 
 
 	 	 s e t   s h e l l c o m m a n d   t o   s h e l l c o m m a n d   &   "   >   "   &   q u o t e d t e m p p a t h ( ) 
 
 	 	 - - d i s p l a y   d i a l o g   " s h e l l c o m m a n d :   "   d e f a u l t   a n s w e r   s h e l l c o m m a n d   b u t t o n s   { " O K " }   d e f a u l t   b u t t o n   1   g i v i n g   u p   a f t e r   1 0 
 
 	 	 w r i t e t o l o g ( " s h e l l c o m m a n d :   "   &   s h e l l c o m m a n d ) 
 
 	 	 c l e a r t e m p ( ) 
 
 	 	 s e t   D e c o d i n g E r r o r   t o   f a l s e 
 
 	 	 s e t   E r r o r T e x t   t o   " " 
 
 	 	 t r y 
 
 	 	 	 d o   s h e l l   s c r i p t   s h e l l c o m m a n d 
 
 	 	 o n   e r r o r   E r r o r T e x t 
 
 	 	 	 s e t   D e c o d i n g E r r o r   t o   t r u e 
 
 	 	 e n d   t r y 
 
 	 	 s e t   s h e l l r e s u l t   t o   r e a d t e m p ( )   a s   t e x t 
 
 	 	 w r i t e t o l o g ( " s h e l l r e s u l t :   "   &   s h e l l r e s u l t   &   "   "   &   E r r o r T e x t ) 
 
 	 	 - - d i s p l a y   d i a l o g   s h e l l r e s u l t 
 
 	 	 i f   n o t   D e c o d i n g E r r o r   t h e n 
 
 	 	 	 s e t   d e c o d e d   t o   t r u e 
 
 	 	 	 e x i t   r e p e a t 
 
 	 	 e n d   i f 
 
 	 e n d   r e p e a t 
 
 	 r e t u r n   d e c o d e d 
 
 e n d   d e c o d e a d o b e e p u b 
 
 
 
 
 
 o n   u n l o c k p d f f i l e ( e n c r y p t e d F i l e ) 
 
 	 - - c h e c k   i t ' s   a n   e P u b   f i l e . 
 
 	 s e t   P D F S i g   t o   " N O T _ P D F " 
 
 	 t r y 
 
 	 	 s e t   P D F S i g   t o   r e a d   f i l e   e n c r y p t e d F i l e   f r o m   1   f o r   4 
 
 	 e n d   t r y 
 
 	 - - d i s p l a y   d i a l o g   P D F S i g 
 
 	 i f   P D F S i g   i s   n o t   " % P D F "   t h e n 
 
 	 	 s e t   E r r o r C o u n t   t o   E r r o r C o u n t   +   1 
 
 	 	 s e t   E r r o r L i s t   t o   E r r o r L i s t   &   e n c r y p t e d F i l e   &   "   i s   n o t   a   P D F   f i l e . 
 
 " 
 
 	 	 r e t u r n 
 
 	 e n d   i f 
 
 	 s e t   e n c r y p t e d F i l e P a t h   t o   P O S I X   p a t h   o f   f i l e   e n c r y p t e d F i l e 
 
 	 t e l l   a p p l i c a t i o n   " F i n d e r " 
 
 	 	 s e t   p a r e n t _ f o l d e r   t o   ( c o n t a i n e r   o f   f i l e   e n c r y p t e d F i l e )   a s   t e x t 
 
 	 	 s e t   f i l e N a m e   t o   ( n a m e   o f   f i l e   e n c r y p t e d F i l e )   a s   t e x t 
 
 	 e n d   t e l l 
 
 	 s e t   f i l e E x t e n s i o n   t o   " . "   &   G e t F i l e E x t e n s i o n ( f i l e N a m e ) 
 
 	 s e t   f i l e N a m e   t o   G e t F i l e N a m e O n l y ( f i l e N a m e ) 
 
 	 
 
 	 s e t   d e c o d e d   t o   " N O " 
 
 	 - -   f i r s t   w e   m u s t   c h e c k   w e   h a v e   a   P D F   s c r i p t 
 
 	 i f   n o t   f i l e e x i s t s ( A d o b e P D F T o o l )   t h e n 
 
 	 	 s e t   E r r o r C o u n t   t o   E r r o r C o u n t   +   1 
 
 	 	 s e t   E r r o r L i s t   t o   E r r o r L i s t   &   e n c r y p t e d F i l e   &   "   i s   a   P D F   f i l e   a n d   n o   i n e p t p d f   s c r i p t   f o u n d . 
 
 " 
 
 	 	 r e t u r n 
 
 	 e n d   i f 
 
 	 
 
 	 i f   o u t p u t F o l d e r   i s   " "   o r   n o t   f o l d e r e x i s t s ( o u t p u t F o l d e r )   t h e n 
 
 	 	 s e t   u n l o c k e d F i l e P a t h   t o   P O S I X   p a t h   o f   f i l e   ( p a r e n t _ f o l d e r   &   f i l e N a m e   &   " _ n o d r m "   &   f i l e E x t e n s i o n ) 
 
 	 e l s e 
 
 	 	 s e t   u n l o c k e d F i l e P a t h   t o   P O S I X   p a t h   o f   f i l e   ( o u t p u t F o l d e r   &   f i l e N a m e   &   " _ n o d r m "   &   f i l e E x t e n s i o n ) 
 
 	 e n d   i f 
 
 	 s e t   d e c o d e d   t o   f a l s e 
 
 	 s e t   s h e l l r e s u l t   t o   " n o   k e y s " 
 
 	 s e t   E r r o r T e x t   t o   " " 
 
 	 
 
 	 r e p e a t   w i t h   A d e p t K e y   i n   A d e p t K e y L i s t 
 
 	 	 s e t   s h e l l c o m m a n d   t o   p y t h o n   &   ( q u o t e d   f o r m   o f   A d o b e P D F T o o l )   &   "   "   &   ( q u o t e d   f o r m   o f   A d e p t K e y )   &   "   "   &   ( q u o t e d   f o r m   o f   e n c r y p t e d F i l e P a t h )   &   "   "   &   ( q u o t e d   f o r m   o f   u n l o c k e d F i l e P a t h ) 
 
 	 	 s e t   s h e l l c o m m a n d   t o   s h e l l c o m m a n d   &   "   >   "   &   q u o t e d t e m p p a t h ( ) 
 
 	 	 - - d i s p l a y   d i a l o g   " s h e l l c o m m a n d :   "   d e f a u l t   a n s w e r   s h e l l c o m m a n d   b u t t o n s   { " O K " }   d e f a u l t   b u t t o n   1   g i v i n g   u p   a f t e r   1 0 
 
 	 	 w r i t e t o l o g ( " s h e l l c o m m a n d :   "   &   s h e l l c o m m a n d ) 
 
 	 	 c l e a r t e m p ( ) 
 
 	 	 s e t   D e c o d i n g E r r o r   t o   f a l s e 
 
 	 	 s e t   E r r o r T e x t   t o   " " 
 
 	 	 t r y 
 
 	 	 	 d o   s h e l l   s c r i p t   s h e l l c o m m a n d 
 
 	 	 o n   e r r o r   E r r o r T e x t 
 
 	 	 	 s e t   D e c o d i n g E r r o r   t o   t r u e 
 
 	 	 e n d   t r y 
 
 	 	 s e t   s h e l l r e s u l t   t o   r e a d t e m p ( ) 
 
 	 	 w r i t e t o l o g ( " s h e l l r e s u l t :   "   &   s h e l l r e s u l t   &   "   "   &   E r r o r T e x t ) 
 
 	 	 - - d i s p l a y   d i a l o g   s h e l l r e s u l t 
 
 	 	 i f   n o t   D e c o d i n g E r r o r   t h e n 
 
 	 	 	 s e t   d e c o d e d   t o   t r u e 
 
 	 	 	 e x i t   r e p e a t 
 
 	 	 e n d   i f 
 
 	 e n d   r e p e a t 
 
 	 
 
 	 i f   d e c o d e d   t h e n 
 
 	 	 s e t   C o m p l e t e d C o u n t   t o   C o m p l e t e d C o u n t   +   1 
 
 	 	 s e t   C o m p l e t e d L i s t   t o   C o m p l e t e d L i s t   &   f i l e N a m e   &   f i l e E x t e n s i o n   &   p a r a e n d 
 
 	 e l s e   i f   s h e l l r e s u l t   i s   " n o   k e y s "   t h e n 
 
 	 	 s e t   E r r o r C o u n t   t o   E r r o r C o u n t   +   1 
 
 	 	 s e t   E r r o r L i s t   t o   ( E r r o r L i s t   &   f i l e N a m e   &   f i l e E x t e n s i o n   &   "   c o u l d n ' t   b e   d e c o d e d :   n o   k e y s . 
 
 " ) 
 
 	 e l s e 
 
 	 	 s e t   E r r o r C o u n t   t o   E r r o r C o u n t   +   1 
 
 	 	 s e t   E r r o r L i s t   t o   ( ( E r r o r L i s t   &   f i l e N a m e   &   f i l e E x t e n s i o n   &   "   c o u l d n ' t   b e   d e c o d e d : 
 
 "   &   E r r o r T e x t   a s   t e x t )   &   " 
 
 " ) 
 
 	 e n d   i f 
 
 e n d   u n l o c k p d f f i l e 
 
 
 
 o n   h a n d l e f i l e ( d r o p p e d F i l e ) 
 
 	 t e l l   a p p l i c a t i o n   " F i n d e r " 
 
 	 	 s e t   f i l e N a m e   t o   ( n a m e   o f   f i l e   d r o p p e d F i l e )   a s   t e x t 
 
 	 e n d   t e l l 
 
 	 w r i t e t o l o g ( " P r o c e s s i n g   f i l e :   "   &   f i l e N a m e ) 
 
 	 s e t   f i l e E x t e n s i o n   t o   G e t F i l e E x t e n s i o n ( f i l e N a m e ) 
 
 	 s e t   f i l e N a m e   t o   G e t F i l e N a m e O n l y ( f i l e N a m e ) 
 
 	 i f   f i l e E x t e n s i o n   i s   " p r c "   o r   f i l e E x t e n s i o n   i s   " m o b i "   o r   f i l e E x t e n s i o n   i s   " p o b i "   o r   f i l e E x t e n s i o n   i s   " a z w "   o r   f i l e E x t e n s i o n   i s   " a z w 1 "   o r   f i l e E x t e n s i o n   i s   " t p z "   o r   f i l e E x t e n s i o n   i s   " a z w 3 "   o r   f i l e E x t e n s i o n   i s   " a z w 4 "   t h e n 
 
 	 	 s e t   c o m p l e t e d e b o o k s   t o   c o m p l e t e d e b o o k s   +   1 
 
 	 	 I n c P r o g r e s s ( f i l e N a m e ,   c o m p l e t e d e b o o k s ) 
 
 	 	 u n l o c k m o b i f i l e ( d r o p p e d F i l e   a s   t e x t ) 
 
 	 e l s e   i f   f i l e E x t e n s i o n   i s   " p d b "   t h e n 
 
 	 	 s e t   c o m p l e t e d e b o o k s   t o   c o m p l e t e d e b o o k s   +   1 
 
 	 	 I n c P r o g r e s s ( f i l e N a m e ,   c o m p l e t e d e b o o k s ) 
 
 	 	 u n l o c k p d b f i l e ( d r o p p e d F i l e   a s   t e x t ) 
 
 	 e l s e   i f   f i l e E x t e n s i o n   i s   " e p u b "   t h e n 
 
 	 	 s e t   c o m p l e t e d e b o o k s   t o   c o m p l e t e d e b o o k s   +   1 
 
 	 	 I n c P r o g r e s s ( f i l e N a m e ,   c o m p l e t e d e b o o k s ) 
 
 	 	 u n l o c k e p u b f i l e ( d r o p p e d F i l e   a s   t e x t ) 
 
 	 e l s e   i f   f i l e E x t e n s i o n   i s   " p d f "   t h e n 
 
 	 	 s e t   c o m p l e t e d e b o o k s   t o   c o m p l e t e d e b o o k s   +   1 
 
 	 	 I n c P r o g r e s s ( f i l e N a m e ,   c o m p l e t e d e b o o k s ) 
 
 	 	 u n l o c k p d f f i l e ( d r o p p e d F i l e   a s   t e x t ) 
 
 	 e n d   i f 
 
 e n d   h a n d l e f i l e 
 
 
 
 o n   h a n d l e f o l d e r ( d r o p p e d F o l d e r ) 
 
 	 t e l l   a p p l i c a t i o n   " F i n d e r "   t o   s e t   f i l e L i s t   t o   ( e v e r y   f i l e   i n   f o l d e r   d r o p p e d F o l d e r ) 
 
 	 t e l l   a p p l i c a t i o n   " F i n d e r "   t o   s e t   f o l d e r L i s t   t o   ( e v e r y   f o l d e r   i n   f o l d e r   d r o p p e d F o l d e r ) 
 
 	 r e p e a t   w i t h   t h i s _ i t e m   i n   f i l e L i s t 
 
 	 	 i f   n o t   P r o g r e s s A c t i v e ( )   t h e n 
 
 	 	 	 e x i t   r e p e a t 
 
 	 	 e n d   i f 
 
 	 	 h a n d l e f i l e ( t h i s _ i t e m   a s   t e x t ) 
 
 	 e n d   r e p e a t 
 
 	 r e p e a t   w i t h   t h i s _ i t e m   i n   f o l d e r L i s t 
 
 	 	 i f   n o t   P r o g r e s s A c t i v e ( )   t h e n 
 
 	 	 	 e x i t   r e p e a t 
 
 	 	 e n d   i f 
 
 	 	 h a n d l e f o l d e r ( t h i s _ i t e m   a s   t e x t ) 
 
 	 e n d   r e p e a t 
 
 e n d   h a n d l e f o l d e r 
 
 
 
 o n   c o u n t f i l e ( d r o p p e d F i l e ) 
 
 	 t e l l   a p p l i c a t i o n   " F i n d e r " 
 
 	 	 s e t   f i l e N a m e   t o   ( n a m e   o f   f i l e   d r o p p e d F i l e )   a s   t e x t 
 
 	 e n d   t e l l 
 
 	 s e t   f i l e E x t e n s i o n   t o   G e t F i l e E x t e n s i o n ( f i l e N a m e ) 
 
 	 s e t   f i l e N a m e   t o   G e t F i l e N a m e O n l y ( f i l e N a m e ) 
 
 	 - - d i s p l a y   d i a l o g   " f i l e N a m e :   "   &   f i l e N a m e   &   " 
 
 	 - - e x t e n s i o n :   "   &   f i l e E x t e n s i o n 
 
 	 i f   f i l e E x t e n s i o n   i s   i n   h a n d l e d E x t e n s i o n s   t h e n 
 
 	 	 s e t   t o t a l e b o o k s   t o   t o t a l e b o o k s   +   1 
 
 	 e n d   i f 
 
 e n d   c o u n t f i l e 
 
 
 
 o n   G e t S e r i a l s t r i n g ( ) 
 
 	 s e t   S e r i a l s t r i n g   t o   " " 
 
 	 r e p e a t   w i t h   S e r i a l   i n   K i n d l e S e r i a l L i s t 
 
 	 	 i f   S e r i a l s t r i n g   i s   " "   t h e n 
 
 	 	 	 s e t   S e r i a l s t r i n g   t o   S e r i a l 
 
 	 	 e l s e 
 
 	 	 	 s e t   S e r i a l s t r i n g   t o   S e r i a l s t r i n g   &   " , "   &   S e r i a l 
 
 	 	 e n d   i f 
 
 	 e n d   r e p e a t 
 
 	 r e t u r n   S e r i a l s t r i n g 
 
 e n d   G e t S e r i a l s t r i n g 
 
 
 
 o n   G e t P I D s t r i n g ( ) 
 
 	 s e t   P I D s t r i n g   t o   " " 
 
 	 r e p e a t   w i t h   P I D   i n   P I D s 
 
 	 	 i f   P I D s t r i n g   i s   " "   t h e n 
 
 	 	 	 s e t   P I D s t r i n g   t o   P I D 
 
 	 	 e l s e 
 
 	 	 	 s e t   P I D s t r i n g   t o   P I D s t r i n g   &   " , "   &   P I D 
 
 	 	 e n d   i f 
 
 	 e n d   r e p e a t 
 
 	 r e t u r n   P I D s t r i n g 
 
 e n d   G e t P I D s t r i n g 
 
 
 
 o n   G e t U D I D s t r i n g ( ) 
 
 	 s e t   U D I D s t r i n g   t o   " " 
 
 	 r e p e a t   w i t h   U D I D P a i r   i n   U D I D s 
 
 	 	 i f   U D I D s t r i n g   i s   " "   t h e n 
 
 	 	 	 s e t   U D I D s t r i n g   t o   f i r s t   i t e m   o f   U D I D P a i r 
 
 	 	 e l s e 
 
 	 	 	 s e t   U D I D s t r i n g   t o   U D I D s t r i n g   &   " , "   &   f i r s t   i t e m   o f   U D I D P a i r 
 
 	 	 e n d   i f 
 
 	 e n d   r e p e a t 
 
 	 r e t u r n   U D I D s t r i n g 
 
 e n d   G e t U D I D s t r i n g 
 
 
 
 o n   G e t U D I D P I D s ( ) 
 
 	 s e t   U D I D P I D s   t o   " " 
 
 	 r e p e a t   w i t h   U D I D P a i r   i n   U D I D s 
 
 	 	 i f   U D I D P I D s   i s   " "   t h e n 
 
 	 	 	 s e t   U D I D P I D s   t o   s e c o n d   i t e m   o f   U D I D P a i r 
 
 	 	 e l s e 
 
 	 	 	 s e t   U D I D P I D s   t o   U D I D P I D s   &   " , "   &   s e c o n d   i t e m   o f   U D I D P a i r 
 
 	 	 e n d   i f 
 
 	 e n d   r e p e a t 
 
 	 r e t u r n   U D I D P I D s 
 
 e n d   G e t U D I D P I D s 
 
 
 
 o n   G e t A d e p t s t r i n g ( ) 
 
 	 s e t   A d e p t s t r i n g   t o   " " 
 
 	 r e p e a t   w i t h   A d e p t K e y F i l e   i n   A d e p t K e y L i s t 
 
 	 	 s e t   A p p l e T y p e F i l e   t o   P O S I X   f i l e   ( A d e p t K e y F i l e   a s   t e x t ) 
 
 	 	 t e l l   a p p l i c a t i o n   " F i n d e r " 
 
 	 	 	 s e t   f i l e N a m e   t o   n a m e   o f   f i l e   ( A p p l e T y p e F i l e   a s   t e x t ) 
 
 	 	 e n d   t e l l 
 
 	 	 
 
 	 	 i f   A d e p t s t r i n g   i s   " "   t h e n 
 
 	 	 	 s e t   A d e p t s t r i n g   t o   f i l e N a m e 
 
 	 	 e l s e 
 
 	 	 	 s e t   A d e p t s t r i n g   t o   A d e p t s t r i n g   &   " 
 
 "   &   f i l e N a m e 
 
 	 	 e n d   i f 
 
 	 e n d   r e p e a t 
 
 	 r e t u r n   A d e p t s t r i n g 
 
 e n d   G e t A d e p t s t r i n g 
 
 
 
 o n   G e t A n d r o i d s t r i n g ( ) 
 
 	 s e t   A n d r o i d s t r i n g   t o   " " 
 
 	 r e p e a t   w i t h   A n d r o i d K e y F i l e   i n   A n d r o i d K e y L i s t 
 
 	 	 s e t   A p p l e T y p e F i l e   t o   P O S I X   f i l e   ( A n d r o i d K e y F i l e   a s   t e x t ) 
 
 	 	 t e l l   a p p l i c a t i o n   " F i n d e r " 
 
 	 	 	 s e t   f i l e N a m e   t o   n a m e   o f   f i l e   ( A p p l e T y p e F i l e   a s   t e x t ) 
 
 	 	 e n d   t e l l 
 
 	 	 
 
 	 	 i f   A n d r o i d s t r i n g   i s   " "   t h e n 
 
 	 	 	 s e t   A n d r o i d s t r i n g   t o   f i l e N a m e 
 
 	 	 e l s e 
 
 	 	 	 s e t   A n d r o i d s t r i n g   t o   A n d r o i d s t r i n g   &   " 
 
 "   &   f i l e N a m e 
 
 	 	 e n d   i f 
 
 	 e n d   r e p e a t 
 
 	 r e t u r n   A n d r o i d s t r i n g 
 
 e n d   G e t A n d r o i d s t r i n g 
 
 
 
 o n   G e t K i n d l e s t r i n g ( ) 
 
 	 s e t   K i n d l e s t r i n g   t o   " " 
 
 	 r e p e a t   w i t h   K i n d l e K e y F i l e   i n   K i n d l e K e y L i s t 
 
 	 	 s e t   A p p l e T y p e F i l e   t o   P O S I X   f i l e   ( K i n d l e K e y F i l e   a s   t e x t ) 
 
 	 	 t e l l   a p p l i c a t i o n   " F i n d e r " 
 
 	 	 	 s e t   f i l e N a m e   t o   n a m e   o f   f i l e   ( A p p l e T y p e F i l e   a s   t e x t ) 
 
 	 	 e n d   t e l l 
 
 	 	 
 
 	 	 i f   K i n d l e s t r i n g   i s   " "   t h e n 
 
 	 	 	 s e t   K i n d l e s t r i n g   t o   f i l e N a m e 
 
 	 	 e l s e 
 
 	 	 	 s e t   K i n d l e s t r i n g   t o   K i n d l e s t r i n g   &   " 
 
 "   &   f i l e N a m e 
 
 	 	 e n d   i f 
 
 	 e n d   r e p e a t 
 
 	 r e t u r n   K i n d l e s t r i n g 
 
 e n d   G e t K i n d l e s t r i n g 
 
 
 
 o n   G e t e R e a d e r K e y s t r i n g ( ) 
 
 	 s e t   K e y s t r i n g   t o   " " 
 
 	 r e p e a t   w i t h   k e y   i n   b n K e y s 
 
 	 	 i f   l e n g t h   o f   f i r s t   i t e m   o f   k e y   >   0   a n d   l e n g t h   o f   s e c o n d   i t e m   o f   k e y   >   0   t h e n 
 
 	 	 	 i f   K e y s t r i n g   i s   " "   t h e n 
 
 	 	 	 	 s e t   K e y s t r i n g   t o   f i r s t   i t e m   o f   k e y   &   " : "   &   s e c o n d   i t e m   o f   k e y 
 
 	 	 	 e l s e 
 
 	 	 	 	 s e t   K e y s t r i n g   t o   K e y s t r i n g   &   " 
 
 "   &   f i r s t   i t e m   o f   k e y   &   " : "   &   s e c o n d   i t e m   o f   k e y 
 
 	 	 	 e n d   i f 
 
 	 	 e n d   i f 
 
 	 e n d   r e p e a t 
 
 	 r e t u r n   K e y s t r i n g 
 
 e n d   G e t e R e a d e r K e y s t r i n g 
 
 
 
 o n   G e t B N K e y s t r i n g ( ) 
 
 	 s e t   B N K e y s t r i n g   t o   " " 
 
 	 r e p e a t   w i t h   B N K e y   i n   b n K e y s 
 
 	 	 i f   ( l e n g t h   o f   B N K e y   >   2 )   a n d   ( ( l e n g t h   o f   ( t h i r d   i t e m   o f   B N K e y ) )   >   0 )   t h e n 
 
 	 	 	 i f   B N K e y s t r i n g   i s   " "   t h e n 
 
 	 	 	 	 s e t   B N K e y s t r i n g   t o   f i r s t   i t e m   o f   B N K e y 
 
 	 	 	 e l s e 
 
 	 	 	 	 s e t   B N K e y s t r i n g   t o   B N K e y s t r i n g   &   " 
 
 "   &   f i r s t   i t e m   o f   B N K e y 
 
 	 	 	 e n d   i f 
 
 	 	 e n d   i f 
 
 	 e n d   r e p e a t 
 
 	 r e t u r n   B N K e y s t r i n g 
 
 e n d   G e t B N K e y s t r i n g 
 
 
 
 o n   D e l e t e e R e a d e r K e y s ( ) 
 
 	 s e t   n e w K e y s   t o   { } 
 
 	 r e p e a t   w i t h   B N K e y   i n   b n K e y s 
 
 	 	 i f   l e n g t h   o f   t h i r d   i t e m   o f   B N K e y   >   0   t h e n 
 
 	 	 	 
 
 	 	 	 s e t   n e w K e y s   t o   n e w K e y s   &   { { f i r s t   i t e m   o f   B N K e y ,   " " ,   t h i r d   i t e m   o f   B N K e y } } 
 
 	 	 e n d   i f 
 
 	 e n d   r e p e a t 
 
 	 s e t   b n K e y s   t o   n e w K e y s 
 
 e n d   D e l e t e e R e a d e r K e y s 
 
 
 
 o n   D e l e t e B N K e y s ( ) 
 
 	 s e t   n e w K e y s   t o   { } 
 
 	 r e p e a t   w i t h   B N K e y   i n   b n K e y s 
 
 	 	 i f   l e n g t h   o f   s e c o n d   i t e m   o f   B N K e y   >   0   t h e n 
 
 	 	 	 
 
 	 	 	 s e t   n e w K e y s   t o   n e w K e y s   &   { { f i r s t   i t e m   o f   B N K e y ,   s e c o n d   i t e m   o f   B N K e y ,   " " } } 
 
 	 	 e n d   i f 
 
 	 e n d   r e p e a t 
 
 	 s e t   b n K e y s   t o   n e w K e y s 
 
 e n d   D e l e t e B N K e y s 
 
 
 
 
 
 o n   G e t U D I D s ( D i a l o g T i t l e ) 
 
 	 s e t   U D I D   t o   " " 
 
 	 r e p e a t 
 
 	 	 s e t   U D I D s t r i n g   t o   G e t U D I D s t r i n g ( ) 
 
 	 	 i f   U D I D s t r i n g   i s   " "   t h e n 
 
 	 	 	 s e t   D i a l o g P r o m p t   t o   " E n t e r   a n y   i P o d / i P h o n e / i P a d   U D I D s   ( 4 0   c h a r a c t e r s )   o n e   a t   a   t i m e .   N o t e :   T h i s   o n l y   w o r k s   f o r   o l d e r   v e r s i o n s   o f   K i n d l e   f o r   i O S . " 
 
 	 	 	 s e t   F i n i s h e d B u t t o n   t o   " C l o s e " 
 
 	 	 e l s e 
 
 	 	 	 s e t   D i a l o g P r o m p t   t o   " C u r r e n t   U D I D s :   "   &   U D I D s t r i n g   &   " . 
 
 
 
 E n t e r   a n y   a d d i t i o n a l   i P o d / i P h o n e / i P a d   U D I D s   ( 4 0   c h a r a c t e r s )   o n e   a t   a   t i m e : " 
 
 	 	 	 s e t   F i n i s h e d B u t t o n   t o   " C l o s e " 
 
 	 	 e n d   i f 
 
 	 	 s e t   d i a l o g r e s u l t   t o   ( d i s p l a y   d i a l o g   D i a l o g P r o m p t   d e f a u l t   a n s w e r   U D I D   b u t t o n s   { " D e l e t e   A l l " ,   " A d d " ,   F i n i s h e d B u t t o n }   w i t h   t i t l e   D i a l o g T i t l e   d e f a u l t   b u t t o n   2 ) 
 
 	 	 i f   b u t t o n   r e t u r n e d   o f   d i a l o g r e s u l t   i s   " A d d "   t h e n 
 
 	 	 	 s e t   U D I D   t o   t e x t   r e t u r n e d   o f   d i a l o g r e s u l t 
 
 	 	 	 s e t   U D I D l e n g t h   t o   l e n g t h   o f   U D I D 
 
 	 	 	 i f   U D I D l e n g t h   i s   4 0   t h e n 
 
 	 	 	 	 s e t   s h e l l r e s u l t   t o   " " 
 
 	 	 	 	 s e t   s c r i p t E r r o r   t o   " " 
 
 	 	 	 	 s e t   s h e l l c o m m a n d   t o   p y t h o n   &   ( q u o t e d   f o r m   o f   K i n d l e P I D T o o l )   &   "   "   &   ( q u o t e d   f o r m   o f   U D I D ) 
 
 	 	 	 	 w r i t e t o l o g ( " s h e l l c o m m a n d :   "   &   s h e l l c o m m a n d ) 
 
 	 	 	 	 t r y 
 
 	 	 	 	 	 s e t   s h e l l r e s u l t   t o   d o   s h e l l   s c r i p t   s h e l l c o m m a n d 
 
 	 	 	 	 o n   e r r o r   e r r m s g 
 
 	 	 	 	 	 s e t   s h e l l r e s u l t   t o   " " 
 
 	 	 	 	 	 s e t   s c r i p t E r r o r   t o   " K i n d l e P I D   S c r i p t   f a i l e d : "   &   "   "   &   e r r m s g 
 
 	 	 	 	 e n d   t r y 
 
 	 	 	 	 w r i t e t o l o g ( " s h e l l r e s u l t :   "   &   s c r i p t E r r o r   &   "   "   &   s h e l l r e s u l t ) 
 
 	 	 	 	 - - d i s p l a y   d i a l o g   s h e l l r e s u l t 
 
 	 	 	 	 
 
 	 	 	 	 i f   s h e l l r e s u l t   i s   n o t   " "   t h e n 
 
 	 	 	 	 	 s e t   P I D   t o   ( t e x t   - 1 0   t h r u   - 1   o f   s h e l l r e s u l t ) 
 
 	 	 	 	 	 i f   U D I D s   c o n t a i n s   { { U D I D ,   P I D } }   t h e n 
 
 	 	 	 	 	 	 d i s p l a y   d i a l o g   " U D I D   "   &   U D I D   &   "   i s   a l r e a d y   i n   y o u r   l i s t   o f   U D I D s . "   b u t t o n s   { " O K " }   d e f a u l t   b u t t o n   1   w i t h   t i t l e   " D e D R M "   w i t h   i c o n   c a u t i o n 
 
 	 	 	 	 	 e l s e 
 
 	 	 	 	 	 	 d i s p l a y   d i a l o g   " T h e   e q u i v a l e n t   U D I D   f o r   U D I D   "   &   U D I D   &   "   i s   "   &   P I D   &   " .   A d d i n g   t o   l i s t . "   b u t t o n s   { " O K " }   d e f a u l t   b u t t o n   1   w i t h   t i t l e   " D e D R M "   w i t h   i c o n   n o t e 
 
 	 	 	 	 	 	 s e t   U D I D s   t o   U D I D s   &   { { U D I D ,   P I D } } 
 
 	 	 	 	 	 	 s e t   U D I D   t o   " " 
 
 	 	 	 	 	 e n d   i f 
 
 	 	 	 	 e l s e 
 
 	 	 	 	 	 w r i t e t o l o g ( s c r i p t E r r o r ) 
 
 	 	 	 	 	 d i s p l a y   d i a l o g   " E r r o r   g e n e r a t i n g   P I D   f r o m   t h i s   U D I D ,   e r r o r   m e s s a g e   w a s :   "   &   s c r i p t E r r o r   b u t t o n s   { " O K " }   d e f a u l t   b u t t o n   1   w i t h   t i t l e   " D e D R M "   w i t h   i c o n   c a u t i o n 
 
 	 	 	 	 e n d   i f 
 
 	 	 	 e l s e 
 
 	 	 	 	 d i s p l a y   d i a l o g   " U D I D s   m u s t   b e   4 0   c h a r a c t e r s . "   b u t t o n s   { " O K " }   d e f a u l t   b u t t o n   1   w i t h   t i t l e   " D e D R M "   w i t h   i c o n   c a u t i o n 
 
 	 	 	 e n d   i f 
 
 	 	 e l s e   i f   b u t t o n   r e t u r n e d   o f   d i a l o g r e s u l t   i s   " D e l e t e   A l l "   t h e n 
 
 	 	 	 i f   U D I D s t r i n g   i s   n o t   " "   t h e n 
 
 	 	 	 	 t r y 
 
 	 	 	 	 	 s e t   d i a l o g r e s u l t   t o   ( d i s p l a y   d i a l o g   " A r e   y o u   s u r e   y o u   w a n t   t o   d e l e t e   a l l   s t o r e d   U D I D s ? "   b u t t o n s   { " C a n c e l " ,   " D e l e t e " }   d e f a u l t   b u t t o n   1   w i t h   t i t l e   " D e D R M " ) 
 
 	 	 	 	 e n d   t r y 
 
 	 	 	 	 i f   b u t t o n   r e t u r n e d   o f   d i a l o g r e s u l t   i s   " D e l e t e "   t h e n 
 
 	 	 	 	 	 s e t   U D I D s   t o   { } 
 
 	 	 	 	 e n d   i f 
 
 	 	 	 e n d   i f 
 
 	 	 e l s e 
 
 	 	 	 s e t   U D I D   t o   t e x t   r e t u r n e d   o f   d i a l o g r e s u l t 
 
 	 	 	 i f   U D I D   i s   n o t   " "   t h e n 
 
 	 	 	 	 t r y 
 
 	 	 	 	 	 s e t   d i a l o g r e s u l t   t o   ( d i s p l a y   d i a l o g   " Y o u   e n t e r e d   s o m e   t e x t ,   b u t   d i d n ' t   c l i c k   A d d .   A r e   y o u   s u r e   y o u   w a n t   t o   m o r e   o n   t o   t h e   n e x t   d i a l o g ? "   b u t t o n s   { " W h o o p s " ,   " Y e s ,   M o v e   o n " }   d e f a u l t   b u t t o n   1   w i t h   t i t l e   " D e D R M " ) 
 
 	 	 	 	 e n d   t r y 
 
 	 	 	 	 i f   b u t t o n   r e t u r n e d   o f   d i a l o g r e s u l t   i s   " Y e s ,   M o v e   o n "   t h e n 
 
 	 	 	 	 	 e x i t   r e p e a t 
 
 	 	 	 	 e n d   i f 
 
 	 	 	 e l s e 
 
 	 	 	 	 e x i t   r e p e a t 
 
 	 	 	 e n d   i f 
 
 	 	 e n d   i f 
 
 	 e n d   r e p e a t 
 
 e n d   G e t U D I D s 
 
 
 
 o n   G e t P I D s ( D i a l o g T i t l e ) 
 
 	 s e t   P I D   t o   " " 
 
 	 r e p e a t 
 
 	 	 s e t   P I D s t r i n g   t o   G e t P I D s t r i n g ( ) 
 
 	 	 i f   P I D s t r i n g   i s   " "   t h e n 
 
 	 	 	 s e t   D i a l o g P r o m p t   t o   " E n t e r   a n y   M o b i p o c k e t   P I D s   o n e   a t   a   t i m e : " 
 
 	 	 	 s e t   F i n i s h e d B u t t o n   t o   " C l o s e " 
 
 	 	 e l s e 
 
 	 	 	 s e t   D i a l o g P r o m p t   t o   " C u r r e n t   P I D s :   "   &   P I D s t r i n g   &   " . 
 
 
 
 E n t e r   a n y   a d d i t i o n a l   M o b i p o c k e t   P I D s   o n e   a t   a   t i m e : " 
 
 	 	 	 s e t   F i n i s h e d B u t t o n   t o   " C l o s e " 
 
 	 	 e n d   i f 
 
 	 	 s e t   d i a l o g r e s u l t   t o   ( d i s p l a y   d i a l o g   D i a l o g P r o m p t   d e f a u l t   a n s w e r   P I D   b u t t o n s   { " D e l e t e   A l l " ,   " A d d " ,   F i n i s h e d B u t t o n }   w i t h   t i t l e   D i a l o g T i t l e   d e f a u l t   b u t t o n   2 ) 
 
 	 	 i f   b u t t o n   r e t u r n e d   o f   d i a l o g r e s u l t   i s   " A d d "   t h e n 
 
 	 	 	 s e t   P I D   t o   t e x t   r e t u r n e d   o f   d i a l o g r e s u l t 
 
 	 	 	 s e t   P I D l e n g t h   t o   l e n g t h   o f   P I D 
 
 	 	 	 i f   P I D l e n g t h   i s   8   o r   P I D l e n g t h   i s   1 0   t h e n 
 
 	 	 	 	 i f   P I D s   c o n t a i n s   P I D   t h e n 
 
 	 	 	 	 	 d i s p l a y   d i a l o g   " P I D "   &   P I D   &   "   i s   a l r e a d y   i n   y o u r   l i s t   o f   P I D s . "   b u t t o n s   { " O K " }   d e f a u l t   b u t t o n   1   w i t h   t i t l e   " D e D R M "   w i t h   i c o n   c a u t i o n 
 
 	 	 	 	 e l s e 
 
 	 	 	 	 	 s e t   P I D s   t o   P I D s   &   P I D 
 
 	 	 	 	 	 s e t   P I D   t o   " " 
 
 	 	 	 	 e n d   i f 
 
 	 	 	 e l s e 
 
 	 	 	 	 d i s p l a y   d i a l o g   " P I D s   m u s t   b e   8   o r   1 0   c h a r a c t e r s   l o n g ,   a n d   U D I D s   m u s t   b e   4 0   c h a r a c t e r s . "   b u t t o n s   { " O K " }   d e f a u l t   b u t t o n   1   w i t h   t i t l e   " D e D R M "   w i t h   i c o n   c a u t i o n 
 
 	 	 	 e n d   i f 
 
 	 	 e l s e   i f   b u t t o n   r e t u r n e d   o f   d i a l o g r e s u l t   i s   " D e l e t e   A l l "   t h e n 
 
 	 	 	 i f   P I D s t r i n g   i s   n o t   " "   t h e n 
 
 	 	 	 	 t r y 
 
 	 	 	 	 	 s e t   d i a l o g r e s u l t   t o   ( d i s p l a y   d i a l o g   " A r e   y o u   s u r e   y o u   w a n t   t o   d e l e t e   a l l   s t o r e d   P I D s ? "   b u t t o n s   { " C a n c e l " ,   " D e l e t e " }   d e f a u l t   b u t t o n   1   w i t h   t i t l e   " D e D R M " ) 
 
 	 	 	 	 e n d   t r y 
 
 	 	 	 	 i f   b u t t o n   r e t u r n e d   o f   d i a l o g r e s u l t   i s   " D e l e t e "   t h e n 
 
 	 	 	 	 	 s e t   P I D s   t o   { } 
 
 	 	 	 	 e n d   i f 
 
 	 	 	 e n d   i f 
 
 	 	 e l s e 
 
 	 	 	 s e t   P I D   t o   t e x t   r e t u r n e d   o f   d i a l o g r e s u l t 
 
 	 	 	 i f   P I D   i s   n o t   " "   t h e n 
 
 	 	 	 	 t r y 
 
 	 	 	 	 	 s e t   d i a l o g r e s u l t   t o   ( d i s p l a y   d i a l o g   " Y o u   e n t e r e d   s o m e   t e x t ,   b u t   d i d n ' t   c l i c k   A d d .   A r e   y o u   s u r e   y o u   w a n t   t o   m o r e   o n   t o   t h e   n e x t   d i a l o g ? "   b u t t o n s   { " W h o o p s " ,   " Y e s ,   M o v e   o n " }   d e f a u l t   b u t t o n   1   w i t h   t i t l e   " D e D R M " ) 
 
 	 	 	 	 e n d   t r y 
 
 	 	 	 	 i f   b u t t o n   r e t u r n e d   o f   d i a l o g r e s u l t   i s   " Y e s ,   M o v e   o n "   t h e n 
 
 	 	 	 	 	 e x i t   r e p e a t 
 
 	 	 	 	 e n d   i f 
 
 	 	 	 e l s e 
 
 	 	 	 	 e x i t   r e p e a t 
 
 	 	 	 e n d   i f 
 
 	 	 e n d   i f 
 
 	 e n d   r e p e a t 
 
 e n d   G e t P I D s 
 
 
 
 o n   G e t S e r i a l s ( D i a l o g T i t l e ) 
 
 	 s e t   S e r i a l   t o   " " 
 
 	 r e p e a t 
 
 	 	 s e t   S e r i a l s t r i n g   t o   G e t S e r i a l s t r i n g ( ) 
 
 	 	 i f   S e r i a l s t r i n g   i s   " "   t h e n 
 
 	 	 	 s e t   D i a l o g P r o m p t   t o   " E n t e r   a n y   K i n d l e   ( n o t   K i n d l e   F i r e )   S e r i a l   N u m b e r s   o n e   a t   a   t i m e : " 
 
 	 	 	 s e t   F i n i s h e d B u t t o n   t o   " C l o s e " 
 
 	 	 e l s e 
 
 	 	 	 s e t   D i a l o g P r o m p t   t o   " C u r r e n t   K i n d l e   S e r i a l   N u m b e r s :   "   &   S e r i a l s t r i n g   &   " . 
 
 
 
 E n t e r   a n y   a d d i t i o n a l   K i n d l e   ( n o t   K i n d l e   F i r e )   S e r i a l   N u m b e r s   o n e   a t   a   t i m e : " 
 
 	 	 	 s e t   F i n i s h e d B u t t o n   t o   " C l o s e " 
 
 	 	 e n d   i f 
 
 	 	 s e t   d i a l o g r e s u l t   t o   ( d i s p l a y   d i a l o g   D i a l o g P r o m p t   d e f a u l t   a n s w e r   S e r i a l   b u t t o n s   { " D e l e t e   A l l " ,   " A d d " ,   F i n i s h e d B u t t o n }   w i t h   t i t l e   D i a l o g T i t l e   d e f a u l t   b u t t o n   2 ) 
 
 	 	 i f   b u t t o n   r e t u r n e d   o f   d i a l o g r e s u l t   i s   " A d d "   t h e n 
 
 	 	 	 s e t   S e r i a l   t o   t e x t   r e t u r n e d   o f   d i a l o g r e s u l t 
 
 	 	 	 s e t   S e r i a l l e n g t h   t o   l e n g t h   o f   S e r i a l 
 
 	 	 	 i f   S e r i a l l e n g t h   i s   1 6   t h e n 
 
 	 	 	 	 s e t   K i n d l e S e r i a l L i s t   t o   K i n d l e S e r i a l L i s t   &   S e r i a l 
 
 	 	 	 	 s e t   S e r i a l   t o   " " 
 
 	 	 	 e l s e 
 
 	 	 	 	 d i s p l a y   d i a l o g   " K i n d l e   S e r i a l   N u m b e r s   a r e   1 6   c h a r a c t e r s   l o n g . "   b u t t o n s   { " O K " }   d e f a u l t   b u t t o n   1   w i t h   t i t l e   " D e D R M "   w i t h   i c o n   c a u t i o n 
 
 	 	 	 e n d   i f 
 
 	 	 e l s e   i f   b u t t o n   r e t u r n e d   o f   d i a l o g r e s u l t   i s   " D e l e t e   A l l "   t h e n 
 
 	 	 	 i f   S e r i a l s t r i n g   i s   n o t   " "   t h e n 
 
 	 	 	 	 t r y 
 
 	 	 	 	 	 s e t   d i a l o g r e s u l t   t o   ( d i s p l a y   d i a l o g   " A r e   y o u   s u r e   y o u   w a n t   t o   d e l e t e   a l l   s t o r e d   K i n d l e   S e r i a l   N u m b e r s ? "   b u t t o n s   { " C a n c e l " ,   " D e l e t e " }   d e f a u l t   b u t t o n   1   w i t h   t i t l e   " D e D R M " ) 
 
 	 	 	 	 e n d   t r y 
 
 	 	 	 	 i f   b u t t o n   r e t u r n e d   o f   d i a l o g r e s u l t   i s   " D e l e t e "   t h e n 
 
 	 	 	 	 	 s e t   K i n d l e S e r i a l L i s t   t o   { } 
 
 	 	 	 	 e n d   i f 
 
 	 	 	 e n d   i f 
 
 	 	 e l s e 
 
 	 	 	 s e t   S e r i a l   t o   t e x t   r e t u r n e d   o f   d i a l o g r e s u l t 
 
 	 	 	 i f   S e r i a l   i s   n o t   " "   t h e n 
 
 	 	 	 	 t r y 
 
 	 	 	 	 	 s e t   d i a l o g r e s u l t   t o   ( d i s p l a y   d i a l o g   " Y o u   e n t e r e d   s o m e   t e x t ,   b u t   d i d n ' t   c l i c k   A d d .   A r e   y o u   s u r e   y o u   w a n t   t o   m o r e   o n   t o   t h e   n e x t   d i a l o g ? "   b u t t o n s   { " W h o o p s " ,   " Y e s ,   M o v e   o n " }   d e f a u l t   b u t t o n   1   w i t h   t i t l e   " D e D R M " ) 
 
 	 	 	 	 e n d   t r y 
 
 	 	 	 	 i f   b u t t o n   r e t u r n e d   o f   d i a l o g r e s u l t   i s   " Y e s ,   M o v e   o n "   t h e n 
 
 	 	 	 	 	 e x i t   r e p e a t 
 
 	 	 	 	 e n d   i f 
 
 	 	 	 e l s e 
 
 	 	 	 	 e x i t   r e p e a t 
 
 	 	 	 e n d   i f 
 
 	 	 e n d   i f 
 
 	 e n d   r e p e a t 
 
 e n d   G e t S e r i a l s 
 
 
 
 o n   G e t O u t p u t F o l d e r ( D i a l o g T i t l e ) 
 
 	 s e t   n e w F o l d e r   t o   " " 
 
 	 t r y 
 
 	 	 t e l l   m e   t o   a c t i v a t e 
 
 	 	 r e p e a t 
 
 	 	 	 
 
 	 	 	 i f   f o l d e r e x i s t s ( o u t p u t F o l d e r )   t h e n 
 
 	 	 	 	 s e t   D i a l o g P r o m p t   t o   " T h e   d e D R M e d   e b o o k s   w i l l   b e   s a v e d   t o   t h e   f o l l o w i n g   f o l d e r : 
 
 "   &   ( o u t p u t F o l d e r )   &   " 
 
 
 
 " 
 
 	 	 	 e l s e 
 
 	 	 	 	 s e t   o u t p u t F o l d e r   t o   " " 
 
 	 	 	 	 s e t   D i a l o g P r o m p t   t o   " T h e   d e D R M e d   e b o o k s   w i l l   b e   s a v e d   i n   t h e   s a m e   f o l d e r   a s   t h e   o r i g i n a l   D R M e d   e b o o k s . 
 
 
 
 " 
 
 	 	 	 e n d   i f 
 
 	 	 	 s e t   D i a l o g P r o m p t   t o   D i a l o g P r o m p t   &   " T o   k e e p   t h i s   c h o i c e ,   c l i c k   ' C l o s e ' ,   o t h e r w i s e   s e l e c t   t h e   o p t i o n   y o u   w a n t   b y   c l i c k i n g   o n   o n e   o f   t h e   o t h e r   b u t t o n s . " 
 
 	 	 	 s e t   d i a l o g r e s u l t   t o   ( d i s p l a y   d i a l o g   D i a l o g P r o m p t   b u t t o n s   { " U s e   S a m e   F o l d e r   a s   D R M e d   E b o o k s " ,   " C h o o s e   O u t p u t   F o l d e r & " ,   " C l o s e " }   w i t h   t i t l e   D i a l o g T i t l e   d e f a u l t   b u t t o n   3 ) 
 
 	 	 	 i f   b u t t o n   r e t u r n e d   o f   d i a l o g r e s u l t   i s   " C h o o s e   O u t p u t   F o l d e r & "   t h e n 
 
 	 	 	 	 t r y 
 
 	 	 	 	 	 i f   o u t p u t F o l d e r   i s   " "   t h e n 
 
 	 	 	 	 	 	 s e t   o u t p u t F o l d e r   t o   ( ( c h o o s e   f o l d e r   w i t h   p r o m p t   " D R M   A p p l i c a t i o n 
 
 P l e a s e   c h o o s e   t h e   O u t p u t   F o l d e r   f o r   D e D R M e d   e b o o k s . " )   a s   t e x t ) 
 
 	 	 	 	 	 e l s e 
 
 	 	 	 	 	 	 s e t   o u t p u t F o l d e r   t o   ( ( c h o o s e   f o l d e r   w i t h   p r o m p t   " D R M   A p p l i c a t i o n 
 
 P l e a s e   c h o o s e   t h e   O u t p u t   F o l d e r   f o r   D e D R M e d   e b o o k s . "   d e f a u l t   l o c a t i o n   a l i a s   o u t p u t F o l d e r )   a s   t e x t ) 
 
 	 	 	 	 	 e n d   i f 
 
 	 	 	 	 e n d   t r y 
 
 	 	 	 e l s e   i f   b u t t o n   r e t u r n e d   o f   d i a l o g r e s u l t   i s   " U s e   S a m e   F o l d e r   a s   D R M e d   E b o o k s "   t h e n 
 
 	 	 	 	 s e t   o u t p u t F o l d e r   t o   " " 
 
 	 	 	 e l s e 
 
 	 	 	 	 e x i t   r e p e a t 
 
 	 	 	 e n d   i f 
 
 	 	 	 - - o n   e r r o r   e r r o r m e s s a g e 
 
 	 	 	 - - 	 d i s p l a y   d i a l o g   e r r o r m e s s a g e 
 
 	 	 e n d   r e p e a t 
 
 	 e n d   t r y 
 
 	 W r i t e P r e f s ( ) 
 
 e n d   G e t O u t p u t F o l d e r 
 
 
 
 o n   G e t e R e a d e r K e y s ( D i a l o g T i t l e ) 
 
 	 s e t   k e y T e x t   t o   " " 
 
 	 r e p e a t 
 
 	 	 s e t   K e y s t r i n g   t o   G e t e R e a d e r K e y s t r i n g ( ) 
 
 	 	 i f   K e y s t r i n g   i s   " "   t h e n 
 
 	 	 	 s e t   D i a l o g P r o m p t   t o   " P l e a s e   e n t e r   a n y   " 
 
 	 	 	 s e t   F i n i s h e d B u t t o n   t o   " C l o s e " 
 
 	 	 e l s e 
 
 	 	 	 s e t   D i a l o g P r o m p t   t o   " e R e a d e r   k e y s : 
 
 "   &   K e y s t r i n g   &   " 
 
 
 
 
 
 P l e a s e   e n t e r   a n y   a d d i t i o n a l   " 
 
 	 	 	 s e t   F i n i s h e d B u t t o n   t o   " C l o s e " 
 
 	 	 e n d   i f 
 
 	 	 s e t   D i a l o g P r o m p t   t o   D i a l o g P r o m p t   &   " e R e a d e r   N a m e , N u m b e r   k e y   p a i r s   o n e   a t   a   t i m e .   T h e   n a m e   i s   u s u a l l y   y o u r   n a m e   a s   o n   y o u r   c r e d i t   c a r d ,   b u t   m i g h t   b e   y o u r   u s e r   n a m e .   O n l y   t h e   l a s t   8   d i g i t s   o f   t h e   N u m b e r   a r e   n e e d e d .   I f   y o u   e n t e r   m o r e   d i g i t s ,   o n l y   t h e   l a s t   e i g h t   w i l l   b e   s t o r e d   o r   d i s p l a y e d .   P l e a s e   s e p a r a t e   t h e   n a m e   a n d   n u m b e r   w i t h   a   c o l o n   ( : )   a n d   c l i c k   \ " A d d \ " . " 
 
 	 	 s e t   d i a l o g r e s u l t   t o   ( d i s p l a y   d i a l o g   D i a l o g P r o m p t   d e f a u l t   a n s w e r   k e y T e x t   w i t h   t i t l e   D i a l o g T i t l e   b u t t o n s   { " D e l e t e   A l l " ,   " A d d " ,   F i n i s h e d B u t t o n }   d e f a u l t   b u t t o n   2 ) 
 
 	 	 i f   b u t t o n   r e t u r n e d   o f   d i a l o g r e s u l t   i s   " A d d "   t h e n 
 
 	 	 	 s e t   k e y T e x t   t o   t e x t   r e t u r n e d   o f   d i a l o g r e s u l t 
 
 	 	 	 i f   n o t   ( k e y T e x t   c o n t a i n s   " : " )   t h e n 
 
 	 	 	 	 d i s p l a y   d i a l o g   " N a m e   a n d   N u m b e r   m u s t   b e   s e p a r a t e d   b y   a   c o l o n   ( : ) . "   b u t t o n s   { " O K " }   d e f a u l t   b u t t o n   1   w i t h   t i t l e   " D e D R M "   w i t h   i c o n   c a u t i o n 
 
 	 	 	 e l s e 
 
 	 	 	 	 s e t   o l d T I D s   t o   A p p l e S c r i p t ' s   t e x t   i t e m   d e l i m i t e r s 
 
 	 	 	 	 s e t   A p p l e S c r i p t ' s   t e x t   i t e m   d e l i m i t e r s   t o   " : " 
 
 	 	 	 	 s e t   k e y N u m b e r   t o   t h e   l a s t   t e x t   i t e m   o f   k e y T e x t 
 
 	 	 	 	 s e t   k e y N a m e   t o   ( t e x t   i t e m s   1   t h r o u g h   - 2   o f   k e y T e x t )   a s   s t r i n g 
 
 	 	 	 	 s e t   A p p l e S c r i p t ' s   t e x t   i t e m   d e l i m i t e r s   t o   o l d T I D s 
 
 	 	 	 	 
 
 	 	 	 	 i f   ( ( l e n g t h   o f   k e y N u m b e r )   =   1 6   o r   ( l e n g t h   o f   k e y N u m b e r )   =   1 5   o r   ( l e n g t h   o f   k e y N u m b e r )   =   8 )   a n d   ( l e n g t h   o f   k e y N a m e )   >   0   t h e n 
 
 	 	 	 	 	 s e t   b n K e y s   t o   b n K e y s   &   { { k e y N a m e ,   ( t e x t   - 8   t h r u   - 1   o f   k e y N u m b e r ) ,   " " } } 
 
 	 	 	 	 	 s e t   k e y T e x t   t o   " " 
 
 	 	 	 	 e l s e 
 
 	 	 	 	 	 d i s p l a y   d i a l o g   " K e y   n u m b e r s   m u s t   b e   8   o r   1 5   o r   1 6   c h a r a c t e r s   l o n g   ( n o   s p a c e s )   a n d   t h e   k e y   n a m e   m u s t   n o t   b e   a b s e n t . "   b u t t o n s   { " O K " }   d e f a u l t   b u t t o n   1   w i t h   t i t l e   " D e D R M "   w i t h   i c o n   c a u t i o n 
 
 	 	 	 	 e n d   i f 
 
 	 	 	 e n d   i f 
 
 	 	 e l s e   i f   b u t t o n   r e t u r n e d   o f   d i a l o g r e s u l t   i s   " D e l e t e   A l l "   t h e n 
 
 	 	 	 i f   K e y s t r i n g   i s   n o t   " "   t h e n 
 
 	 	 	 	 t r y 
 
 	 	 	 	 	 s e t   d i a l o g r e s u l t   t o   ( d i s p l a y   d i a l o g   " A r e   y o u   s u r e   y o u   w a n t   t o   d e l e t e   a l l   s t o r e d   N a m e : N u m b e r   k e y   p a i r s ? "   b u t t o n s   { " C a n c e l " ,   " D e l e t e " }   d e f a u l t   b u t t o n   1   w i t h   t i t l e   " D e D R M " ) 
 
 	 	 	 	 e n d   t r y 
 
 	 	 	 	 i f   b u t t o n   r e t u r n e d   o f   d i a l o g r e s u l t   i s   " D e l e t e "   t h e n 
 
 	 	 	 	 	 D e l e t e e R e a d e r K e y s ( ) 
 
 	 	 	 	 	 G e t N o o k K e y ( ) 
 
 	 	 	 	 e n d   i f 
 
 	 	 	 e n d   i f 
 
 	 	 	 s e t   k e y T e x t   t o   " " 
 
 	 	 e l s e 
 
 	 	 	 s e t   k e y T e x t   t o   t e x t   r e t u r n e d   o f   d i a l o g r e s u l t 
 
 	 	 	 i f   k e y T e x t   i s   n o t   " "   t h e n 
 
 	 	 	 	 t r y 
 
 	 	 	 	 	 s e t   d i a l o g r e s u l t   t o   ( d i s p l a y   d i a l o g   " Y o u   e n t e r e d   s o m e   t e x t ,   b u t   d i d n ' t   c l i c k   A d d .   A r e   y o u   s u r e   y o u   w a n t   t o   m o r e   o n   t o   t h e   n e x t   d i a l o g ? "   b u t t o n s   { " W h o o p s " ,   " Y e s ,   M o v e   o n " }   d e f a u l t   b u t t o n   1   w i t h   t i t l e   " D e D R M " ) 
 
 	 	 	 	 e n d   t r y 
 
 	 	 	 	 i f   b u t t o n   r e t u r n e d   o f   d i a l o g r e s u l t   i s   " Y e s ,   M o v e   o n "   t h e n 
 
 	 	 	 	 	 e x i t   r e p e a t 
 
 	 	 	 	 e n d   i f 
 
 	 	 	 e l s e 
 
 	 	 	 	 e x i t   r e p e a t 
 
 	 	 	 e n d   i f 
 
 	 	 e n d   i f 
 
 	 e n d   r e p e a t 
 
 e n d   G e t e R e a d e r K e y s 
 
 
 
 o n   G e t B N K e y s ( D i a l o g T i t l e ) 
 
 	 s e t   b n K e y T e x t   t o   " " 
 
 	 r e p e a t 
 
 	 	 s e t   B N K e y s t r i n g   t o   G e t B N K e y s t r i n g ( ) 
 
 	 	 i f   B N K e y s t r i n g   i s   " "   t h e n 
 
 	 	 	 s e t   D i a l o g P r o m p t   t o   " P l e a s e   e n t e r   a n y   " 
 
 	 	 	 s e t   F i n i s h e d B u t t o n   t o   " C l o s e " 
 
 	 	 e l s e 
 
 	 	 	 s e t   D i a l o g P r o m p t   t o   " C u r r e n t   B & N / N o o k   k e y s : 
 
 "   &   B N K e y s t r i n g   &   " 
 
 
 
 
 
 P l e a s e   e n t e r   a n y   a d d i t i o n a l   " 
 
 	 	 	 s e t   F i n i s h e d B u t t o n   t o   " C l o s e " 
 
 	 	 e n d   i f 
 
 	 	 s e t   D i a l o g P r o m p t   t o   D i a l o g P r o m p t   &   " B a r n e s   &   N o b l e / N o o k   a c c o u n t   e m a i l   a d d r e s s e s   a n d   p a s s w o r d s   o n e   a t   a   t i m e .     P l e a s e   s e p a r a t e   t h e   a d d r e s s   a n d   p a s s w o r d   w i t h   a   c o l o n   ( : ) a n d   c l i c k   \ " A d d \ " .     N o t e   t h a t   y o u r   a c c o u n t   p a s s w o r d   w i l l   o n l y   b e   u s e d   t o   r e t r i e v e   t h e   k e y   a n d   w i l l   n o t   b e   s t o r e d . 
 
 	 	 
 
 * * *   R e t r i e v i n g   t h e   a c c o u n t   k e y   m a y   t a k e   a   c o u p l e   o f   m i n u t e s ,   p l e a s e   b e   p a t i e n t .   * * * 
 
 
 
 O r   t o   a d d   a   a n   a l r e a d y   g e n e r a t e d   . b 6 4   f i l e ,   j u s t   c l i c k   \ " A d d \ "   w i t h   n o t h i n g   i n   t h e   t e x t   f i e l d . " 
 
 	 	 s e t   d i a l o g r e s u l t   t o   ( d i s p l a y   d i a l o g   D i a l o g P r o m p t   d e f a u l t   a n s w e r   b n K e y T e x t   w i t h   t i t l e   D i a l o g T i t l e   b u t t o n s   { " F o r g e t   A l l " ,   " A d d " ,   F i n i s h e d B u t t o n }   d e f a u l t   b u t t o n   2 ) 
 
 	 	 i f   b u t t o n   r e t u r n e d   o f   d i a l o g r e s u l t   i s   " A d d "   t h e n 
 
 	 	 	 s e t   b n K e y T e x t   t o   t e x t   r e t u r n e d   o f   d i a l o g r e s u l t 
 
 	 	 	 i f   b n K e y T e x t   i s   " "   t h e n 
 
 	 	 	 	 t r y 
 
 	 	 	 	 	 s e t   n e w F i l e   t o   ( c h o o s e   f i l e   w i t h   p r o m p t   " P l e a s e   s e l e c t   a   B a r n e s   &   N o b l e   ( . b 6 4 )   k e y   f i l e " )   a s   t e x t 
 
 	 	 	 	 	 - -   c o p y   t o   p r e f s 
 
 	 	 	 	 	 A d d b n K e y ( n e w F i l e ) 
 
 	 	 	 	 o n   e r r o r   m e s s a g e 
 
 	 	 	 	 	 i f   m e s s a g e   d o e s   n o t   c o n t a i n   " c a n c e l "   t h e n 
 
 	 	 	 	 	 	 d i s p l a y   d i a l o g   m e s s a g e 
 
 	 	 	 	 	 e n d   i f 
 
 	 	 	 	 e n d   t r y 
 
 	 	 	 e l s e   i f   n o t   ( b n K e y T e x t   c o n t a i n s   " : " )   t h e n 
 
 	 	 	 	 d i s p l a y   d i a l o g   " E m a i l   a d d r e s s   a n d   p a s s w o r d   m u s t   b e   s e p a r a t e d   b y   a   c o l o n   ( : ) . "   b u t t o n s   { " O K " }   d e f a u l t   b u t t o n   1   w i t h   t i t l e   " D e D R M "   w i t h   i c o n   c a u t i o n 
 
 	 	 	 e l s e 
 
 	 	 	 	 s e t   o l d T I D s   t o   A p p l e S c r i p t ' s   t e x t   i t e m   d e l i m i t e r s 
 
 	 	 	 	 s e t   A p p l e S c r i p t ' s   t e x t   i t e m   d e l i m i t e r s   t o   " : " 
 
 	 	 	 	 s e t   k e y E m a i l   t o   t h e   f i r s t   t e x t   i t e m   o f   b n K e y T e x t 
 
 	 	 	 	 s e t   k e y P a s s w o r d   t o   ( t e x t   i t e m s   2   t h r o u g h   - 1   o f   b n K e y T e x t )   a s   s t r i n g 
 
 	 	 	 	 s e t   A p p l e S c r i p t ' s   t e x t   i t e m   d e l i m i t e r s   t o   o l d T I D s 
 
 	 	 	 	 
 
 	 	 	 	 i f   ( k e y E m a i l   c o n t a i n s   " @ " )   a n d   ( l e n g t h   o f   k e y P a s s w o r d )   >   0   t h e n 
 
 	 	 	 	 	 - -   g e t   t h e   B & N   k e y   f r o m   t h i s   p a i r 
 
 	 	 	 	 	 s e t   s h e l l r e s u l t   t o   " " 
 
 	 	 	 	 	 s e t   s c r i p t E r r o r   t o   " " 
 
 	 	 	 	 	 s e t   s u c c e s s   t o   t r u e 
 
 	 s e t   u s e r P r e f s P a t h   t o   p a t h   t o   p r e f e r e n c e s   f r o m   u s e r   d o m a i n   a s   s t r i n g 
 
 	 s e t   p r e f e r e n c e s F o l d e r P a t h   t o   u s e r P r e f s P a t h   &   p r e f s F o l d e r N a m e   &   " : " 
 
 	 i f   n o t   f o l d e r e x i s t s ( p r e f e r e n c e s F o l d e r P a t h )   t h e n 
 
 	 	 t e l l   a p p l i c a t i o n   " F i n d e r " 
 
 	 	 	 s e t   p r e f e r e n c e s F o l d e r   t o   m a k e   n e w   f o l d e r   a t   u s e r P r e f s P a t h   w i t h   p r o p e r t i e s   { n a m e : p r e f s F o l d e r N a m e } 
 
 	 	 e n d   t e l l 
 
 	 e n d   i f 
 
 	 	 	 	 	 s e t   k e y f i l e N a m e   t o   G e t U n i q u e N a m e ( p r e f e r e n c e s F o l d e r P a t h ,   k e y E m a i l   &   " . b 6 4 " ) 
 
 	 	 	 	 	 s e t   k e y f i l e p a t h   t o   P O S I X   p a t h   o f   ( p r e f e r e n c e s F o l d e r P a t h   &   k e y f i l e N a m e ) 
 
 	 	 	 	 	 s e t   s h e l l c o m m a n d   t o   p y t h o n   &   ( q u o t e d   f o r m   o f   B N K e y F e t c h T o o l )   &   "   "   &   ( q u o t e d   f o r m   o f   k e y E m a i l )   &   "   "   &   ( q u o t e d   f o r m   o f   k e y P a s s w o r d )   &   "   "   &   q u o t e d   f o r m   o f   k e y f i l e p a t h 
 
 	 	 	 	 	 s e t   s h e l l c o m m a n d   t o   s h e l l c o m m a n d   &   "   >   "   &   q u o t e d t e m p p a t h ( ) 
 
 	 	 	 	 	 
 
 	 	 	 	 	 w r i t e t o l o g ( " s h e l l c o m m a n d :   "   &   s h e l l c o m m a n d ) 
 
 	 	 	 	 	 c l e a r t e m p ( ) 
 
 	 	 	 	 	 t r y 
 
 	 	 	 	 	 	 d o   s h e l l   s c r i p t   s h e l l c o m m a n d 
 
 	 	 	 	 	 o n   e r r o r   s c r i p t E r r o r 
 
 	 	 	 	 	 	 s e t   s u c c e s s   t o   f a l s e 
 
 	 	 	 	 	 e n d   t r y 
 
 	 	 	 	 	 s e t   s h e l l r e s u l t   t o   r e a d t e m p ( ) 
 
 	 	 	 	 	 w r i t e t o l o g ( " s h e l l r e s u l t :   "   &   s c r i p t E r r o r   &   "   "   &   s h e l l r e s u l t ) 
 
 	 	 	 	 	 - - d i s p l a y   d i a l o g   s h e l l r e s u l t 
 
 	 	 	 	 	 i f   s u c c e s s   t h e n 
 
 	 	 	 	 	 	 s e t   b n K e y s   t o   b n K e y s   &   { { k e y E m a i l ,   " " ,   k e y f i l e p a t h } } 
 
 	 	 	 	 	 	 s e t   b n K e y T e x t   t o   " " 
 
 	 	 	 	 	 e l s e 
 
 	 	 	 	 	 	 d i s p l a y   d i a l o g   " E r r o r   g e n e r a t i n g   k e y   f r o m   t h i s   i n f o ,   e r r o r   m e s s a g e   w a s :   "   &   s c r i p t E r r o r   b u t t o n s   { " O K " }   d e f a u l t   b u t t o n   1   w i t h   t i t l e   " D e D R M "   w i t h   i c o n   c a u t i o n 
 
 	 	 	 	 	 e n d   i f 
 
 	 	 	 	 e l s e 
 
 	 	 	 	 	 d i s p l a y   d i a l o g   " K e y   n u m b e r s   m u s t   b e   8   o r   1 5   o r   1 6   c h a r a c t e r s   l o n g   ( n o   s p a c e s )   a n d   t h e   k e y   n a m e   m u s t   n o t   b e   a b s e n t . "   b u t t o n s   { " O K " }   d e f a u l t   b u t t o n   1   w i t h   t i t l e   " D e D R M "   w i t h   i c o n   c a u t i o n 
 
 	 	 	 	 e n d   i f 
 
 	 	 	 e n d   i f 
 
 	 	 e l s e   i f   b u t t o n   r e t u r n e d   o f   d i a l o g r e s u l t   i s   " F o r g e t   A l l "   t h e n 
 
 	 	 	 i f   B N K e y s t r i n g   i s   n o t   " "   t h e n 
 
 	 	 	 	 t r y 
 
 	 	 	 	 	 s e t   d i a l o g r e s u l t   t o   ( d i s p l a y   d i a l o g   " A r e   y o u   s u r e   y o u   w a n t   t o   f o r g e t   a l l   s t o r e d   B a r n e s   &   N o b l e / N o o k   k e y s ? "   b u t t o n s   { " C a n c e l " ,   " F o r g e t " }   d e f a u l t   b u t t o n   1   w i t h   t i t l e   " D e D R M " ) 
 
 	 	 	 	 e n d   t r y 
 
 	 	 	 	 i f   b u t t o n   r e t u r n e d   o f   d i a l o g r e s u l t   i s   " F o r g e t "   t h e n 
 
 	 	 	 	 	 D e l e t e B N K e y s ( ) 
 
 	 	 	 	 e n d   i f 
 
 	 	 	 e n d   i f 
 
 	 	 	 s e t   b n K e y T e x t   t o   " " 
 
 	 	 e l s e 
 
 	 	 	 s e t   b n K e y T e x t   t o   t e x t   r e t u r n e d   o f   d i a l o g r e s u l t 
 
 	 	 	 i f   b n K e y T e x t   i s   n o t   " "   t h e n 
 
 	 	 	 	 t r y 
 
 	 	 	 	 	 s e t   d i a l o g r e s u l t   t o   ( d i s p l a y   d i a l o g   " Y o u   e n t e r e d   s o m e   t e x t ,   b u t   d i d n ' t   c l i c k   A d d .   A r e   y o u   s u r e   y o u   w a n t   t o   m o r e   o n   t o   t h e   n e x t   d i a l o g ? "   b u t t o n s   { " W h o o p s " ,   " Y e s ,   M o v e   o n " }   d e f a u l t   b u t t o n   1   w i t h   t i t l e   " D e D R M " ) 
 
 	 	 	 	 e n d   t r y 
 
 	 	 	 	 i f   b u t t o n   r e t u r n e d   o f   d i a l o g r e s u l t   i s   " Y e s ,   M o v e   o n "   t h e n 
 
 	 	 	 	 	 e x i t   r e p e a t 
 
 	 	 	 	 e n d   i f 
 
 	 	 	 e l s e 
 
 	 	 	 	 e x i t   r e p e a t 
 
 	 	 	 e n d   i f 
 
 	 	 e n d   i f 
 
 	 e n d   r e p e a t 
 
 e n d   G e t B N K e y s 
 
 
 
 o n   G e t A d e p t K e y F i l e s ( D i a l o g T i t l e ) 
 
 	 r e p e a t 
 
 	 	 s e t   A d e p t s t r i n g   t o   G e t A d e p t s t r i n g ( ) 
 
 	 	 i f   A d e p t s t r i n g   i s   " "   t h e n 
 
 	 	 	 s e t   D i a l o g P r o m p t   t o   " T o   a d d   A d o b e   D i g i t a l   E d i t i o n s   ( A d e p t )   k e y   f i l e s ,   c l i c k   t h e   A d d &   b u t t o n .   " 
 
 	 	 	 s e t   d i a l o g r e s u l t   t o   ( d i s p l a y   d i a l o g   D i a l o g P r o m p t   b u t t o n s   { " A d d & " ,   " C l o s e " }   w i t h   t i t l e   D i a l o g T i t l e   d e f a u l t   b u t t o n   1 ) 
 
 	 	 e l s e 
 
 	 	 	 s e t   D i a l o g P r o m p t   t o   " C u r r e n t   A d o b e   D i g i t a l   E d i t i o n s   ( A d e p t )   k e y   f i l e s : 
 
 "   &   A d e p t s t r i n g   &   " 
 
 
 
 T o   a d d   e x t r a   k e y   f i l e s   ( . d e r ) ,   c l i c k   t h e   A d d &   b u t t o n . " 
 
 	 	 	 s e t   d i a l o g r e s u l t   t o   ( d i s p l a y   d i a l o g   D i a l o g P r o m p t   b u t t o n s   { " F o r g e t   A l l " ,   " A d d & " ,   " C l o s e " }   w i t h   t i t l e   D i a l o g T i t l e   d e f a u l t   b u t t o n   2 ) 
 
 	 	 e n d   i f 
 
 	 	 i f   b u t t o n   r e t u r n e d   o f   d i a l o g r e s u l t   i s   " A d d & "   t h e n 
 
 	 	 	 t r y 
 
 	 	 	 	 s e t   n e w F i l e   t o   ( c h o o s e   f i l e   w i t h   p r o m p t   " P l e a s e   s e l e c t   a n   A d o b e   D i g i t a l   E d i t i o n s   ( . d e r )   k e y   f i l e " )   a s   t e x t 
 
 	 	 	 	 - -   c o p y   t o   p r e f s 
 
 	 	 	 	 A d d A d e p t K e y ( n e w F i l e ) 
 
 	 	 	 o n   e r r o r   m e s s a g e 
 
 	 	 	 	 i f   m e s s a g e   d o e s   n o t   c o n t a i n   " c a n c e l "   t h e n 
 
 	 	 	 	 	 d i s p l a y   d i a l o g   m e s s a g e 
 
 	 	 	 	 e n d   i f 
 
 	 	 	 e n d   t r y 
 
 	 	 	 
 
 	 	 e l s e   i f   b u t t o n   r e t u r n e d   o f   d i a l o g r e s u l t   i s   " F o r g e t   A l l "   t h e n 
 
 	 	 	 t r y 
 
 	 	 	 	 s e t   d i a l o g r e s u l t   t o   ( d i s p l a y   d i a l o g   " A r e   y o u   s u r e   y o u   w a n t   t o   f o r g e t   a l l   e x t r a   A d o b e   D i g i t a l   E d i t i o n s   A d e p t   k e y   f i l e s ? "   b u t t o n s   { " C a n c e l " ,   " F o r g e t " }   d e f a u l t   b u t t o n   1   w i t h   t i t l e   " D e D R M " ) 
 
 	 	 	 e n d   t r y 
 
 	 	 	 i f   b u t t o n   r e t u r n e d   o f   d i a l o g r e s u l t   i s   " F o r g e t "   t h e n 
 
 	 	 	 	 s e t   A d e p t K e y L i s t   t o   { } 
 
 	 	 	 e n d   i f 
 
 	 	 e l s e 
 
 	 	 	 e x i t   r e p e a t 
 
 	 	 e n d   i f 
 
 	 e n d   r e p e a t 
 
 e n d   G e t A d e p t K e y F i l e s 
 
 
 
 o n   G e t K i n d l e K e y F i l e s ( D i a l o g T i t l e ) 
 
 	 r e p e a t 
 
 	 	 s e t   K i n d l e s t r i n g   t o   G e t K i n d l e s t r i n g ( ) 
 
 	 	 i f   K i n d l e s t r i n g   i s   " "   t h e n 
 
 	 	 	 s e t   D i a l o g P r o m p t   t o   " T o   a d d   K i n d l e   f o r   M a c   k e y   f i l e s   ( . k 4 i ) ,   c l i c k   t h e   A d d &   b u t t o n .   " 
 
 	 	 	 s e t   F i n i s h e d B u t t o n   t o   " C l o s e " 
 
 	 	 e l s e 
 
 	 	 	 s e t   D i a l o g P r o m p t   t o   " C u r r e n t   K i n d l e   f o r   M a c   k e y   f i l e s : 
 
 "   &   K i n d l e s t r i n g   &   " 
 
 
 
 T o   a d d   e x t r a   k e y   f i l e s   ( . k 4 i ) ,   c l i c k   t h e   A d d &   b u t t o n . " 
 
 	 	 	 s e t   F i n i s h e d B u t t o n   t o   " C l o s e " 
 
 	 	 e n d   i f 
 
 	 	 s e t   d i a l o g r e s u l t   t o   ( d i s p l a y   d i a l o g   D i a l o g P r o m p t   b u t t o n s   { " F o r g e t   A l l " ,   " A d d & " ,   F i n i s h e d B u t t o n }   w i t h   t i t l e   D i a l o g T i t l e   d e f a u l t   b u t t o n   2 ) 
 
 	 	 i f   b u t t o n   r e t u r n e d   o f   d i a l o g r e s u l t   i s   " A d d & "   t h e n 
 
 	 	 	 t r y 
 
 	 	 	 	 s e t   n e w F i l e   t o   ( c h o o s e   f i l e   w i t h   p r o m p t   " P l e a s e   s e l e c t   a   K i n d l e   f o r   M a c / P C   ( . k 4 i )   k e y   f i l e " )   a s   t e x t 
 
 	 	 	 	 - -   c o p y   t o   p r e f s 
 
 	 	 	 	 A d d K i n d l e K e y ( n e w F i l e ) 
 
 	 	 	 o n   e r r o r   m e s s a g e 
 
 	 	 	 	 i f   m e s s a g e   d o e s   n o t   c o n t a i n   " c a n c e l "   t h e n 
 
 	 	 	 	 	 d i s p l a y   d i a l o g   m e s s a g e 
 
 	 	 	 	 e n d   i f 
 
 	 	 	 e n d   t r y 
 
 	 	 	 
 
 	 	 e l s e   i f   b u t t o n   r e t u r n e d   o f   d i a l o g r e s u l t   i s   " F o r g e t   A l l "   t h e n 
 
 	 	 	 i f   K i n d l e s t r i n g   i s   n o t   " "   t h e n 
 
 	 	 	 	 t r y 
 
 	 	 	 	 	 s e t   d i a l o g r e s u l t   t o   ( d i s p l a y   d i a l o g   " A r e   y o u   s u r e   y o u   w a n t   t o   f o r g e t   a l l   e x t r a   K i n d l e   f o r   M a c   k e y   f i l e s ? "   b u t t o n s   { " C a n c e l " ,   " F o r g e t " }   d e f a u l t   b u t t o n   1   w i t h   t i t l e   " D e D R M " ) 
 
 	 	 	 	 e n d   t r y 
 
 	 	 	 	 i f   b u t t o n   r e t u r n e d   o f   d i a l o g r e s u l t   i s   " F o r g e t "   t h e n 
 
 	 	 	 	 	 s e t   K i n d l e K e y L i s t   t o   { } 
 
 	 	 	 	 e n d   i f 
 
 	 	 	 e n d   i f 
 
 	 	 e l s e 
 
 	 	 	 e x i t   r e p e a t 
 
 	 	 e n d   i f 
 
 	 e n d   r e p e a t 
 
 e n d   G e t K i n d l e K e y F i l e s 
 
 
 
 o n   G e t A n d r o i d K e y F i l e s ( D i a l o g T i t l e ) 
 
 	 r e p e a t 
 
 	 	 s e t   A n d r o i d s t r i n g   t o   G e t A n d r o i d s t r i n g ( ) 
 
 	 	 i f   A n d r o i d s t r i n g   i s   " "   t h e n 
 
 	 	 	 s e t   D i a l o g P r o m p t   t o   " T o   a d d   K i n d l e   f o r   A n d r o i d   b a c k u p   f i l e s   ( . a b ) ,   c l i c k   t h e   A d d &   b u t t o n .   " 
 
 	 	 	 s e t   F i n i s h e d B u t t o n   t o   " C l o s e " 
 
 	 	 e l s e 
 
 	 	 	 s e t   D i a l o g P r o m p t   t o   " C u r r e n t   K i n d l e   f o r   A n d r o i d   b a c k u p   f i l e s : 
 
 "   &   A n d r o i d s t r i n g   &   " 
 
 
 
 T o   a d d   e x t r a   b a c k u p   f i l e s   ( . a b ) ,   c l i c k   t h e   A d d &   b u t t o n . " 
 
 	 	 	 s e t   F i n i s h e d B u t t o n   t o   " C l o s e " 
 
 	 	 e n d   i f 
 
 	 	 s e t   d i a l o g r e s u l t   t o   ( d i s p l a y   d i a l o g   D i a l o g P r o m p t   b u t t o n s   { " F o r g e t   A l l " ,   " A d d & " ,   F i n i s h e d B u t t o n }   w i t h   t i t l e   D i a l o g T i t l e   d e f a u l t   b u t t o n   2 ) 
 
 	 	 i f   b u t t o n   r e t u r n e d   o f   d i a l o g r e s u l t   i s   " A d d & "   t h e n 
 
 	 	 	 t r y 
 
 	 	 	 	 s e t   n e w F i l e   t o   ( c h o o s e   f i l e   w i t h   p r o m p t   " P l e a s e   s e l e c t   a   K i n d l e   f o r   A n d r o i d   b a c k u p   ( . a b )   f i l e " )   a s   t e x t 
 
 	 	 	 	 - -   c o p y   t o   p r e f s 
 
 	 	 	 	 A d d A n d r o i d K e y ( n e w F i l e ) 
 
 	 	 	 o n   e r r o r   m e s s a g e 
 
 	 	 	 	 i f   m e s s a g e   d o e s   n o t   c o n t a i n   " c a n c e l "   t h e n 
 
 	 	 	 	 	 d i s p l a y   d i a l o g   m e s s a g e 
 
 	 	 	 	 e n d   i f 
 
 	 	 	 e n d   t r y 
 
 	 	 	 
 
 	 	 e l s e   i f   b u t t o n   r e t u r n e d   o f   d i a l o g r e s u l t   i s   " F o r g e t   A l l "   t h e n 
 
 	 	 	 i f   A n d r o i d s t r i n g   i s   n o t   " "   t h e n 
 
 	 	 	 	 t r y 
 
 	 	 	 	 	 s e t   d i a l o g r e s u l t   t o   ( d i s p l a y   d i a l o g   " A r e   y o u   s u r e   y o u   w a n t   t o   f o r g e t   a l l   K i n d l e   f o r   A n d r o i d   b a c k u p   f i l e s ? "   b u t t o n s   { " C a n c e l " ,   " F o r g e t " }   d e f a u l t   b u t t o n   1   w i t h   t i t l e   " D e D R M " ) 
 
 	 	 	 	 e n d   t r y 
 
 	 	 	 	 i f   b u t t o n   r e t u r n e d   o f   d i a l o g r e s u l t   i s   " F o r g e t "   t h e n 
 
 	 	 	 	 	 s e t   A n d r o i d K e y L i s t   t o   { } 
 
 	 	 	 	 e n d   i f 
 
 	 	 	 e n d   i f 
 
 	 	 e l s e 
 
 	 	 	 e x i t   r e p e a t 
 
 	 	 e n d   i f 
 
 	 e n d   r e p e a t 
 
 e n d   G e t A n d r o i d K e y F i l e s 
 
 
 
 
 
 o n   G e t A d e p t K e y s ( ) 
 
 	 s e t   n e w K e y L i s t   t o   { } 
 
 	 s e t   u s e r P r e f s P a t h   t o   p a t h   t o   p r e f e r e n c e s   f r o m   u s e r   d o m a i n   a s   s t r i n g 
 
 	 s e t   p r e f e r e n c e s F o l d e r P a t h   t o   u s e r P r e f s P a t h   &   p r e f s F o l d e r N a m e   &   " : " 
 
 	 i f   n o t   f o l d e r e x i s t s ( p r e f e r e n c e s F o l d e r P a t h )   t h e n 
 
 	 	 t e l l   a p p l i c a t i o n   " F i n d e r " 
 
 	 	 	 s e t   p r e f e r e n c e s F o l d e r   t o   m a k e   n e w   f o l d e r   a t   u s e r P r e f s P a t h   w i t h   p r o p e r t i e s   { n a m e : p r e f s F o l d e r N a m e } 
 
 	 	 e n d   t e l l 
 
 	 e n d   i f 
 
 	 s e t   n e w K e y s F o l d e r P a t h   t o   p r e f e r e n c e s F o l d e r P a t h   &   n e w K e y s F o l d e r N a m e   &   " : " 
 
 	 i f   n o t   f o l d e r e x i s t s ( n e w K e y s F o l d e r P a t h )   t h e n 
 
 	 	 t e l l   a p p l i c a t i o n   " F i n d e r " 
 
 	 	 	 s e t   n e w K e y s F o l d e r   t o   m a k e   n e w   f o l d e r   a t   p r e f e r e n c e s F o l d e r P a t h   w i t h   p r o p e r t i e s   { n a m e : n e w K e y s F o l d e r N a m e } 
 
 	 	 e n d   t e l l 
 
 	 e n d   i f 
 
 	 s e t   s c r i p t E r r o r   t o   " " 
 
 	 s e t   s h e l l r e s u l t   t o   " " 
 
 	 s e t   s u c c e s s   t o   t r u e 
 
 	 s e t   s h e l l c o m m a n d   t o   p y t h o n   &   ( q u o t e d   f o r m   o f   A d o b e K e y G e n T o o l )   &   "   "   &   q u o t e d   f o r m   o f   ( P O S I X   p a t h   o f   ( n e w K e y s F o l d e r P a t h ) ) 
 
 	 s e t   s h e l l c o m m a n d   t o   s h e l l c o m m a n d   &   "   >   "   &   q u o t e d t e m p p a t h ( ) 
 
 	 w r i t e t o l o g ( " s h e l l c o m m a n d :   "   &   s h e l l c o m m a n d ) 
 
 	 c l e a r t e m p ( ) 
 
 	 t r y 
 
 	 	 d o   s h e l l   s c r i p t   s h e l l c o m m a n d 
 
 	 o n   e r r o r   s c r i p t E r r o r 
 
 	 	 s e t   s u c c e s s   t o   f a l s e 
 
 	 e n d   t r y 
 
 	 s e t   s h e l l r e s u l t   t o   r e a d t e m p ( ) 
 
 	 w r i t e t o l o g ( " s h e l l r e s u l t :   "   &   s h e l l r e s u l t   &   "   "   &   s c r i p t E r r o r ) 
 
 	 - - d i s p l a y   d i a l o g   s h e l l r e s u l t 
 
 	 i f   s u c c e s s   t h e n 
 
 	 	 - - g e t   a l l   t h e   f i l e s   f r o m   n e w K e y s F o l d e r   a n d   a d d   t h o s e   t h a t   a r e n ' t   d u p l i c a t e s 
 
 	 	 t e l l   a p p l i c a t i o n   " F i n d e r "   t o   s e t   f i l e L i s t   t o   ( e v e r y   f i l e   i n   f o l d e r   n e w K e y s F o l d e r P a t h ) 
 
 	 	 r e p e a t   w i t h   t h i s _ i t e m   i n   f i l e L i s t 
 
 	 	 	 s e t   u s e r A d e p t K e y P a t h   t o   t h i s _ i t e m   a s   t e x t 
 
 	 	 	 s e t   d u p f i l e   t o   f a l s e 
 
 	 	 	 r e p e a t   w i t h   A d e p t K e y   i n   A d e p t K e y L i s t 
 
 	 	 	 	 s e t   s h e l l c o m m a n d   t o   " c m p   - s   "   &   ( q u o t e d   f o r m   o f   A d e p t K e y )   &   "   "   &   q u o t e d   f o r m   o f   ( P O S I X   p a t h   o f   ( u s e r A d e p t K e y P a t h ) ) 
 
 	 	 	 	 t r y 
 
 	 	 	 	 	 - - w r i t e t o l o g ( " s h e l l c o m m a n d :   "   &   s h e l l c o m m a n d ) 
 
 	 	 	 	 	 d o   s h e l l   s c r i p t   s h e l l c o m m a n d 
 
 	 	 	 	 	 - -   s h e l l c o m m a n d   w i l l   e r r o r   o n   t h e   f i l e s   b e i n g   d i f f e r e n t 
 
 	 	 	 	 	 - - w r i t e t o l o g ( " r e s u l t :   d u p l i c a t e " ) 
 
 	 	 	 	 	 
 
 	 	 	 	 	 s e t   d u p f i l e   t o   t r u e 
 
 	 	 	 	 	 e x i t   r e p e a t 
 
 	 	 	 	 o n   e r r o r   s c r i p t E r r o r 
 
 	 	 	 	 	 - - w r i t e t o l o g ( " r e s u l t :   d i f f e r e n t " ) 
 
 	 	 	 	 	 - -   d o   n o t h i n g 
 
 	 	 	 	 e n d   t r y 
 
 	 	 	 e n d   r e p e a t 
 
 	 	 	 i f   n o t   d u p f i l e   t h e n 
 
 	 	 	 	 r e p e a t   w i t h   A d e p t K e y   i n   n e w K e y L i s t 
 
 	 	 	 	 	 s e t   s h e l l c o m m a n d   t o   " c m p   - s   "   &   ( q u o t e d   f o r m   o f   A d e p t K e y )   &   "   "   &   q u o t e d   f o r m   o f   ( P O S I X   p a t h   o f   ( u s e r A d e p t K e y P a t h ) ) 
 
 	 	 	 	 	 t r y 
 
 	 	 	 	 	 	 - - w r i t e t o l o g ( " s h e l l c o m m a n d :   "   &   s h e l l c o m m a n d ) 
 
 	 	 	 	 	 	 d o   s h e l l   s c r i p t   s h e l l c o m m a n d 
 
 	 	 	 	 	 	 - -   s h e l l c o m m a n d   w i l l   e r r o r   o n   t h e   f i l e s   b e i n g   d i f f e r e n t 
 
 	 	 	 	 	 	 - - w r i t e t o l o g ( " r e s u l t :   d u p l i c a t e " ) 
 
 	 	 	 	 	 	 
 
 	 	 	 	 	 	 s e t   d u p f i l e   t o   t r u e 
 
 	 	 	 	 	 	 e x i t   r e p e a t 
 
 	 	 	 	 	 o n   e r r o r   s c r i p t E r r o r 
 
 	 	 	 	 	 	 - - w r i t e t o l o g ( " r e s u l t :   d i f f e r e n t " ) 
 
 	 	 	 	 	 	 - -   d o   n o t h i n g 
 
 	 	 	 	 	 e n d   t r y 
 
 	 	 	 	 e n d   r e p e a t 
 
 	 	 	 e n d   i f 
 
 	 	 	 i f   n o t   d u p f i l e   t h e n 
 
 	 	 	 	 - -   m o v e   t o   t h e   p r e f e r e n c e s   f o l d e r ,   m a k i n g   s u r e   t h e   n a m e ' s   u n i q u e 
 
 	 	 	 	 s e t   n e w F i l e n a m e   t o   G e t U n i q u e N a m e ( p r e f e r e n c e s F o l d e r P a t h ,   " A d o b e K e y . d e r " ) 
 
 	 	 	 	 t e l l   a p p l i c a t i o n   " F i n d e r " 
 
 	 	 	 	 	 s e t   n a m e   o f   f i l e   u s e r A d e p t K e y P a t h   t o   n e w F i l e n a m e 
 
 	 	 	 	 	 s e t   u s e r A d e p t K e y P a t h   t o   n e w K e y s F o l d e r P a t h   &   n e w F i l e n a m e 
 
 	 	 	 	 	 m o v e   f i l e   u s e r A d e p t K e y P a t h   t o   p r e f e r e n c e s F o l d e r P a t h   w i t h   r e p l a c i n g 
 
 	 	 	 	 e n d   t e l l 
 
 	 	 	 	 s e t   n e w K e y L i s t   t o   n e w K e y L i s t   &   ( P O S I X   p a t h   o f   ( p r e f e r e n c e s F o l d e r P a t h   &   n e w F i l e n a m e ) ) 
 
 	 	 	 e n d   i f 
 
 	 	 e n d   r e p e a t 
 
 	 e n d   i f 
 
 	 - -   d e l e t e   n e w   k e y s   f o l d e r 
 
 	 t e l l   a p p l i c a t i o n   " F i n d e r "   t o   m o v e   n e w K e y s F o l d e r P a t h   t o   t r a s h 
 
 	 - - d i s p l a y   d i a l o g   n e w K e y L i s t   a s   t e x t 
 
 	 r e t u r n   n e w K e y L i s t 
 
 e n d   G e t A d e p t K e y s 
 
 
 
 o n   G e t K i n d l e K e y s ( ) 
 
 	 s e t   n e w K e y L i s t   t o   { } 
 
 	 s e t   u s e r P r e f s P a t h   t o   p a t h   t o   p r e f e r e n c e s   f r o m   u s e r   d o m a i n   a s   s t r i n g 
 
 	 s e t   p r e f e r e n c e s F o l d e r P a t h   t o   u s e r P r e f s P a t h   &   p r e f s F o l d e r N a m e   &   " : " 
 
 	 i f   n o t   f o l d e r e x i s t s ( p r e f e r e n c e s F o l d e r P a t h )   t h e n 
 
 	 	 t e l l   a p p l i c a t i o n   " F i n d e r " 
 
 	 	 	 s e t   p r e f e r e n c e s F o l d e r   t o   m a k e   n e w   f o l d e r   a t   u s e r P r e f s P a t h   w i t h   p r o p e r t i e s   { n a m e : p r e f s F o l d e r N a m e } 
 
 	 	 e n d   t e l l 
 
 	 e n d   i f 
 
 	 s e t   n e w K e y s F o l d e r P a t h   t o   p r e f e r e n c e s F o l d e r P a t h   &   n e w K e y s F o l d e r N a m e   &   " : " 
 
 	 i f   n o t   f o l d e r e x i s t s ( n e w K e y s F o l d e r P a t h )   t h e n 
 
 	 	 t e l l   a p p l i c a t i o n   " F i n d e r " 
 
 	 	 	 s e t   n e w K e y s F o l d e r   t o   m a k e   n e w   f o l d e r   a t   p r e f e r e n c e s F o l d e r P a t h   w i t h   p r o p e r t i e s   { n a m e : n e w K e y s F o l d e r N a m e } 
 
 	 	 e n d   t e l l 
 
 	 e n d   i f 
 
 	 s e t   s c r i p t E r r o r   t o   " " 
 
 	 s e t   s h e l l r e s u l t   t o   " " 
 
 	 s e t   s u c c e s s   t o   t r u e 
 
 	 s e t   s h e l l c o m m a n d   t o   p y t h o n   &   ( q u o t e d   f o r m   o f   K i n d l e K e y T o o l )   &   "   "   &   q u o t e d   f o r m   o f   ( P O S I X   p a t h   o f   ( n e w K e y s F o l d e r P a t h ) ) 
 
 	 s e t   s h e l l c o m m a n d   t o   s h e l l c o m m a n d   &   "   >   "   &   q u o t e d t e m p p a t h ( ) 
 
 	 w r i t e t o l o g ( " s h e l l c o m m a n d :   "   &   s h e l l c o m m a n d ) 
 
 	 c l e a r t e m p ( ) 
 
 	 t r y 
 
 	 	 d o   s h e l l   s c r i p t   s h e l l c o m m a n d 
 
 	 o n   e r r o r   s c r i p t E r r o r 
 
 	 	 s e t   s u c c e s s   t o   f a l s e 
 
 	 e n d   t r y 
 
 	 s e t   s h e l l r e s u l t   t o   r e a d t e m p ( ) 
 
 	 w r i t e t o l o g ( " s h e l l r e s u l t :   "   &   s h e l l r e s u l t   &   "   "   &   s c r i p t E r r o r ) 
 
 	 - - d i s p l a y   d i a l o g   s h e l l r e s u l t 
 
 	 i f   s u c c e s s   t h e n 
 
 	 	 - - g e t   a l l   t h e   f i l e s   f r o m   n e w K e y s F o l d e r   a n d   a d d   t h o s e   t h a t   a r e n ' t   d u p l i c a t e s 
 
 	 	 t e l l   a p p l i c a t i o n   " F i n d e r "   t o   s e t   f i l e L i s t   t o   ( e v e r y   f i l e   i n   f o l d e r   n e w K e y s F o l d e r P a t h ) 
 
 	 	 r e p e a t   w i t h   t h i s _ i t e m   i n   f i l e L i s t 
 
 	 	 	 s e t   u s e r K e y P a t h   t o   t h i s _ i t e m   a s   t e x t 
 
 	 	 	 s e t   d u p f i l e   t o   f a l s e 
 
 	 	 	 r e p e a t   w i t h   k e y   i n   K i n d l e K e y L i s t 
 
 	 	 	 	 s e t   s h e l l c o m m a n d   t o   " c m p   - s   "   &   ( q u o t e d   f o r m   o f   k e y )   &   "   "   &   q u o t e d   f o r m   o f   ( P O S I X   p a t h   o f   ( u s e r K e y P a t h ) ) 
 
 	 	 	 	 t r y 
 
 	 	 	 	 	 - - w r i t e t o l o g ( " s h e l l c o m m a n d :   "   &   s h e l l c o m m a n d ) 
 
 	 	 	 	 	 d o   s h e l l   s c r i p t   s h e l l c o m m a n d 
 
 	 	 	 	 	 - -   s h e l l c o m m a n d   w i l l   e r r o r   o n   t h e   f i l e s   b e i n g   d i f f e r e n t 
 
 	 	 	 	 	 - - w r i t e t o l o g ( " r e s u l t :   d u p l i c a t e " ) 
 
 	 	 	 	 	 
 
 	 	 	 	 	 s e t   d u p f i l e   t o   t r u e 
 
 	 	 	 	 	 e x i t   r e p e a t 
 
 	 	 	 	 o n   e r r o r   s c r i p t E r r o r 
 
 	 	 	 	 	 - - w r i t e t o l o g ( " r e s u l t :   d i f f e r e n t " ) 
 
 	 	 	 	 	 - -   d o   n o t h i n g 
 
 	 	 	 	 e n d   t r y 
 
 	 	 	 e n d   r e p e a t 
 
 	 	 	 i f   n o t   d u p f i l e   t h e n 
 
 	 	 	 	 r e p e a t   w i t h   k e y   i n   n e w K e y L i s t 
 
 	 	 	 	 	 s e t   s h e l l c o m m a n d   t o   " c m p   - s   "   &   ( q u o t e d   f o r m   o f   k e y )   &   "   "   &   q u o t e d   f o r m   o f   ( P O S I X   p a t h   o f   ( u s e r K e y P a t h ) ) 
 
 	 	 	 	 	 t r y 
 
 	 	 	 	 	 	 - - w r i t e t o l o g ( " s h e l l c o m m a n d :   "   &   s h e l l c o m m a n d ) 
 
 	 	 	 	 	 	 d o   s h e l l   s c r i p t   s h e l l c o m m a n d 
 
 	 	 	 	 	 	 - -   s h e l l c o m m a n d   w i l l   e r r o r   o n   t h e   f i l e s   b e i n g   d i f f e r e n t 
 
 	 	 	 	 	 	 - - w r i t e t o l o g ( " r e s u l t :   d u p l i c a t e " ) 
 
 	 	 	 	 	 	 
 
 	 	 	 	 	 	 s e t   d u p f i l e   t o   t r u e 
 
 	 	 	 	 	 	 e x i t   r e p e a t 
 
 	 	 	 	 	 o n   e r r o r   s c r i p t E r r o r 
 
 	 	 	 	 	 	 - - w r i t e t o l o g ( " r e s u l t :   d i f f e r e n t " ) 
 
 	 	 	 	 	 	 - -   d o   n o t h i n g 
 
 	 	 	 	 	 e n d   t r y 
 
 	 	 	 	 e n d   r e p e a t 
 
 	 	 	 e n d   i f 
 
 	 	 	 i f   n o t   d u p f i l e   t h e n 
 
 	 	 	 	 - -   m o v e   t o   t h e   p r e f e r e n c e s   f o l d e r ,   m a k i n g   s u r e   t h e   n a m e ' s   u n i q u e 
 
 	 	 	 	 s e t   n e w F i l e n a m e   t o   G e t U n i q u e N a m e ( p r e f e r e n c e s F o l d e r P a t h ,   " K i n d l e K e y . d e r " ) 
 
 	 	 	 	 t e l l   a p p l i c a t i o n   " F i n d e r " 
 
 	 	 	 	 	 s e t   n a m e   o f   f i l e   u s e r K e y P a t h   t o   n e w F i l e n a m e 
 
 	 	 	 	 	 s e t   u s e r K e y P a t h   t o   n e w K e y s F o l d e r P a t h   &   n e w F i l e n a m e 
 
 	 	 	 	 	 m o v e   f i l e   u s e r K e y P a t h   t o   p r e f e r e n c e s F o l d e r P a t h   w i t h   r e p l a c i n g 
 
 	 	 	 	 e n d   t e l l 
 
 	 	 	 	 s e t   n e w K e y L i s t   t o   n e w K e y L i s t   &   ( P O S I X   p a t h   o f   ( p r e f e r e n c e s F o l d e r P a t h   &   n e w F i l e n a m e ) ) 
 
 	 	 	 e n d   i f 
 
 	 	 e n d   r e p e a t 
 
 	 e n d   i f 
 
 	 - -   d e l e t e   n e w   k e y s   f o l d e r 
 
 	 t e l l   a p p l i c a t i o n   " F i n d e r "   t o   m o v e   n e w K e y s F o l d e r P a t h   t o   t r a s h 
 
 	 r e t u r n   n e w K e y L i s t 
 
 e n d   G e t K i n d l e K e y s 
 
 
 
 o n   G e t N o o k K e y s ( ) 
 
 	 s e t   n e w K e y L i s t   t o   { } 
 
 	 s e t   u s e r P r e f s P a t h   t o   p a t h   t o   p r e f e r e n c e s   f r o m   u s e r   d o m a i n   a s   s t r i n g 
 
 	 s e t   p r e f e r e n c e s F o l d e r P a t h   t o   u s e r P r e f s P a t h   &   p r e f s F o l d e r N a m e   &   " : " 
 
 	 i f   n o t   f o l d e r e x i s t s ( p r e f e r e n c e s F o l d e r P a t h )   t h e n 
 
 	 	 t e l l   a p p l i c a t i o n   " F i n d e r " 
 
 	 	 	 s e t   p r e f e r e n c e s F o l d e r   t o   m a k e   n e w   f o l d e r   a t   u s e r P r e f s P a t h   w i t h   p r o p e r t i e s   { n a m e : p r e f s F o l d e r N a m e } 
 
 	 	 e n d   t e l l 
 
 	 e n d   i f 
 
 	 s e t   n e w K e y s F o l d e r P a t h   t o   p r e f e r e n c e s F o l d e r P a t h   &   n e w K e y s F o l d e r N a m e   &   " : " 
 
 	 i f   n o t   f o l d e r e x i s t s ( n e w K e y s F o l d e r P a t h )   t h e n 
 
 	 	 t e l l   a p p l i c a t i o n   " F i n d e r " 
 
 	 	 	 s e t   n e w K e y s F o l d e r   t o   m a k e   n e w   f o l d e r   a t   p r e f e r e n c e s F o l d e r P a t h   w i t h   p r o p e r t i e s   { n a m e : n e w K e y s F o l d e r N a m e } 
 
 	 	 e n d   t e l l 
 
 	 e n d   i f 
 
 	 s e t   s c r i p t E r r o r   t o   " " 
 
 	 s e t   s h e l l r e s u l t   t o   " " 
 
 	 s e t   s u c c e s s   t o   t r u e 
 
 	 s e t   s h e l l c o m m a n d   t o   p y t h o n   &   ( q u o t e d   f o r m   o f   N o o k K e y T o o l )   &   "   "   &   q u o t e d   f o r m   o f   ( P O S I X   p a t h   o f   ( n e w K e y s F o l d e r P a t h ) ) 
 
 	 s e t   s h e l l c o m m a n d   t o   s h e l l c o m m a n d   &   "   >   "   &   q u o t e d t e m p p a t h ( ) 
 
 	 w r i t e t o l o g ( " s h e l l c o m m a n d :   "   &   s h e l l c o m m a n d ) 
 
 	 c l e a r t e m p ( ) 
 
 	 t r y 
 
 	 	 d o   s h e l l   s c r i p t   s h e l l c o m m a n d 
 
 	 o n   e r r o r   s c r i p t E r r o r 
 
 	 	 s e t   s u c c e s s   t o   f a l s e 
 
 	 e n d   t r y 
 
 	 s e t   s h e l l r e s u l t   t o   r e a d t e m p ( ) 
 
 	 w r i t e t o l o g ( " s h e l l r e s u l t :   "   &   s h e l l r e s u l t   &   "   "   &   s c r i p t E r r o r ) 
 
 	 - - d i s p l a y   d i a l o g   s h e l l r e s u l t 
 
 	 i f   s u c c e s s   t h e n 
 
 	 	 - - g e t   a l l   t h e   f i l e s   f r o m   n e w K e y s F o l d e r   a n d   a d d   t h o s e   t h a t   a r e n ' t   d u p l i c a t e s 
 
 	 	 t e l l   a p p l i c a t i o n   " F i n d e r "   t o   s e t   f i l e L i s t   t o   ( e v e r y   f i l e   i n   f o l d e r   n e w K e y s F o l d e r P a t h ) 
 
 	 	 - - d i s p l a y   d i a l o g   ( c o u n t   o f   f i l e L i s t ) 
 
 	 	 r e p e a t   w i t h   t h i s _ i t e m   i n   f i l e L i s t 
 
 	 	 	 s e t   u s e r K e y P a t h   t o   t h i s _ i t e m   a s   t e x t 
 
 	 	 	 s e t   d u p f i l e   t o   f a l s e 
 
 	 	 	 r e p e a t   w i t h   k e y   i n   b n K e y s 
 
 	 	 	 	 s e t   k e y f i l e p a t h   t o   t h i r d   i t e m   o f   k e y 
 
 	 	 	 	 i f   l e n g t h   o f   k e y f i l e p a t h   >   0   t h e n 
 
 	 	 	 	 	 s e t   s h e l l c o m m a n d   t o   " c m p   - s   "   &   ( q u o t e d   f o r m   o f   k e y f i l e p a t h )   &   "   "   &   q u o t e d   f o r m   o f   ( P O S I X   p a t h   o f   ( u s e r K e y P a t h ) ) 
 
 	 	 	 	 	 t r y 
 
 	 	 	 	 	 	 - - w r i t e t o l o g ( " s h e l l c o m m a n d :   "   &   s h e l l c o m m a n d ) 
 
 	 	 	 	 	 	 d o   s h e l l   s c r i p t   s h e l l c o m m a n d 
 
 	 	 	 	 	 	 - -   s h e l l c o m m a n d   w i l l   e r r o r   o n   t h e   f i l e s   b e i n g   d i f f e r e n t 
 
 	 	 	 	 	 	 - - w r i t e t o l o g ( " r e s u l t :   d u p l i c a t e " ) 
 
 	 	 	 	 	 	 - - d i s p l a y   d i a l o g   " D e u p l i c a t e :   "   &   u s e r K e y P a t h   &   " / / "   &   k e y f i l e p a t h 
 
 	 	 	 	 	 	 s e t   d u p f i l e   t o   t r u e 
 
 	 	 	 	 	 	 e x i t   r e p e a t 
 
 	 	 	 	 	 o n   e r r o r   s c r i p t E r r o r 
 
 	 	 	 	 	 	 - - w r i t e t o l o g ( " r e s u l t :   d i f f e r e n t " ) 
 
 	 	 	 	 	 	 - -   d o   n o t h i n g 
 
 	 	 	 	 	 e n d   t r y 
 
 	 	 	 	 e n d   i f 
 
 	 	 	 e n d   r e p e a t 
 
 	 	 	 i f   n o t   d u p f i l e   t h e n 
 
 	 	 	 	 r e p e a t   w i t h   k e y   i n   n e w K e y L i s t 
 
 	 	 	 	 	 s e t   k e y f i l e p a t h   t o   t h i r d   i t e m   o f   k e y 
 
 	 	 	 	 	 i f   l e n g t h   o f   k e y f i l e p a t h   >   0   t h e n 
 
 	 	 	 	 	 	 s e t   s h e l l c o m m a n d   t o   " c m p   - s   "   &   ( q u o t e d   f o r m   o f   k e y f i l e p a t h )   &   "   "   &   q u o t e d   f o r m   o f   ( P O S I X   p a t h   o f   ( u s e r K e y P a t h ) ) 
 
 	 	 	 	 	 	 t r y 
 
 	 	 	 	 	 	 	 - - w r i t e t o l o g ( " s h e l l c o m m a n d :   "   &   s h e l l c o m m a n d ) 
 
 	 	 	 	 	 	 	 d o   s h e l l   s c r i p t   s h e l l c o m m a n d 
 
 	 	 	 	 	 	 	 - -   s h e l l c o m m a n d   w i l l   e r r o r   o n   t h e   f i l e s   b e i n g   d i f f e r e n t 
 
 	 	 	 	 	 	 	 - - w r i t e t o l o g ( " r e s u l t :   d u p l i c a t e " ) 
 
 	 	 	 	 	 	 	 - - d i s p l a y   d i a l o g   " D e u p l i c a t e :   "   &   u s e r K e y P a t h   &   " / / "   &   k e y f i l e p a t h 
 
 	 	 	 	 	 	 	 s e t   d u p f i l e   t o   t r u e 
 
 	 	 	 	 	 	 	 e x i t   r e p e a t 
 
 	 	 	 	 	 	 o n   e r r o r   s c r i p t E r r o r 
 
 	 	 	 	 	 	 	 - - w r i t e t o l o g ( " r e s u l t :   d i f f e r e n t " ) 
 
 	 	 	 	 	 	 	 - -   d o   n o t h i n g 
 
 	 	 	 	 	 	 e n d   t r y 
 
 	 	 	 	 	 e n d   i f 
 
 	 	 	 	 e n d   r e p e a t 
 
 	 	 	 e n d   i f 
 
 	 	 	 i f   n o t   d u p f i l e   t h e n 
 
 	 	 	 	 - -   m o v e   t o   t h e   p r e f e r e n c e s   f o l d e r ,   m a k i n g   s u r e   t h e   n a m e ' s   u n i q u e 
 
 	 	 	 	 s e t   n e w F i l e n a m e   t o   G e t U n i q u e N a m e ( p r e f e r e n c e s F o l d e r P a t h ,   " N o o k   S t u d y   K e y . b 6 4 " ) 
 
 	 	 	 	 t e l l   a p p l i c a t i o n   " F i n d e r " 
 
 	 	 	 	 	 s e t   n a m e   o f   f i l e   u s e r K e y P a t h   t o   n e w F i l e n a m e 
 
 	 	 	 	 	 s e t   u s e r K e y P a t h   t o   n e w K e y s F o l d e r P a t h   &   n e w F i l e n a m e 
 
 	 	 	 	 	 m o v e   f i l e   u s e r K e y P a t h   t o   p r e f e r e n c e s F o l d e r P a t h   w i t h   r e p l a c i n g 
 
 	 	 	 	 e n d   t e l l 
 
 	 	 	 	 s e t   n e w K e y L i s t   t o   n e w K e y L i s t   &   { { n e w F i l e n a m e ,   " " ,   ( P O S I X   p a t h   o f   ( p r e f e r e n c e s F o l d e r P a t h   &   n e w F i l e n a m e ) ) } } 
 
 	 	 	 e n d   i f 
 
 	 	 e n d   r e p e a t 
 
 	 e n d   i f 
 
 	 - -   d e l e t e   n e w   k e y s   f o l d e r 
 
 	 t e l l   a p p l i c a t i o n   " F i n d e r "   t o   m o v e   n e w K e y s F o l d e r P a t h   t o   t r a s h 
 
 	 r e t u r n   n e w K e y L i s t 
 
 e n d   G e t N o o k K e y s 
 
 
 
 o n   e n c o d e A s B a s e 6 4 ( t h e F i l e P a t h ) 
 
 	 s e t   p o s i x f i l e p a t h   t o   P O S I X   p a t h   o f   f i l e   t h e F i l e P a t h 
 
 	 s e t   b a s e 6 4 p a t h   t o   P O S I X   p a t h   o f   f i l e   ( ( p a t h   t o   m e   a s   t e x t )   &   " C o n t e n t s : R e s o u r c e s : e n c o d e b a s e 6 4 . p y " ) 
 
 	 r e t u r n   d o   s h e l l   s c r i p t   p y t h o n   &   q u o t e d   f o r m   o f   b a s e 6 4 p a t h   &   "   "   &   q u o t e d   f o r m   o f   p o s i x f i l e p a t h 
 
 e n d   e n c o d e A s B a s e 6 4 
 
 
 
 o n   A d d A d e p t K e y ( k e y f i l e ) 
 
 	 s e t   f i l e E x t e n s i o n   t o   G e t F i l e E x t e n s i o n ( k e y f i l e ) 
 
 	 i f   f i l e E x t e n s i o n   i s   " d e r "   t h e n 
 
 	 	 s e t   n e w P r e f s F i l e   t o   C o p y T o P r e f s ( k e y f i l e ) 
 
 	 	 s e t   A d e p t K e y L i s t   t o   A d e p t K e y L i s t   &   P O S I X   p a t h   o f   n e w P r e f s F i l e 
 
 	 e l s e 
 
 	 	 d i s p l a y   d i a l o g   " A d o b e   A d e p t   k e y   f i l e s   g e n e r a t e d   b y   a d e p t k e y . p y   m u s t   h a v e   a   . d e r   e x t e n s i o n . "   b u t t o n s   { " O K " }   d e f a u l t   b u t t o n   1   w i t h   t i t l e   " D e D R M "   w i t h   i c o n   c a u t i o n 
 
 	 e n d   i f 
 
 e n d   A d d A d e p t K e y 
 
 
 
 o n   A d d K i n d l e K e y ( k e y f i l e ) 
 
 	 s e t   f i l e E x t e n s i o n   t o   G e t F i l e E x t e n s i o n ( k e y f i l e ) 
 
 	 i f   f i l e E x t e n s i o n   i s   " k 4 i "   t h e n 
 
 	 	 s e t   n e w P r e f s F i l e   t o   C o p y T o P r e f s ( k e y f i l e ) 
 
 	 	 s e t   K i n d l e K e y L i s t   t o   K i n d l e K e y L i s t   &   P O S I X   p a t h   o f   n e w P r e f s F i l e 
 
 	 e l s e 
 
 	 	 d i s p l a y   d i a l o g   " K i n d l e   k e y   f i l e s   g e n e r a t e d   b y   k i n d l e k e y . p y   m u s t   h a v e   a   . k 4 i   e x t e n s i o n . "   b u t t o n s   { " O K " }   d e f a u l t   b u t t o n   1   w i t h   t i t l e   " D e D R M "   w i t h   i c o n   c a u t i o n 
 
 	 e n d   i f 
 
 e n d   A d d K i n d l e K e y 
 
 
 
 o n   A d d A n d r o i d K e y ( k e y f i l e ) 
 
 	 s e t   f i l e E x t e n s i o n   t o   G e t F i l e E x t e n s i o n ( k e y f i l e ) 
 
 	 i f   f i l e E x t e n s i o n   i s   " a b "   o r   f i l e E x t e n s i o n   i s   " d b "   o r   f i l e E x t e n s i o n   i s   " x m l "   t h e n 
 
 	 	 s e t   n e w P r e f s F i l e   t o   C o p y T o P r e f s ( k e y f i l e ) 
 
 	 	 s e t   A n d r o i d K e y L i s t   t o   A n d r o i d K e y L i s t   &   P O S I X   p a t h   o f   n e w P r e f s F i l e 
 
 	 e l s e 
 
 	 	 d i s p l a y   d i a l o g   " A n d r o i d   b a c k   f i l e s   g e n e r a t e d   b y   u s e   o f   \ " a d b   b a c k u p   c o m . a m a z o n . k i n d l e \ "   m u s t   h a v e   a   . a b   e x t e n s i o n . "   b u t t o n s   { " O K " }   d e f a u l t   b u t t o n   1   w i t h   t i t l e   " D e D R M "   w i t h   i c o n   c a u t i o n 
 
 	 e n d   i f 
 
 e n d   A d d A n d r o i d K e y 
 
 
 
 o n   A d d b n K e y ( k e y f i l e ) 
 
 	 s e t   f i l e E x t e n s i o n   t o   G e t F i l e E x t e n s i o n ( k e y f i l e ) 
 
 	 i f   f i l e E x t e n s i o n   i s   " b 6 4 "   t h e n 
 
 	 	 s e t   n e w P r e f s F i l e   t o   C o p y T o P r e f s ( k e y f i l e ) 
 
 	 	 t e l l   a p p l i c a t i o n   " F i n d e r " 
 
 	 	 	 s e t   k e y f i l e N a m e   t o   ( n a m e   o f   f i l e   n e w P r e f s F i l e )   a s   t e x t 
 
 	 	 e n d   t e l l 
 
 	 	 s e t   f i l e N a m e   t o   G e t F i l e N a m e O n l y ( k e y f i l e N a m e ) 
 
 	 	 s e t   b n K e y s   t o   b n K e y s   &   { { f i l e N a m e ,   " " ,   P O S I X   p a t h   o f   n e w P r e f s F i l e } } 
 
 	 e l s e 
 
 	 	 d i s p l a y   d i a l o g   " B a r n e s   &   N o b l e   k e y   f i l e s   m u s t   h a v e   a   . b 6 4   e x t e n s i o n . "   b u t t o n s   { " O K " }   d e f a u l t   b u t t o n   1   w i t h   t i t l e   " D e D R M "   w i t h   i c o n   c a u t i o n 
 
 	 e n d   i f 
 
 e n d   A d d b n K e y 
 
 
 
 o n   G e t U n i q u e N a m e ( f o l d e r P a t h ,   f i l e N a m e ) 
 
 	 s e t   n e w F i l e n a m e   t o   f i l e N a m e 
 
 	 i f   f i l e e x i s t s ( f o l d e r P a t h   &   f i l e N a m e )   t h e n 
 
 	 	 - -   f i r s t   f i n d   n e w   n a m e   t h a t ' s   u n i q u e   t o   f o l d e r 
 
 	 	 s e t   n a m e c o u n t   t o   2 
 
 	 	 s e t   f i l e E x t e n s i o n   t o   G e t F i l e E x t e n s i o n ( f i l e N a m e ) 
 
 	 	 s e t   f i l e N a m e O n l y   t o   G e t F i l e N a m e O n l y ( f i l e N a m e ) 
 
 	 	 r e p e a t 
 
 	 	 	 s e t   n e w F i l e n a m e   t o   f i l e N a m e O n l y   &   "   "   &   ( n a m e c o u n t   a s   t e x t )   &   " . "   &   f i l e E x t e n s i o n 
 
 	 	 	 i f   n o t   f i l e e x i s t s ( f o l d e r P a t h   &   n e w F i l e n a m e )   t h e n 
 
 	 	 	 	 e x i t   r e p e a t 
 
 	 	 	 e n d   i f 
 
 	 	 	 s e t   n a m e c o u n t   t o   n a m e c o u n t   +   1 
 
 	 	 e n d   r e p e a t 
 
 	 e n d   i f 
 
 	 r e t u r n   n e w F i l e n a m e 
 
 e n d   G e t U n i q u e N a m e 
 
 
 
 o n   C o p y T o P r e f s ( k e y f i l e p a t h ) 
 
 	 t e l l   a p p l i c a t i o n   " F i n d e r " 
 
 	 	 s e t   k e y f i l e N a m e   t o   ( n a m e   o f   f i l e   k e y f i l e p a t h )   a s   t e x t 
 
 	 e n d   t e l l 
 
 	 s e t   k e y f i l e A p p l e p a t h   t o   P O S I X   f i l e   ( P O S I X   p a t h   o f   k e y f i l e p a t h ) 
 
 	 s e t   u s e r P r e f s P a t h   t o   p a t h   t o   p r e f e r e n c e s   f r o m   u s e r   d o m a i n   a s   s t r i n g 
 
 	 s e t   u s e r T e m p P a t h   t o   p a t h   t o   t e m p o r a r y   i t e m s   f r o m   u s e r   d o m a i n   a s   s t r i n g 
 
 	 s e t   p r e f e r e n c e s F o l d e r P a t h   t o   u s e r P r e f s P a t h   &   p r e f s F o l d e r N a m e   &   " : " 
 
 	 i f   n o t   f o l d e r e x i s t s ( p r e f e r e n c e s F o l d e r P a t h )   t h e n 
 
 	 	 t e l l   a p p l i c a t i o n   " F i n d e r " 
 
 	 	 	 s e t   p r e f e r e n c e s F o l d e r   t o   m a k e   n e w   f o l d e r   a t   u s e r P r e f s P a t h   w i t h   p r o p e r t i e s   { n a m e : p r e f s F o l d e r N a m e } 
 
 	 	 e n d   t e l l 
 
 	 e n d   i f 
 
 	 i f   f i l e e x i s t s ( p r e f e r e n c e s F o l d e r P a t h   &   k e y f i l e N a m e )   t h e n 
 
 	 	 - -   c o p y   t o   t e m p o r a r y   i t e m s   f o l d e r ,   r e n a m e ,   a n d   t h e n   w e   c a n   c o p y   f r o m   t h e r e   t o   t h e   p r e f e r e n c e s   f o l d e r 
 
 	 	 - -   f i r s t   f i n d   n e w   n a m e 
 
 	 	 s e t   n a m e c o u n t   t o   2 
 
 	 	 s e t   f i l e E x t e n s i o n   t o   G e t F i l e E x t e n s i o n ( k e y f i l e N a m e ) 
 
 	 	 s e t   k e y f i l e N a m e O n l y   t o   G e t F i l e N a m e O n l y ( k e y f i l e N a m e ) 
 
 	 	 r e p e a t 
 
 	 	 	 s e t   n e w k e y f i l e N a m e   t o   k e y f i l e N a m e O n l y   &   "   "   &   ( n a m e c o u n t   a s   t e x t )   &   " . "   &   f i l e E x t e n s i o n 
 
 	 	 	 i f   n o t   f i l e e x i s t s ( p r e f e r e n c e s F o l d e r P a t h   &   n e w k e y f i l e N a m e )   a n d   n o t   f i l e e x i s t s ( u s e r T e m p P a t h   &   n e w k e y f i l e N a m e )   t h e n 
 
 	 	 	 	 e x i t   r e p e a t 
 
 	 	 	 e n d   i f 
 
 	 	 	 s e t   n a m e c o u n t   t o   n a m e c o u n t   +   1 
 
 	 	 e n d   r e p e a t 
 
 	 	 - -   r e n a m e   t o   n e w   n a m e 
 
 	 	 s e t   n e w k e y f i l e p a t h   t o   u s e r T e m p P a t h   &   n e w k e y f i l e N a m e 
 
 	 	 t e l l   a p p l i c a t i o n   " F i n d e r " 
 
 	 	 	 s e t   t e m p f i l e p a t h   t o   d u p l i c a t e   f i l e   k e y f i l e A p p l e p a t h   t o   f o l d e r   u s e r T e m p P a t h   w i t h   r e p l a c i n g 
 
 	 	 	 s e t   n a m e   o f   t e m p f i l e p a t h   t o   n e w k e y f i l e N a m e 
 
 	 	 	 m o v e   f i l e   n e w k e y f i l e p a t h   t o   p r e f e r e n c e s F o l d e r P a t h 
 
 	 	 e n d   t e l l 
 
 	 	 s e t   n e w F i l e   t o   p r e f e r e n c e s F o l d e r P a t h   &   n e w k e y f i l e N a m e 
 
 	 e l s e 
 
 	 	 t e l l   a p p l i c a t i o n   " F i n d e r " 
 
 	 	 	 s e t   n e w F i l e   t o   d u p l i c a t e   f i l e   k e y f i l e A p p l e p a t h   t o   f o l d e r   p r e f e r e n c e s F o l d e r P a t h   w i t h   r e p l a c i n g 
 
 	 	 e n d   t e l l 
 
 	 e n d   i f 
 
 	 
 
 	 r e t u r n   n e w F i l e   a s   t e x t 
 
 e n d   C o p y T o P r e f s 
 
 
 
 o n   R e a d P r e f s ( ) 
 
 	 - -   r e a d   a n y   e x i s t i n g   k e y s   f r o m   t h e   p r e f e r e n c e s 
 
 	 s e t   P I D s   t o   { } 
 
 	 s e t   U D I D s   t o   { } 
 
 	 s e t   b n K e y s   t o   { } 
 
 	 s e t   K i n d l e K e y L i s t   t o   { } 
 
 	 s e t   A n d r o i d K e y L i s t   t o   { } 
 
 	 s e t   K i n d l e S e r i a l L i s t   t o   { } 
 
 	 s e t   A d e p t K e y L i s t   t o   { } 
 
 	 s e t   o u t p u t F o l d e r   t o   ( p a t h   t o   d e s k t o p   a s   s t r i n g ) 
 
 	 s e t   l o g F i l e P a t h   t o   ( p a t h   t o   d e s k t o p   a s   s t r i n g )   &   " D e D R M . l o g " 
 
 	 s e t   u s e r P r e f s P a t h   t o   p a t h   t o   p r e f e r e n c e s   f r o m   u s e r   d o m a i n   a s   s t r i n g 
 
 	 s e t   p r e f e r e n c e s F o l d e r P a t h   t o   u s e r P r e f s P a t h   &   p r e f s F o l d e r N a m e   &   " : " 
 
 	 i f   n o t   f o l d e r e x i s t s ( p r e f e r e n c e s F o l d e r P a t h )   t h e n 
 
 	 	 t e l l   a p p l i c a t i o n   " F i n d e r " 
 
 	 	 	 s e t   p r e f e r e n c e s F o l d e r   t o   m a k e   n e w   f o l d e r   a t   u s e r P r e f s P a t h   w i t h   p r o p e r t i e s   { n a m e : p r e f s F o l d e r N a m e } 
 
 	 	 e n d   t e l l 
 
 	 e n d   i f 
 
 	 s e t   p r e f e r e n c e s F i l e P a t h   t o   u s e r P r e f s P a t h   &   p r e f s F i l e N a m e 
 
 	 s e t   t e m p f i l e p a t h   t o   p r e f e r e n c e s F o l d e r P a t h   &   t e m p F i l e N a m e 
 
 	 
 
 	 i f   f i l e e x i s t s ( P O S I X   p a t h   o f   f i l e   p r e f e r e n c e s F i l e P a t h )   t h e n 
 
 	 	 t e l l   a p p l i c a t i o n   " S y s t e m   E v e n t s " 
 
 	 	 	 t r y 
 
 	 	 	 	 s e t   P I D s   t o   v a l u e   o f   p r o p e r t y   l i s t   i t e m   " P I D s "   o f   p r o p e r t y   l i s t   f i l e   p r e f e r e n c e s F i l e P a t h 
 
 	 	 	 e n d   t r y 
 
 	 	 	 t r y 
 
 	 	 	 	 s e t   U D I D s   t o   v a l u e   o f   p r o p e r t y   l i s t   i t e m   " U D I D s "   o f   p r o p e r t y   l i s t   f i l e   p r e f e r e n c e s F i l e P a t h 
 
 	 	 	 e n d   t r y 
 
 	 	 	 t r y 
 
 	 	 	 	 s e t   K i n d l e S e r i a l L i s t   t o   v a l u e   o f   p r o p e r t y   l i s t   i t e m   " K i n d l e S e r i a l s "   o f   p r o p e r t y   l i s t   f i l e   p r e f e r e n c e s F i l e P a t h 
 
 	 	 	 e n d   t r y 
 
 	 	 	 t r y 
 
 	 	 	 	 s e t   b n K e y s   t o   v a l u e   o f   p r o p e r t y   l i s t   i t e m   " b n K e y s "   o f   p r o p e r t y   l i s t   f i l e   p r e f e r e n c e s F i l e P a t h 
 
 	 	 	 e n d   t r y 
 
 	 	 	 t r y 
 
 	 	 	 	 s e t   A d e p t K e y L i s t   t o   v a l u e   o f   p r o p e r t y   l i s t   i t e m   " A d e p t K e y s "   o f   p r o p e r t y   l i s t   f i l e   p r e f e r e n c e s F i l e P a t h 
 
 	 	 	 e n d   t r y 
 
 	 	 	 t r y 
 
 	 	 	 	 s e t   A n d r o i d K e y L i s t   t o   v a l u e   o f   p r o p e r t y   l i s t   i t e m   " A n d r o i d K e y s "   o f   p r o p e r t y   l i s t   f i l e   p r e f e r e n c e s F i l e P a t h 
 
 	 	 	 e n d   t r y 
 
 	 	 	 t r y 
 
 	 	 	 	 s e t   K i n d l e K e y L i s t   t o   v a l u e   o f   p r o p e r t y   l i s t   i t e m   " K i n d l e K e y s "   o f   p r o p e r t y   l i s t   f i l e   p r e f e r e n c e s F i l e P a t h 
 
 	 	 	 e n d   t r y 
 
 	 	 	 t r y 
 
 	 	 	 	 s e t   o u t p u t F o l d e r   t o   v a l u e   o f   p r o p e r t y   l i s t   i t e m   " O u t p u t F o l d e r "   o f   p r o p e r t y   l i s t   f i l e   p r e f e r e n c e s F i l e P a t h 
 
 	 	 	 e n d   t r y 
 
 	 	 e n d   t e l l 
 
 	 e n d   i f 
 
 	 
 
 	 
 
 	 s e t   n e w L i s t   t o   { } 
 
 	 r e p e a t   w i t h   i   f r o m   1   t o   c o u n t   A n d r o i d K e y L i s t 
 
 	 	 i f   f i l e e x i s t s ( A n d r o i d K e y L i s t ' s   i t e m   i )   t h e n   s e t   n e w L i s t ' s   e n d   t o   A n d r o i d K e y L i s t ' s   i t e m   i 
 
 	 e n d   r e p e a t 
 
 	 s e t   A n d r o i d K e y L i s t   t o   n e w L i s t 
 
 	 
 
 	 s e t   n e w L i s t   t o   { } 
 
 	 r e p e a t   w i t h   i   f r o m   1   t o   c o u n t   A d e p t K e y L i s t 
 
 	 	 i f   f i l e e x i s t s ( A d e p t K e y L i s t ' s   i t e m   i )   t h e n   s e t   n e w L i s t ' s   e n d   t o   A d e p t K e y L i s t ' s   i t e m   i 
 
 	 e n d   r e p e a t 
 
 	 s e t   A d e p t K e y L i s t   t o   n e w L i s t 
 
 	 
 
 	 s e t   n e w L i s t   t o   { } 
 
 	 r e p e a t   w i t h   i   f r o m   1   t o   c o u n t   K i n d l e K e y L i s t 
 
 	 	 i f   f i l e e x i s t s ( K i n d l e K e y L i s t ' s   i t e m   i )   t h e n   s e t   n e w L i s t ' s   e n d   t o   K i n d l e K e y L i s t ' s   i t e m   i 
 
 	 e n d   r e p e a t 
 
 	 s e t   K i n d l e K e y L i s t   t o   n e w L i s t 
 
 	 
 
 	 s e t   n e w L i s t   t o   { } 
 
 	 r e p e a t   w i t h   i   f r o m   1   t o   c o u n t   b n K e y s 
 
 	 	 i f   ( i t e m   3   o f   b n K e y s ' s   i t e m   i )   i s   " "   o r   f i l e e x i s t s ( i t e m   3   o f   b n K e y s ' s   i t e m   i )   t h e n   s e t   n e w L i s t ' s   e n d   t o   b n K e y s ' s   i t e m   i 
 
 	 e n d   r e p e a t 
 
 	 s e t   b n K e y s   t o   n e w L i s t 
 
 	 
 
 e n d   R e a d P r e f s 
 
 
 
 o n   C r e a t e P l i s t ( f i l e P a t h ) 
 
 	 s e t   t h e E m p t y P L i s t D a t a   t o   " < ? x m l   v e r s i o n = \ " 1 . 0 \ "   e n c o d i n g = \ " U T F - 8 \ " ? > 
 
 < ! D O C T Y P E   p l i s t   P U B L I C   \ " - / / A p p l e   C o m p u t e r / / D T D   P L I S T   1 . 0 / / E N \ "   \ " h t t p : / / w w w . a p p l e . c o m / D T D s / P r o p e r t y L i s t - 1 . 0 . d t d \ " > 
 
 < p l i s t   v e r s i o n = \ " 1 . 0 \ " > 
 
 < d i c t / > 
 
 < / p l i s t > " 
 
 	 
 
 	 s e t   t h e P L i s t F i l e   t o   o p e n   f o r   a c c e s s   f i l e P a t h   w i t h   w r i t e   p e r m i s s i o n 
 
 	 s e t   e o f   o f   t h e P L i s t F i l e   t o   0 
 
 	 w r i t e   t h e E m p t y P L i s t D a t a   t o   t h e P L i s t F i l e   s t a r t i n g   a t   e o f 
 
 	 c l o s e   a c c e s s   t h e P L i s t F i l e 
 
 	 
 
 e n d   C r e a t e P l i s t 
 
 
 
 o n   W r i t e P r e f s O l d ( ) 
 
 	 - -   w r i t e   k e y s   t o   t h e   p r e f e r e n c e s   f r o m   o l d e r   A p p l e S c r i p t 
 
 	 s e t   p r e f e r e n c e s F i l e P a t h   t o   ( p a t h   t o   p r e f e r e n c e s   f r o m   u s e r   d o m a i n   a s   s t r i n g )   &   p r e f s F i l e N a m e 
 
 	 C r e a t e P l i s t ( p r e f e r e n c e s F i l e P a t h ) 
 
 	 t e l l   a p p l i c a t i o n   " S y s t e m   E v e n t s " 
 
 	 	 t e l l   c o n t e n t s   o f   p r o p e r t y   l i s t   f i l e   p r e f e r e n c e s F i l e P a t h 
 
 	 	 	 s e t   v a l u e   t o   ( { | P I D s | : P I D s }   &   { | U D I D s | : U D I D s }   &   { | A n d r o i d K e y s | : A n d r o i d K e y L i s t }   &   { | K i n d l e S e r i a l s | : K i n d l e S e r i a l L i s t }   &   { | K i n d l e K e y s | : K i n d l e K e y L i s t }   &   { | b n K e y s | : b n K e y s }   &   { | A d e p t K e y s | : A d e p t K e y L i s t }   &   { | O u t p u t F o l d e r | : o u t p u t F o l d e r } ) 
 
 	 	 	 
 
 	 	 e n d   t e l l 
 
 	 e n d   t e l l 
 
 e n d   W r i t e P r e f s O l d 
 
 
 
 o n   W r i t e P r e f s ( ) 
 
 	 i f   o l d A p p l e S c r i p t   t h e n 
 
 	 	 W r i t e P r e f s O l d ( ) 
 
 	 e l s e 
 
 	 	 - -   w r i t e   k e y s   t o   t h e   p r e f e r e n c e s   f o r   A p p l e S c r i p t   2 . 0   a n d   l a t e r 
 
 	 	 s e t   p r e f e r e n c e s F i l e P a t h   t o   ( p a t h   t o   p r e f e r e n c e s   f r o m   u s e r   d o m a i n   a s   s t r i n g )   &   p r e f s F i l e N a m e 
 
 	 	 - -   w e   s t i l l   n e e d   t o   c r e a t e   a n   e m p t y   f i l e   i n   Y o s e m i t e ,   a p p a r e n t l y 
 
 	 	 C r e a t e P l i s t ( p r e f e r e n c e s F i l e P a t h ) 
 
 	 	 t e l l   a p p l i c a t i o n   " S y s t e m   E v e n t s " 
 
 	 	 	 s e t   t h e   b a s e _ d i c t   t o   m a k e   n e w   p r o p e r t y   l i s t   i t e m   w i t h   p r o p e r t i e s   { k i n d : r e c o r d } 
 
 	 	 	 s e t   m y P r e f s   t o   m a k e   n e w   p r o p e r t y   l i s t   f i l e   w i t h   p r o p e r t i e s   { c o n t e n t s : b a s e _ d i c t ,   n a m e : p r e f e r e n c e s F i l e P a t h } 
 
 	 	 	 m a k e   n e w   p r o p e r t y   l i s t   i t e m   a t   e n d   o f   p r o p e r t y   l i s t   i t e m s   o f   c o n t e n t s   o f   m y P r e f s   w i t h   p r o p e r t i e s   { k i n d : l i s t ,   n a m e : " P I D s " ,   v a l u e : P I D s } 
 
 	 	 	 m a k e   n e w   p r o p e r t y   l i s t   i t e m   a t   e n d   o f   p r o p e r t y   l i s t   i t e m s   o f   c o n t e n t s   o f   m y P r e f s   w i t h   p r o p e r t i e s   { k i n d : l i s t ,   n a m e : " U D I D s " ,   v a l u e : U D I D s } 
 
 	 	 	 m a k e   n e w   p r o p e r t y   l i s t   i t e m   a t   e n d   o f   p r o p e r t y   l i s t   i t e m s   o f   c o n t e n t s   o f   m y P r e f s   w i t h   p r o p e r t i e s   { k i n d : l i s t ,   n a m e : " A n d r o i d K e y s " ,   v a l u e : A n d r o i d K e y L i s t } 
 
 	 	 	 m a k e   n e w   p r o p e r t y   l i s t   i t e m   a t   e n d   o f   p r o p e r t y   l i s t   i t e m s   o f   c o n t e n t s   o f   m y P r e f s   w i t h   p r o p e r t i e s   { k i n d : l i s t ,   n a m e : " K i n d l e S e r i a l s " ,   v a l u e : K i n d l e S e r i a l L i s t } 
 
 	 	 	 m a k e   n e w   p r o p e r t y   l i s t   i t e m   a t   e n d   o f   p r o p e r t y   l i s t   i t e m s   o f   c o n t e n t s   o f   m y P r e f s   w i t h   p r o p e r t i e s   { k i n d : l i s t ,   n a m e : " K i n d l e K e y s " ,   v a l u e : K i n d l e K e y L i s t } 
 
 	 	 	 m a k e   n e w   p r o p e r t y   l i s t   i t e m   a t   e n d   o f   p r o p e r t y   l i s t   i t e m s   o f   c o n t e n t s   o f   m y P r e f s   w i t h   p r o p e r t i e s   { k i n d : l i s t ,   n a m e : " b n K e y s " ,   v a l u e : b n K e y s } 
 
 	 	 	 m a k e   n e w   p r o p e r t y   l i s t   i t e m   a t   e n d   o f   p r o p e r t y   l i s t   i t e m s   o f   c o n t e n t s   o f   m y P r e f s   w i t h   p r o p e r t i e s   { k i n d : l i s t ,   n a m e : " A d e p t K e y s " ,   v a l u e : A d e p t K e y L i s t } 
 
 	 	 	 m a k e   n e w   p r o p e r t y   l i s t   i t e m   a t   e n d   o f   p r o p e r t y   l i s t   i t e m s   o f   c o n t e n t s   o f   m y P r e f s   w i t h   p r o p e r t i e s   { k i n d : s t r i n g ,   n a m e : " O u t p u t F o l d e r " ,   v a l u e : o u t p u t F o l d e r } 
 
 	 	 e n d   t e l l 
 
 	 e n d   i f 
 
 e n d   W r i t e P r e f s 
 
 
 
 
 
 o n   I n i t P r o g r e s s ( m a x c o u n t ) 
 
 	 t r y 
 
 	 	 i f   t o t a l e b o o k s   >   1   t h e n 
 
 	 	 	 l a u n c h   a p p l i c a t i o n   ( ( p a t h   t o   r e s o u r c e   " D e D R M   P r o g r e s s . a p p " )   a s   s t r i n g ) 
 
 	 	 	 t e l l   a p p l i c a t i o n   ( ( p a t h   t o   r e s o u r c e   " D e D R M   P r o g r e s s . a p p " )   a s   s t r i n g ) 
 
 	 	 	 	 a c t i v a t e 
 
 	 	 	 	 s e t   c o n t e n t s   o f    c l a s s   t e x F    " m a i n t e x t "   o f   w i n d o w   " m a i n "   t o   " D e c r y p t i n g   "   &   m a x c o u n t   &   "   e b o o k s . " 
 
 	 	 	 	 s e t   c o n t e n t s   o f    c l a s s   t e x F    " s u b t e x t "   o f   w i n d o w   " m a i n "   t o   " D e c r y p t i n g   b o o k   0 :   " 
 
 	 	 	 	 s e t    c l a s s   m a x V    o f    c l a s s   p r o I    " b a r "   o f   w i n d o w   " m a i n "   t o   m a x c o u n t 
 
 	 	 	 	 s e t    c l a s s   c o n T    o f    c l a s s   p r o I    " b a r "   o f   w i n d o w   " m a i n "   t o   0 
 
 	 	 	 e n d   t e l l 
 
 	 	 e n d   i f 
 
 	 e n d   t r y 
 
 	 
 
 e n d   I n i t P r o g r e s s 
 
 
 
 o n   P r o c e s s I t e m s ( s o m e _ i t e m s ) 
 
 	 t r y 
 
 	 	 s e t   E r r o r L i s t   t o   " " 
 
 	 	 s e t   W a r n i n g L i s t   t o   " " 
 
 	 	 s e t   C o m p l e t e d L i s t   t o   " " 
 
 	 	 s e t   E r r o r C o u n t   t o   0 
 
 	 	 s e t   W a r n i n g C o u n t   t o   0 
 
 	 	 s e t   C o m p l e t e d C o u n t   t o   0 
 
 	 	 s e t   t o t a l e b o o k s   t o   0 
 
 	 	 s e t   c o m p l e t e d e b o o k s   t o   0 
 
 	 	 r e p e a t   w i t h   t h i s _ i t e m   i n   s o m e _ i t e m s 
 
 	 	 	 i f   ( f o l d e r   o f   ( i n f o   f o r   t h i s _ i t e m )   i s   t r u e )   t h e n 
 
 	 	 	 	 t e l l   a p p l i c a t i o n   " F i n d e r "   t o   s e t   t o t a l e b o o k s   t o   t o t a l e b o o k s   +   ( c o u n t   o f   ( e v e r y   f i l e   i n   e n t i r e   c o n t e n t s   o f   f o l d e r   t h i s _ i t e m   w h o s e   n a m e   e x t e n s i o n   i s   i n   h a n d l e d E x t e n s i o n s ) ) 
 
 	 	 	 e l s e 
 
 	 	 	 	 c o u n t f i l e ( t h i s _ i t e m   a s   t e x t ) 
 
 	 	 	 e n d   i f 
 
 	 	 e n d   r e p e a t 
 
 	 	 i f   t o t a l e b o o k s   i s   1   t h e n 
 
 	 	 	 s e t   T o t a l T e x t   t o   " T h e r e   i s   1   e b o o k   t o   b e   d e c r y p t e d . " 
 
 	 	 e l s e 
 
 	 	 	 s e t   T o t a l T e x t   t o   " T h e r e   a r e   "   &   t o t a l e b o o k s   &   "   e b o o k s   t o   b e   d e c r y p t e d . " 
 
 	 	 e n d   i f 
 
 	 	 w r i t e t o l o g ( T o t a l T e x t ) 
 
 	 	 I n i t P r o g r e s s ( t o t a l e b o o k s ) 
 
 	 	 r e p e a t   w i t h   t h i s _ i t e m   i n   s o m e _ i t e m s 
 
 	 	 	 i f   t o t a l e b o o k s   >   1   a n d   n o t   P r o g r e s s A c t i v e ( )   t h e n 
 
 	 	 	 	 e x i t   r e p e a t 
 
 	 	 	 e n d   i f 
 
 	 	 	 i f   ( f o l d e r   o f   ( i n f o   f o r   t h i s _ i t e m )   i s   t r u e )   t h e n 
 
 	 	 	 	 h a n d l e f o l d e r ( t h i s _ i t e m   a s   t e x t ) 
 
 	 	 	 e l s e 
 
 	 	 	 	 h a n d l e f i l e ( t h i s _ i t e m   a s   t e x t ) 
 
 	 	 	 e n d   i f 
 
 	 	 e n d   r e p e a t 
 
 	 	 e n d P r o g r e s s ( ) 
 
 	 o n   e r r o r   e r r m s g   n u m b e r   e r r n u m 
 
 	 	 s e t   e r r o r R e p o r t   t o   " A n   u n e x p e c t e d   e r r o r   o c c u r r e d .   P l e a s e   r e p o r t   o n   A p p r e n t i c e   A l f ' s   b l o g . 
 
 
 
 E r r o r   M e s s a g e :   "   &   e r r m s g   &   " 
 
 E r r o r   N u m b e r :   "   &   e r r n u m 
 
 	 	 w r i t e t o l o g ( e r r o r R e p o r t ) 
 
 	 	 d i s p l a y   n o t i f i c a t i o n   e r r o r R e p o r t   w i t h   t i t l e   " D e D R M "   s u b t i t l e   " U n e x p e c t e d   E r r o r " 
 
 	 	 - - d i s p l a y   d i a l o g   e r r o r R e p o r t   w i t h   t i t l e   " D e D R M "   b u t t o n s   { " B o t h e r " }   d e f a u l t   b u t t o n   1   w i t h   i c o n   s t o p 
 
 	 e n d   t r y 
 
 	 i f   W a r n i n g L i s t   i s   n o t   " "   t h e n 
 
 	 	 s e t   W a r n i n g T e x t   t o   " " 
 
 	 	 i f   W a r n i n g C o u n t   i s   1   t h e n 
 
 	 	 	 s e t   W a r n i n g T e x t   t o   " T h e r e   w a s   a   w a r n i n g   w i t h   1   e b o o k : " 
 
 	 	 e l s e 
 
 	 	 	 s e t   W a r n i n g T e x t   t o   " T h e r e   w e r e   w a r n i n g s   w i t h   "   &   W a r n i n g C o u n t   &   "   e b o o k s : " 
 
 	 	 e n d   i f 
 
 	 	 w r i t e t o l o g ( W a r n i n g T e x t ) 
 
 	 	 w r i t e t o l o g ( W a r n i n g L i s t ) 
 
 	 	 - - s e t   d i a l o g r e s u l t   t o   d i s p l a y   d i a l o g   W a r n i n g T e x t   &   " 
 
 	 	 
 
 	 	 - - "   &   W a r n i n g L i s t   b u t t o n s   { " O K " }   w i t h   t i t l e   " D e D R M "   d e f a u l t   b u t t o n   1 
 
 	 	 d i s p l a y   n o t i f i c a t i o n   W a r n i n g L i s t   w i t h   t i t l e   " D e D R M "   s u b t i t l e   W a r n i n g T e x t 
 
 	 e n d   i f 
 
 	 i f   E r r o r L i s t   i s   n o t   " "   t h e n 
 
 	 	 s e t   E r r o r T e x t   t o   " " 
 
 	 	 i f   E r r o r C o u n t   i s   1   t h e n 
 
 	 	 	 s e t   E r r o r T e x t   t o   " T h e r e   w a s   a n   e r r o r   w i t h   1   e b o o k : " 
 
 	 	 e l s e 
 
 	 	 	 s e t   E r r o r T e x t   t o   " T h e r e   w e r e   e r r o r s   w i t h   "   &   E r r o r C o u n t   &   "   e b o o k s : " 
 
 	 	 e n d   i f 
 
 	 	 w r i t e t o l o g ( E r r o r T e x t ) 
 
 	 	 w r i t e t o l o g ( E r r o r L i s t ) 
 
 	 	 - - s e t   d i a l o g r e s u l t   t o   d i s p l a y   d i a l o g   E r r o r T e x t   &   " 
 
 	 	 
 
 	 	 - - "   &   E r r o r L i s t   b u t t o n s   { " B o t h e r " }   w i t h   t i t l e   " D e D R M "   d e f a u l t   b u t t o n   1 
 
 	 	 d i s p l a y   n o t i f i c a t i o n   E r r o r L i s t   w i t h   t i t l e   " D e D R M "   s u b t i t l e   E r r o r T e x t 
 
 	 e n d   i f 
 
 	 i f   C o m p l e t e d C o u n t   >   0   t h e n 
 
 	 	 s e t   C o m p l e t e d T e x t   t o   " " 
 
 	 	 i f   C o m p l e t e d C o u n t   i s   1   t h e n 
 
 	 	 	 s e t   C o m p l e t e d T e x t   t o   " S u c c e s s f u l l y   d e - d r m e d   1   e b o o k : " 
 
 	 	 e l s e 
 
 	 	 	 s e t   C o m p l e t e d T e x t   t o   " S u c c e s s f u l l y   d e - d r m e d   "   &   C o m p l e t e d C o u n t   &   "   e b o o k s : " 
 
 	 	 e n d   i f 
 
 	 	 w r i t e t o l o g ( C o m p l e t e d T e x t ) 
 
 	 	 w r i t e t o l o g ( C o m p l e t e d L i s t ) 
 
 	 	 - - s e t   d i a l o g r e s u l t   t o   d i s p l a y   d i a l o g   C o m p l e t e d T e x t   &   " 
 
 	 	 
 
 	 	 - - "   &   C o m p l e t e d L i s t   b u t t o n s   { " T h a n k s " }   w i t h   t i t l e   " D e D R M "   d e f a u l t   b u t t o n   1 
 
 	 	 d i s p l a y   n o t i f i c a t i o n   C o m p l e t e d L i s t   w i t h   t i t l e   " D e D R M "   s u b t i t l e   C o m p l e t e d T e x t 
 
 	 e n d   i f 
 
 	 r e t u r n   C o m p l e t e d C o u n t   +   W a r n i n g C o u n t   +   E r r o r C o u n t 
 
 e n d   P r o c e s s I t e m s 
 
 
 
 o n   P r o g r e s s A c t i v e ( ) 
 
 	 t e l l   a p p l i c a t i o n   " S y s t e m   E v e n t s "   t o   s e t   p r o g a c t i v e   t o   c o u n t   ( e v e r y   p r o c e s s   w h o s e   n a m e   i s   " D e D R M   P r o g r e s s " ) 
 
 	 i f   p r o g a c t i v e   >   0   t h e n   r e t u r n   t r u e 
 
 	 r e t u r n   f a l s e 
 
 e n d   P r o g r e s s A c t i v e 
 
 
 
 o n   I n c P r o g r e s s ( b o o k t i t l e ,   d o i n g c o u n t ) 
 
 	 t r y 
 
 	 	 i f   P r o g r e s s A c t i v e ( )   t h e n 
 
 	 	 	 t e l l   a p p l i c a t i o n   ( ( p a t h   t o   r e s o u r c e   " D e D R M   P r o g r e s s . a p p " )   a s   s t r i n g ) 
 
 	 	 	 	 s e t   c o n t e n t s   o f    c l a s s   t e x F    " s u b t e x t "   o f   w i n d o w   " m a i n "   t o   " D e c r y p t i n g   b o o k   "   &   d o i n g c o u n t   &   " :   "   &   b o o k t i t l e 
 
 	 	 	 	 s e t    c l a s s   c o n T    o f    c l a s s   p r o I    " b a r "   o f   w i n d o w   " m a i n "   t o   d o i n g c o u n t 
 
 	 	 	 e n d   t e l l 
 
 	 	 e n d   i f 
 
 	 e n d   t r y 
 
 e n d   I n c P r o g r e s s 
 
 
 
 o n   e n d P r o g r e s s ( ) 
 
 	 t r y 
 
 	 	 i f   P r o g r e s s A c t i v e ( )   t h e n   t e l l   a p p l i c a t i o n   ( ( p a t h   t o   r e s o u r c e   " D e D R M   P r o g r e s s . a p p " )   a s   s t r i n g )   t o   q u i t 
 
 	 e n d   t r y 
 
 e n d   e n d P r o g r e s s 
 
 
 
 
 
 o n   r u n 
 
 	 i f   G e t T o o l s ( )   t h e n 
 
 	 	 R e a d P r e f s ( ) 
 
 	 	 c l e a r l o g ( ) 
 
 	 	 r e p e a t 
 
 	 	 	 s e t   d i a l o g r e s u l t   t o   d i s p l a y   d i a l o g   " T o   r e m o v e   D R M   f r o m   a n   e b o o k ,   c l i c k    S e l e c t   E b o o k &  
 
 T o   c o n f i g u r e   t h i s   s o f t w a r e ,   c l i c k    C o n f i g u r e &  
 
 
 
 W h e n   t h e   D e D R M   a p p l i c a t i o n   i s   n o t   r u n n i n g ,   y o u   c a n   a l s o   r e m o v e   D R M   f r o m   e b o o k s   b y   d r o p p i n g   t h e m   o n t o   t h e   D e D R M   a p p l i c a t i o n   i c o n   i n   t h e   F i n d e r . 
 
 
 
 F o r   d e t a i l s   o f   t h e   e b o o k   f o r m a t s     w h i c h   t h i s   a p p l i c a t i o n   c a n   h a n d l e ,   s e e   t h e   R e a d M e   f i l e   o r   v i s i t   h t t p : / / a p p r e n t i c e a l f . w o r d p r e s s . c o m / 
 
 P l e a s e   o n l y   u s e   t h i s   a p p l i c a t i o n   o n   y o u r   o w n   b o o k s .   A u t h o r s ,   p u b l i s h e r s   a n d   e b o o k   s t o r e s   n e e d   t o   m a k e   m o n e y   t o   p r o d u c e   m o r e   e b o o k s . 
 
 D o n ' t   c h e a t   t h e m . 
 
 
 
 T h i s   a p p l i c a t i o n   i s   b y   A p p r e n t i c e   A l f   a n d   A p p r e n t i c e   H a r p e r   b a s e d   o n   a n   A p p l e S c r i p t   s c r i p t   b y   P a u l   D u r r a n t   a n d   u s e s   p y t h o n   s c r i p t s   p r o d u c e d   b y   A p p r e n t i c e   A l f ,   C M B D T C ,   T h e   D a r k   R e v e r s e r ,   D i a p D e a l e r ,   i e&c a b b a g e s ,   s o m e _ u p d a t e s ,   A p p r e n t i c e   H a r p e r   a n d   o t h e r s . 
 
 T h e   A p p l e S c r i p t   p a r t   o f   t h i s   a p p l i c a t i o n   i s   f r e e   s o f t w a r e   r e l e a s e d   i n t o   t h e   p u b l i c   d o m a i n ,   s e e   h t t p : / / u n l i c e n s e . o r g / 
 
 T h e   a p p l i c a t i o n   i c o n   i s   a d a p t e d   f r o m   t h e   A u t h o r s   A g a i n s t   D R M   l o g o   a t 
 
 h t t p : / / r e a d e r s b i l l o f r i g h t s . i n f o / A A D   a n d   i s   u n d e r   t h e   C r e a t i v e   C o m m o n s   A t t r i b u t i o n - S h a r e A l i k e   l i c e n c e . 
 
 
 
 T h e   i n c l u d e d   P y t h o n   s c r i p t s   a r e   a l l   f r e e   t o   u s e ,   b u t   h a v e   a   v a r i e t y   o f   l i c e n c e s .   S e e   t h e   i n d i v i d u a l   f i l e s   f o r   d e t a i l s . 
 
 "   w i t h   t i t l e   " D e D R M   b y   A p p r e n t i c e   A l f "   b u t t o n s   { " Q u i t " ,   " S e l e c t   E b o o k &                                                                             " ,   " C o n f i g u r e &                                                                             " }   d e f a u l t   b u t t o n   1   w i t h   i c o n   n o t e 
 
 	 	 	 i f   b u t t o n   r e t u r n e d   o f   d i a l o g r e s u l t   i s   " Q u i t "   t h e n   e x i t   r e p e a t 
 
 	 	 	 i f   b u t t o n   r e t u r n e d   o f   d i a l o g r e s u l t   i s   " S e l e c t   E b o o k &                                                                             "   t h e n 
 
 	 	 	 	 s e t   D R M e b o o k   t o   " " 
 
 	 	 	 	 t r y 
 
 	 	 	 	 	 s e t   D R M e b o o k   t o   { c h o o s e   f i l e   w i t h   p r o m p t   " P l e a s e   s e l e c t   a   D R M e d   e b o o k " } 
 
 	 	 	 	 e n d   t r y 
 
 	 	 	 	 i f   D R M e b o o k   i s   n o t   " "   t h e n 
 
 	 	 	 	 	 i f   P r o c e s s I t e m s ( D R M e b o o k )   i s   0   t h e n 
 
 	 	 	 	 	 	 d i s p l a y   d i a l o g   " T h a t   w a s   a   f i l e   t h a t   t h i s   s c r i p t   c a n n o t   p r o c e s s . "   w i t h   t i t l e   " D e D R M "   b u t t o n s   { " O K " }   d e f a u l t   b u t t o n   1   w i t h   i c o n   n o t e 
 
 	 	 	 	 	 e n d   i f 
 
 	 	 	 	 	 W r i t e P r e f s ( ) 
 
 	 	 	 	 e n d   i f 
 
 	 	 	 e l s e 
 
 	 	 	 	 s e t   c h o i c e   t o   t r u e 
 
 	 	 	 	 r e p e a t   w h i l e   c h o i c e   i s   n o t   f a l s e 
 
 	 	 	 	 	 s e t   c h o i c e   t o   c h o o s e   f r o m   l i s t   { " e I n k   K i n d l e   e B o o k s " ,   " B a r n e s   a n d   N o b l e   ( n o o k )   e b o o k s " ,   " M o b i p o c k e t   e B o o k s " ,   " e R e a d e r   e b o o k s " ,   " A d o b e   D i g i t a l   E d i t i o n s   e b o o k s " ,   " K i n d l e   f o r   M a c   e b o o k s " ,   " O u t p u t   F o l d e r " }   w i t h   p r o m p t   " C h o o s e   a   C o n f i g u r a t i o n   O p t i o n : "   w i t h   t i t l e   " D e D R M   C o n f i g u r a t i o n "   O K   b u t t o n   n a m e   " C o n f i g u r e . . . "   c a n c e l   b u t t o n   n a m e   " F i n i s h e d " 
 
 	 	 	 	 	 i f   c h o i c e   c o n t a i n s   " B a r n e s   a n d   N o b l e   ( n o o k )   e b o o k s "   t h e n 
 
 	 	 	 	 	 	 G e t B N K e y s ( " D e D R M   C o n f i g u r e   f o r   B a r n e s   a n d   N o b l e   ( n o o k ) " ) 
 
 	 	 	 	 	 e l s e   i f   c h o i c e   c o n t a i n s   " e I n k   K i n d l e   e B o o k s "   t h e n 
 
 	 	 	 	 	 	 G e t S e r i a l s ( " D e D R M   C o n f i g u r e   f o r   e I n k   K i n d l e " ) 
 
 	 	 	 	 	 e l s e   i f   c h o i c e   c o n t a i n s   " M o b i p o c k e t   e B o o k s "   t h e n 
 
 	 	 	 	 	 	 G e t P I D s ( " D e D R M   C o n f i g u r e   f o r   M o b i p o c k e t " ) 
 
 	 	 	 	 	 e l s e   i f   c h o i c e   c o n t a i n s   " e R e a d e r   e b o o k s "   t h e n 
 
 	 	 	 	 	 	 G e t e R e a d e r K e y s ( " D e D R M   C o n f i g u r e   f o r   e R e a d e r " ) 
 
 	 	 	 	 	 e l s e   i f   c h o i c e   c o n t a i n s   " K i n d l e   f o r   M a c   e b o o k s "   t h e n 
 
 	 	 	 	 	 	 G e t K i n d l e K e y F i l e s ( " D e D R M   C o n f i g u r e   K i n d l e   f o r   M a c " ) 
 
 	 	 	 	 	 e l s e   i f   c h o i c e   c o n t a i n s   " K i n d l e   f o r   A n d r o i d   e b o o k s "   t h e n 
 
 	 	 	 	 	 	 G e t A n d r o i d K e y F i l e s ( " D e D R M   C o n f i g u r e   K i n d l e   f o r   A n d r o i d " ) 
 
 	 	 	 	 	 e l s e   i f   c h o i c e   c o n t a i n s   " A d o b e   D i g i t a l   E d i t i o n s   e b o o k s "   t h e n 
 
 	 	 	 	 	 	 G e t A d e p t K e y F i l e s ( " D e D R M   C o n f i g u r e   A d o b e   D i g i t a l   E d i t i o n s " ) 
 
 	 	 	 	 	 e l s e   i f   c h o i c e   c o n t a i n s   " O u t p u t   F o l d e r "   t h e n 
 
 	 	 	 	 	 	 G e t O u t p u t F o l d e r ( " D e D R M   C o n f i g u r e   O u t p u t   F o l d e r " ) 
 
 	 	 	 	 	 e n d   i f 
 
 	 	 	 	 e n d   r e p e a t 
 
 	 	 	 	 W r i t e P r e f s ( ) 
 
 	 	 	 e n d   i f 
 
 	 	 e n d   r e p e a t 
 
 	 e n d   i f 
 
 e n d   r u n 
 
 
 
 o n   o p e n   s o m e _ i t e m s 
 
 	 - - d i s p l a y   d i a l o g   ( s o m e _ i t e m s   a s   t e x t ) 
 
 	 i f   G e t T o o l s ( )   t h e n 
 
 	 	 R e a d P r e f s ( ) 
 
 	 	 c l e a r l o g ( ) 
 
 	 	 
 
 	 	 i f   P r o c e s s I t e m s ( s o m e _ i t e m s )   i s   0   t h e n 
 
 	 	 	 d i s p l a y   n o t i f i c a t i o n   " N o   e b o o k s   f o u n d   i n   t h e   d r o p p e d   i t e m s .   D e D R M   c a n   h a n d l e   M o b i p o c k e t ,   K i n d l e ,   e R e a d e r ,   A d o b e   e P u b ,   B a r n e s   &   N o b l e   e P u b   a n d   A d o b e   P D F .   P l e a s e   t r y   a g a i n . "   w i t h   t i t l e   " D e D R M " 
 
 	 	 e n d   i f 
 
 	 	 W r i t e P r e f s ( ) 
 
 	 	 d e l a y   1   - - >   a l l o w   t i m e   f o r   a n y   n o t i f i c a t i o n s   t o   t r i g g e r 
 
 	 e n d   i f 
 
 e n d   o p e n 
 
 
 
 