Help please! Another Finder Error

Hi,
The script below is designed to backup files from the source area to the backup area preserving the folder hierarchy. While I’m sure it could be written better, it seems to work until it encounters a particular folder containing a file, when I get the following Finder error shown below. At this point it has already done approximately 60 files in about 10 folders. If I remove the file from the folder the script will continue processing a further 300 files and sub-folders before getting the same error on another folder/file.
Can someone explain what the error means? Any comments or suggestions to improve the script would be welcome.
tell application "Finder"
get every item of folder (alias "Macintosh HD:Users:andy:Documents:NetXxx II:Customers:Lxxxx Bxxxxxh Cxxxxxl:")
{alias "Macintosh HD:Users:andy:Documents:NetXxx II:Customers:Lxxxx Bxxxxxh Cxxxxxl:Pen Testing Brief 2005.doc"}
"Can't make alias \"Macintosh HD:Users:andy:Documents:NetXxx II:Customers:Lxxxx Bxxxxxh Cxxxxxl::Pen Testing Brief 2005.doc\" into type «class alst»."
-- Backup Script.
-- This script will attempt to backup the specified folder(s) and all sub-folders to the external disk
-- drive. It duplicates the folder sub-folder hierarchy in the backup area.
-- If a previous backup of the file exists in the backup directory it is renamed to
-- 'filename-yy-mm-dd (hhmmss).extension' where yy-mm-dd and hhmmss are taken from
-- the modification date of the file in the backup directory.
on run
-- Get the path to the desktop for the log file.
set desktopPath to (path to desktop from user domain) as string
-- Get the current date and time formatted.
set thisDateAndTime to get current date
tell me
formatDateAndTime(thisDateAndTime)
set thatDateAndTime to result
end tell
-- Compile the name for the log file.
set backupLogPath to desktopPath & "Backup Log" & thatDateAndTime & ".txt"
-- Create and open the log file.
try
set backupLogFile to (open for access file backupLogPath with write permission)
end try
set backupLog to backupLogFile
-- Write a starting message to the log file.
set logMsg to "Backup Starting..." as string
append2BackupLog(logMsg)
-- Define the global variables.
global backupLog -- The file specification of the backup log file.
global backupPath -- Top level folder for the backup.
global topSourceFolder -- The top level source folder name without the proceeding path.
global sourceFileName -- Source file name but not the path.
global sourceFileExtension -- Get the file extension.
-- Define the backup folder to receive the backups.
set backupPath to "ANDY:Business:Backups:" as text
-- Define the folder to be backed up (the source folder).
set sourceFolder to (path to home folder from user domain) as text
set sourceFolder to (sourceFolder & "Documents:NetXxx II:")
set topSourceFolder to "NetXxx II" as text
-- Process the folder.
processAFolder(sourceFolder)
-- All done so write a final entry, close the log file and return.
set logMsg to "Backup Ending..."
append2BackupLog(logMsg)
close access backupLogFile
end run
-- This routine process each file in the specified folder.
on processAFolder(theFolder)
-- Declare the global variables we reference.
global sourceFileName -- Source file name but not the path.
global sourceFileExtension -- Get the file extension.
-- Write a message to the log file that we are processing the folder.
set logMsg to "Processing folder " & theFolder
append2BackupLog(logMsg)
tell application "Finder"
-- Get a list of everything in the specified folder.
set allItems to every item of folder theFolder as alias list
repeat with eachItem in allItems
-- Check if this is a folder file.
set fileInfo to info for eachItem
set thisClass to kind of fileInfo as text
if thisClass is equal to "Folder" then
-- We have a another folder so do a recursive call.
tell me
processAFolder(eachItem)
end tell
else
-- Store the file information we will need in processAFile() in the global variables.
set fileName to eachItem as text
set sourceFileName to name of fileInfo as text -- Get the file name but not the path.
set sourceFileExtension to name extension of fileInfo as text -- Get the file extension.
-- Now process the file.
tell me
processAFile(fileName)
end tell
end if
end repeat
end tell
end processAFolder
-- This routine processes the specified file.
on processAFile(fileName)
-- Define the global variables referenced in this script.
global topSourceFolder -- The top folder to be backed up.
global backupPath -- The top folder in the backup area.
global sourceFileName -- Source file name but not the path.
global sourceFileExtension -- Get the file extension.
-- Get the folder paths from topSourceFolder downwards to the current folder.
set currentBackupFolderPath to ""
set folderTree to ""
set addFolder to false
set savedTID to AppleScript's text item delimiters
set AppleScript's text item delimiters to {":"}
tell application "Finder"
repeat with iFolder in text items of fileName
set thisFolder to iFolder as text
if (thisFolder is equal to topSourceFolder) then
set addFolder to true -- We are now at the top of the tree so start adding the folder names to the folder tree.
end if
if thisFolder is equal to sourceFileName then
set addFolder to false -- As its the current file name we don't want it in the folder tree.
end if
if addFolder is true then
-- While were at it check that the folder exists in the backup area.
set backupFolder to backupPath & folderTree & thisFolder
set backupFolderExists to (folder backupFolder exists)
if backupFolderExists is equal to false then
-- It does not exist so create the folder in the backup area.
set backupFolderPath to backupPath & folderTree as file specification
make new folder at folder backupFolderPath with properties {name:thisFolder}
end if
-- Add the folder to the folder tree.
set folderTree to folderTree & thisFolder & ":"
end if
end repeat
set AppleScript's text item delimiters to savedTID
-- Set the backup folder path.
set backupFolder to (backupPath & folderTree)
-- check if the files exist
set sourceFileExists to (file fileName exists)
set backupFileExists to (file sourceFileName of folder backupFolder exists)
-- Backup the file to the required backup folder.
if sourceFileExists and not backupFileExists then
-- File did not exist in the backup directory so copy it there.
duplicate file fileName to folder backupFolder
-- Write a log file entry for the file.
set logMsg to "Backup of " & fileName
tell me
append2BackupLog(logMsg)
end tell
else
-- Both files exist, so check if the file in the source folder is newer.
if (modification date of file fileName) > (modification date of file sourceFileName of folder backupFolder) then
-- We need to rename the old backup file before we make a backup copy of the newer file.
set thisDateAndTime to modification date of file sourceFileName of folder backupFolder
-- Get the current date and time formatted.
tell me
formatDateAndTime(thisDateAndTime)
set thatDateAndTime to result
end tell
-- We need to get the file name minus the extension.
set oldTID to AppleScript's text item delimiters -- Get the current text item delimiters (TIDs).
set AppleScript's text item delimiters to {"."} -- Set them to ".".
set justFileName to first text item of sourceFileName -- Get the filename before the "."
set AppleScript's text item delimiters to oldTID -- Restore the TIDs to what they were.
-- Build the new file name for the old backup file.
set newFileName to justFileName & thatDateAndTime & "." & sourceFileExtension
-- Rename the file in the backup area and take a copy of the newer file.
set name of file (sourceFileName as text) of folder backupFolder to newFileName
duplicate file fileName to folder backupFolder
-- Write the log file entry's for the file rename and the file backup.
tell me
set logMsg to "Renamed old backup file to " & newFileName
append2BackupLog(logMsg)
set logMsg to "Backup of " & fileName
append2BackupLog(logMsg)
end tell
end if
end if
end tell
end processAFile
-- Format the specified date & time into a string of the form "dd-mm-yy (hhmmss)".
on formatDateAndTime(thisDateAndTime)
set dateString to short date string of thisDateAndTime
set timeString to time string of thisDateAndTime
set fileDateString to "" as text
repeat with iWord in words of dateString
set fileDateString to fileDateString & "-"
if length of iWord is 2 then
set fileDateString to fileDateString & iWord as text
end if
if length of iWord is 1 then
-- Pad single digits out with a leading zero.
set fileDateString to fileDateString & "0" & iWord as text
end if
end repeat
-- Format the time into "(hhmmss)".
set fileTimeString to " (" as text
repeat with iTime in words of timeString
set fileTimeString to fileTimeString & iTime as text
end repeat
set fileTimeString to fileTimeString & ")" as text
-- Set the return parameter to the result and return.
set thatDateAndTime to fileDateString & fileTimeString
end formatDateAndTime
-- This routine writes the specified message to the end of the log file.
-- NOTE - the log file is assumed to be already open with write access.
on append2BackupLog(logMsg)
global backupLog -- Global variable that defines the path to the log file.
-- Get the current date and time formatted.
set dateString to short date string of (get current date) & space & time string of (get current date)
try
write (dateString & " " & logMsg & return as text) to backupLog starting at eof
end try
end append2BackupLog
15" MacBook Pro 2.16GHz, 2GB Ram   Mac OS X (10.4.8)  

Hello
I was forced to stop my running script so I was able to look at your script/
Here is a modified version. I didn't check it.
-- Backup Script.
-- This script will attempt to backup the specified folder(s) and all sub-folders to the external disk
-- drive. It duplicates the folder sub-folder hierarchy in the backup area.
-- If a previous backup of the file exists in the backup directory it is renamed to
-- 'filename-yy-mm-dd (hhmmss).extension' where yy-mm-dd and hhmmss are taken from
-- the modification date of the file in the backup directory.
on run
-- Get the path to the desktop for the log file.
set desktopPath to (path to desktop from user domain) as string
-- Get the current date and time formatted.
set thisDateAndTime to get current date
set thatDateAndTime to my formatDateAndTime(thisDateAndTime)
-- Create and open the log file.
try
set backupLogFile to (open for access file (desktopPath & "Backup Log" & thatDateAndTime & ".txt") with write permission)
on error
display dialog "something failed !"
end try
set backupLog to backupLogFile
-- Write a starting message to the log file.
my append2BackupLog("Backup Starting..." as string)
-- Define the global variables.
global backupLog -- The file specification of the backup log file. -- Is it correct to define backupLog as global AFTER setting its value ???
global backupPath -- Top level folder for the backup.
global topSourceFolder -- The top level source folder name without the proceeding path.
global sourceFileName -- Source file name but not the path.
global sourceFileExtension -- Get the file extension.
-- Define the backup folder to receive the backups.
set backupPath to "ANDY:Business:Backups:" as text
-- Define the folder to be backed up (the source folder).
set topSourceFolder to "NetXxx II" as text
-- Process the folder.
my processAFolder(((path to home folder from user domain) as text) & "Documents:" & topSourceFolder & ":")
-- All done so write a final entry, close the log file and return.
my append2BackupLog("Backup Ending...")
close access backupLogFile
end run
-- This routine process each file in the specified folder.
on processAFolder(theFolder)
-- Declare the global variables we reference.
global sourceFileName -- Source file name but not the path.
global sourceFileExtension -- Get the file extension.
-- Write a message to the log file that we are processing the folder.
my append2BackupLog("Processing folder " & theFolder)
tell application "Finder"
-- Get a list of everything in the specified folder.
set allItems to every item of folder theFolder as alias list
repeat with eachItem in allItems
-- Check if this is a folder file.
if (class of item eachItem) is folder then
-- We have a another folder so do a recursive call.
my processAFolder(eachItem as text)
else
-- Store the file information we will need in processAFile() in the global variables.
set eachItem to eachItem as alias
set sourceFileName to name of eachItem -- Get the file name but not the path.
set sourceFileExtension to name extension of eachItem -- Get the file extension.
-- Now process the file.
my processAFile(eachItem as text)
end if
end repeat
end tell
end processAFolder
-- This routine processes the specified file.
on processAFile(fileName)
-- Define the global variables referenced in this script.
global topSourceFolder -- The top folder to be backed up.
global backupPath -- The top folder in the backup area.
global sourceFileName -- Source file name but not the path.
global sourceFileExtension -- Get the file extension.
-- Get the folder paths from topSourceFolder downwards to the current folder.
set currentBackupFolderPath to ""
set folderTree to ""
set addFolder to false
set savedTID to AppleScript's text item delimiters
set AppleScript's text item delimiters to {":"}
tell application "Finder"
repeat with iFolder in text items of fileName
set thisFolder to iFolder as text
if (thisFolder is equal to topSourceFolder) then set addFolder to true -- We are now at the top of the tree so start adding the folder names to the folder tree.
if thisFolder is equal to sourceFileName then set addFolder to false -- As its the current file name we don't want it in the folder tree.
if addFolder is true then
-- While were at it check that the folder exists in the backup area.
set backupFolder to backupPath & folderTree & thisFolder
set backupFolderExists to (folder backupFolder exists)
if backupFolderExists is equal to false then
-- It does not exist so create the folder in the backup area.
set backupFolderPath to backupPath & folderTree as file specification
make new folder at folder backupFolderPath with properties {name:thisFolder}
end if
-- Add the folder to the folder tree.
set folderTree to folderTree & thisFolder & ":"
end if
end repeat
set AppleScript's text item delimiters to savedTID
-- Set the backup folder path.
set backupFolder to (backupPath & folderTree)
-- check if the files exist
set sourceFileExists to (file fileName exists)
set backupFileExists to (file sourceFileName of folder backupFolder exists)
-- Backup the file to the required backup folder.
if sourceFileExists and not backupFileExists then
-- File did not exist in the backup directory so copy it there.
duplicate file fileName to folder backupFolder
-- Write a log file entry for the file.
my append2BackupLog("Backup of " & fileName)
else
-- Both files exist, so check if the file in the source folder is newer.
if (modification date of file fileName) > (modification date of file sourceFileName of folder backupFolder) then
-- We need to rename the old backup file before we make a backup copy of the newer file.
set thisDateAndTime to modification date of file sourceFileName of folder backupFolder
-- Get the current date and time formatted.
set thatDateAndTime to my formatDateAndTime(thisDateAndTime)
-- We need to get the file name minus the extension.
set oldTID to AppleScript's text item delimiters -- Get the current text item delimiters (TIDs).
set AppleScript's text item delimiters to {"."} -- Set them to ".".
set justFileName to first text item of sourceFileName -- Get the filename before the "."
set AppleScript's text item delimiters to oldTID -- Restore the TIDs to what they were.
-- Build the new file name for the old backup file.
set newFileName to justFileName & thatDateAndTime & "." & sourceFileExtension
-- Rename the file in the backup area and take a copy of the newer file.
set name of file (sourceFileName as text) of folder backupFolder to newFileName
duplicate file fileName to folder backupFolder
-- Write the log file entry's for the file rename and the file backup.
my append2BackupLog("Renamed old backup file to " & newFileName)
my append2BackupLog("Backup of " & fileName)
end if
end if
end tell
end processAFile
-- Format the specified date & time into a string of the form "dd-mm-yy (hhmmss)".
on formatDateAndTime(thisDateAndTime)
set dateString to short date string of thisDateAndTime
set timeString to time string of thisDateAndTime
set fileDateString to "" as text
repeat with iWord in words of dateString
set fileDateString to fileDateString & "-" & text -2 thru -1 of ("0" & iWord)
end repeat
-- Format the time into "(hhmmss)".
set fileTimeString to " (" as text
repeat with iTime in words of timeString
set fileTimeString to fileTimeString & iTime as text
end repeat
set fileTimeString to fileTimeString & ")" as text
-- Set the return parameter to the result and return.
return fileDateString & fileTimeString
end formatDateAndTime
-- This routine writes the specified message to the end of the log file.
-- NOTE - the log file is assumed to be already open with write access.
on append2BackupLog(logMsg)
global backupLog -- Global variable that defines the path to the log file.
-- Get the current date and time formatted.
set dateString to short date string of (get current date) & space & time string of (get current date)
try
write (dateString & " " & logMsg & return as text) to backupLog starting at eof
end try
end append2BackupLog
Yvan KOENIG (from FRANCE samedi 3 mars 2007 21:23:33)

Similar Messages

  • Help please no sound ,error code

    [size="3" face="comic sans ms,sans-serif">Help please am having trouble with my X-FI card...
    [size="3" face="Comic Sans MS">?
    Sound Devices
    ??? Description: SB X-Fi Audio [7C00]
    ?Default Sound Playback: Yes
    ?Default Voice Playback: No
    ??? Hardware ID: PCI\VEN_02&DEV_0005&SUBSYS_002902&REV_00
    ?? Manufacturer ID:
    ?? Product ID: 00
    ??? Type: WDM
    ??? Driver Name: ctaud2k.sys
    ?? Driver Version: 6.00.000.368 (English)
    ?? Driver Attributes: Final Retail
    ??? WHQL Logo'd: n/a
    ?? Date and Size: 0/8/2008 0:2:50, 526232 bytes
    ??? Other Files:
    ?? Driver Provider: Creative
    ?? HW Accel Level: Full
    ??? Cap Flags: 0x0
    ? Min/Max Sample Rate: 0, 0
    Static/Strm HW Mix Bufs: 0, 0
    ?Static/Strm HW 3D Bufs: 0, 0
    ??? HW Memory: 0
    ? Voice Management: Yes
    ?EAX(tm) 2.0 Listen/Src: Yes, Yes
    ? I3DL2(tm) Listen/Src: No, No
    Sensaura(tm) ZoomFX(tm): No
    ??? Registry: OK
    ?? Sound Test Result: Failure at step 9 (User verification of software): HRESULT = 0x00000000 (error code)
    [size="3" face="comic sans ms,sans-serif">Can anyone help me with this problem?.. Thank you..

    $Hi Clayp,
    You will have a higher chance of getting a
    reply if you could describe when did this error code appear and what
    were you doing when this happened. If you need help from Customer
    Support, you can contact them using the email form here.

  • HELP PLEASE! iMovie error message "_Sync_" couldn't be removed.

    HELP PLEASE! I had to force shutdown my computer and now my iMovie Library won't open. I just get this error message: "_Sync_" couldn't be removed.
    I was working on a movie within in iMovie and my computer was running really slow so I decided to shut it down for a little while. It wouldn't shut down and went to the gray shutdown screen and stayed there for a while so I held down the power button to force the shutdown. Now when i reopened iMovie my library that i created on an external harddrive won't open.
    I can see the folders for the movies on my external harddrive but I dont even know how to open them separately from the program. The ".imovieevent" files won't even give me the option to open them or import them into iMovie.

    Were you able to fix this? I have the same message now.

  • Help Please (523:523) error.

    Hi, I am receiving the error message "There is a problem with Adobe Acrobat/Reader if it is running please exit and try again (523:523). Please help urgently.
    I am not sure how to get Adobe out of protected mode if it is on or disable like some previous comments on the (523:523) error have stated.
    Thanks Katie

    Ok, let's try to disable Protected Mode.  Open Adobe Reader from the desktop icon; Edit | Preferences | Security (Advanced):
    uncheck Enable Protected Mode at startup
    set Protected View to Off

  • Help Please!! Error -1?

    When I install the IPOD disc onto my computer, all the things install except for quicktime. A error code comes up it says "Quicktime installation failed Error Code: -1.....anyone have any ideas on how I can fix this? Please help me.

    duplicate post http://forums.ni.com/t5/Instrument-Control-GPIB-Serial/Error-1-occurred-at-Scan-From-String-arg-1/td...

  • HELP please. nokia 5200 error

    Can somebody help me please.
    When I try to add a detail on one of my contacts, like another phone number, email, image, etc; this message apears: "Operation failed" and I can't add it. I don't know what else to do, I tried restoring the default settings, but I still have the message. help me please

    Are you storing you contacts on the phone memory or sim card ?

  • Sql help please with, finding all zip codes within a given radius.

    I have a table which contains zip, city, state, latdec, longdec, latrad, longrad.
    From search screen, if user want, zip code's within 10 mile radius of his zip code, what is the sql. I came up with following sql but it is not correct:
    first, find his latdec long dec from his zipcode. Then add radius to those values and do select as follows:
    select zip,
    latdec, longdec,
    city, state, latrad, longrad
    from zip_coord
    where latdec >= (latdec - 10)
    and latdec <= (latdec + 10)
    and longdec >= (longdec - 10)and longdec <= (longdec + 10).
    I think i need to include radians too, but i'm not able to come up with logical formula.
    I would appreciate any help with this topic.
    Thanks in advance

    gautam ,
    u probably need to use oracle spatial option and store geoCodes for each address as a column in the address table . then doing this will be easy

  • HELP PLEASE w/ utPLSQL error

    I am running some unit tests, and I keep getting this error.
    UT_FOR_LOOPS_TEST: Unable to run ut_ppkg_interaction.UT_FOR_LOOPS_TEST: ORA-00001: unique constraint (TEST.SYS_C0077930) violated
    Could I get some help with understanding how to debug this error.
    Thanks

    Assuming you are doing a record at a time in a cursor for loop, you probably have something like this:
    declare
    some variables
    cursor c is
    select whatever from wherever;
    begin
    for r in c loop
    insert into test (columns) values (r.col1, r.col2, etc);
    end loop;
    exception
    when dup_val_on_index then
    <this is the named error you are hitting>
    when others then
    whatever
    end
    What you need to do is nest the block so the error is handled without causing a termination of the main block/procedure. Look up nested blocks/exception handling. Then modify your code accordingly.

  • HELP PLEASE - control panel error

    since installing the new drivers
    if i go into the display setting and go into advanced, whenever i click on the
    Geforce2 intergrated GPU Tab i get one of the following errors
    if i go in by right clicking on my desktop i get!
    run a dll as an app
    fet a windows message
    saing
    run a dll as an app has encountered a problem and needs to close
    and asks if i want to send an error report
    if i go through the start menu and control panel
    i get
    rundll
    an exception occured while trying to run "shell32.dll,control_rundll "c:windowssystem32desk.cpl," display"
    I have tried reinstalling te drivers but does not make any difference
    Can anyone offer any help please

    I have now fixed by downloading and running
    Detonator 30.xx to 40.41 fix
    from http://www.guru3d.com/files/
    Thanx anyway

  • Any help please re:- restore error message? Thanks

    I have an error message.
    The iPhone "iPhone" could not be restored. An unknown error occured (6).

    Mudanzas
    Please delete or disable the OldFilm.AEX file.
    That is the Adobe solution for the issue in Premiere Elements 13.
    In Windows 7, 8, or 8.1 64 bit, the path to the file is
    Local Disk C
    Program Files
    Adobe
    Adobe Premiere Elements 13
    Plug-ins
    Common
    NewBlue
    and in the NewBlue Folder is the OldFilm.AEX file that you delete or disable by renaming it from OldFilm.AEX to OldFIlm.AEXOLD.
    Please let us know if that works for you.
    Thank you.
    ATR

  • Help Please - System Resource Error

    I have a demo tomorrow and I need to demo off my machine
    (local). I have CF Server version MX7 and I am using MS Access 2003
    database SP2 and I have just started to get the attached error. Is
    this a CF server error or can anyone tell me how to fix?
    The queries all run fine but I get this system resource error
    after I try to run the same query twice.
    Any and all suggestions will be appreciated.
    Attach Code

    The error is coming from MS Access, and is merely displayed
    from the ColdFusion page request. The Microsoft support site shows
    at least one known cause of the error such that queries that have
    complex WHERE clauses can encounter this. Although your query seems
    rather simple, it seems that you've hit some type of limitation of
    the Access database.
    See this for more:
    http://support.microsoft.com/kb/918814/en-us
    You might want to run the free MySQL database instead of MS
    Access.

  • Help please for compilation error

    I have made an utility app.
    I have used CFHTTPMessageRef class from CoreServices.h
    This works fine with me for Simulator.
    Now when i change Active SDK to Device it gives compilation error :
    1) No such file or directory : <CoreServices/CoreServices.h>
    2) Syntax error before CFHTTPMessageRef.
    While reading i came to know that CoreServices is available only for Simulator and not for device(Correct me if wrong).
    I also added CFNetwork framework for linking in build settings.
    Can anybody suggest something on this...

    Hi, i've used some types like CFHostRef in one of my apps, so it should work. I will look into the sourcecode to see what headerfiles i've included.
    i'll be back later this day.

  • Help please itunes update error

    now when i try to install on my iphone the latest iphone software i get an error (9) what i have to do ?

    This solved my question !
    Thanks a lot joerg.waldner
    Greets from Paris
    joerg.waldner wrote:
    Hi, I downloaded it direct from http://www.apple.com/itunes/download/ and it was no problem!
    Greets from Austria!

  • Help Please! Exception Error with Threads

    In my program i get this:
    java.lang.NullPointerException
         at kmess$SocketClient.run(kmess.java:336)
         at java.lang.Thread.run(Thread.java:536)line 336 refers to this part of my code:
    public void run()
              if(getdata.equals(Thread.currentThread()) )
                   System.out.println("running getdata thread");
                   getdatamethod();
              if(senddataThread.equals(Thread.currentThread()) )
                   System.out.println("running senddataThread thread");
                   senddatamethod();
    }Now, here is the rest of this class that this method is in:
    class SocketClient extends JFrame implements Runnable {
         Socket socket = null;
       PrintWriter out = null;
       BufferedReader in = null;
              String text = null;
         Thread getdata;
       SocketClient(){
         public void listenSocket() {
         if ( connected==("2") ) {
    //Create socket connection
         try{
           socket = new Socket("0.0.0.0", 4444);
           out = new PrintWriter(socket.getOutputStream(), true);
           in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
         } catch (UnknownHostException e) {
           System.out.println("Unknown host: host your connecting to");
           System.exit(1);
         } catch  (IOException e) {
           System.out.println("No I/O");
           System.exit(1);
                   connected = "1";
                   out2 = out;
                   in2 = in;
         if (thisclient==("1"))
              creategetdatathread();
         if (thisclient==("2"))
         { Thread senddataThread = new Thread(this);
              senddataThread.equals(Thread.currentThread());
              System.out.println("current thread is after thisclient = 2 " + Thread.currentThread() + senddataThread);
              senddataThread.start();
              thisclient = "3";
         senddata();
    public void creategetdatathread()
    System.out.println("In creategetdatathread");
         Thread getdata = new Thread(this);
              getdata.equals(Thread.currentThread());
              System.out.println("current thread is after thisclient = 1 " + Thread.currentThread() + senddataThread);
              thisclient = "4";
              getdata.start();
    public void run()
              if(getdata.equals(Thread.currentThread()) )
                   System.out.println("running getdata thread");
                   getdatamethod();
              if(senddataThread.equals(Thread.currentThread()) )
                   System.out.println("running senddataThread thread");
                   senddatamethod();
    public void senddatamethod() {
    while(true) {
           try{
           String line = in2.readLine();
              if (line != null) {
              out2.println(line);
           } catch (IOException e){
          System.out.println("Read failed");
                 System.exit(1);
              try { Thread.sleep(2000); }
                   catch(InterruptedException e) {}
    public void getdatamethod() {
    while(true) {
           try{
           String line = in2.readLine();
              if (line != null)
              messlistArea.append("Message:" + line + "\n");
           } catch (IOException e){
          System.out.println("Read failed");
                 System.exit(1);
              try { Thread.sleep(2000); }
                   catch(InterruptedException e) {}
    public void senddata() {
         //Send data over socket
         System.out.println("in send data method");
              String text = messageArea.getText();
              out2.println(text);
           messageArea.setText(new String(""));
    //Receive text from server
           try{
           String line = in2.readLine();
              if (thisclient==("4"))
              messlistArea.append("Message:" + line + "\n");
           } catch (IOException e){
          System.out.println("Read failed");
                 System.exit(1);
    }QUESTION: how do i prevent this error, and therefore enable those threads in that run method to run? thanks.

    Well I don't really want to get into the design of your solution but there are a lot of errors in the code you've posted. I presume the code you posted isn't the code you're running as there are declarations missing and it won't compile. But the fundamental answer to your question is that to avoid the error you initially described you need to make sure your reading and writing threads are fully initialised before your frame thread starts running.

  • TS3694 i forgot the password of my  iphone 3g and when i try to restore it it shows the message"my iphone 3g could not be restored an unknown error occurred(1015)" can any body help please..

    i forgot the password of my  iphone 3g and when i try to restore it it shows the message"my iphone 3g could not be restored an unknown error occurred(1015)" can any body help please..

    This error normally appears if you attempted to downgrade or modify your iOS. See here http://support.apple.com/kb/TS3694#error1015

Maybe you are looking for

  • Adding the Checkbox for each row in classic report

    Hello, I have created classic report with checkboxes in each row and added the On-Submit process, BUTTON CONDITIONAL, to determine the behavior of the checkboxes. The PL/SQL process is suppose to delete the selected row from database. I am getting th

  • MSI Twin Forzer GTX 760 no longer recognised in Windows or showing in BIOS

    This evening when I switched on my PC, I got no signal to my monitor. * I checked all the connections from my DVI -> VGA connector * I Tried with an HDMI cable Both would no produce a signal.  I then checked in the BIOS (MSI z87-g65) and the PCIe 16x

  • I see people asking about Error Code - 36, but no helpful answers.

    Just started yesterday while trying to copy files from hard drive to thumb drive. Repeated Error Code - 36. Happened a lot but no to every file I tried to copy. Started again today when I tried to copy from my Drop Box to a thumb drive. Macbook Pro i

  • Document types per transaction

    Hi Experts, How to know which document types are determined per transaction? Ex: what document type can be defaulted for the transactions like FB60 / FB65 etc. Please indicate the config area. warm regards marias

  • Questions about NI 9201

    I am using cRIO 9004 with one of the slots NI 9201 and NI 9411. I get the A, B and Z signal from a Quadrature Encoder http://zone.ni.com/devzone/cda/tut/p/id/3921. I don't want to use the code ( Figure 6: Position Estimation) provided in the homepage