Jump to content

Folder Creating and copy in to user profile


 Share

Recommended Posts

I have  to create the Folder into the user profile after that from the input window i have taken path of text file  and that has to get copy into the created user profile folders.
Problem is that if i select the txt file from desktop . Folder will get create successfully in user profile and copy the txt in folders  .
 In-case if i select the txt file path from other apart from desktop location ,folder is not getting created in user profile but its getting created in path of txt file  .
I need to copy the text file from any location to user profile . Please help me  .
 
here is code  : Where is going wrong i am not getting please help me 
 

 

If i select the id file from the desktop folder .Everything work fine . Even folder also get created in user profile  .

Incase if i select the id file from other location i mean frm d: or from any other folder  . Folder is not getting Created also its is not getting moved into the folders  

 
 
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Global $hMsg
Global $path
Global $test
Global $mserver ;get server name
Global $lpwd ;
Global $Email
Global $var
Global $usrname
Global $splitsrname1
Global $hButton
Global $hButton2
Global $intWindow
Global $delwindow
Global $hInput;Email address
Global $temp
Global $splitsrname
$hGUI = GUICreate("Lotus Notes Auto Config", 460, 189, -1, -1)
$Empid = GUICtrlCreateLabel("Enter Emp ID :", 33, 30, 140, 27)
GUICtrlSetFont(-1, 10, 800, 0)
$hLabel2 = GUICtrlCreateLabel("Enter Email Address :", 33, 64, 153, 27)
GUICtrlSetFont(-1, 10, 800, 0)
$hLabel3 = GUICtrlCreateLabel("Enter Server Name :", 33, 102, 153, 27)
GUICtrlSetFont(-1, 10, 800, 0)
$hInput = GUICtrlCreateInput("", 220, 30, 221, 27)
$hInput2 = GUICtrlCreateInput("", 220, 64, 221, 27)
$hInput3 = GUICtrlCreateInput("", 220, 102, 221, 27)
$hButton = GUICtrlCreateButton("OK", 82, 146, 96, 26)
GUICtrlSetFont(-1, 8.5, 800, 0)
$hButton2 = GUICtrlCreateButton("Cancle", 228, 146, 98, 26)
GUICtrlSetFont(-1, 8.5, 800, 0)
$hLabel4 = GUICtrlCreateLabel("(Eg.inbrt01.Sgs.com)", 42, 121, 117, 13)
$hLabel5 = GUICtrlCreateLabel("(Eg.first.last name@sgs.com )", 34, 85, 144, 17)
GUISetState(@SW_SHOW)
$usrname = GUICtrlRead($hInput)
$mserver = GUICtrlRead($hInput3)
$Email = GUICtrlRead($hInput2)
;$splitsrname1 = StringRight($mserver, 8)
$hMsg = 0
While $hMsg <> $GUI_EVENT_CLOSE
    $hMsg = GUIGetMsg()
    Switch $hMsg
            Case $hButton
            $usrname = GUICtrlRead($hInput)
            $mserver = GUICtrlRead($hInput3)
            $Email = GUICtrlRead($hInput2)
            $splitsrname1 = StringRight($mserver, 8)
            $splitsrname = StringTrimRight($mserver, 8)
            $result = StringCompare(".sgs.com", $splitsrname1)
            $splitemname = StringRight($Email, 8)
            $result1 = StringCompare("@sgs.com", $splitemname)
            If $result <> 0 or $Empid = "" Or $Email = "" Or $mserver = "" or $result1 <>0 Then
            MsgBox(0, "Warning", "Please type the all inputs in correct format " & @CRLF & "TRY AGAIN ?")
            Else
               GUIDelete($delwindow)
                Idfile()
             EndIf

        Case $hButton2
            ExitLoop
    EndSwitch
   ;GUIDelete($delwindow)
WEnd

Func Idfile()
    $hGUI1 = GUICreate("Lotus Notes Auto Config ", 394, 142, -1, -1)
    $hLabel1 = GUICtrlCreateLabel("Select Notes ID file ", 98, 16, 142, 27)
    GUICtrlSetFont(-1, 10, 800, 0)
    $hButton1 = GUICtrlCreateButton("Browse", 53, 92, 96, 23)
    GUICtrlSetFont(-1, 10, 800, 0)
    $hButton21 = GUICtrlCreateButton("Done", 229, 92, 95, 23)
    GUICtrlSetFont(-1, 8.5, 800, 0)
    $path = GUICtrlCreateInput("", 19, 43, 349, 27)
     GUISetState()
    $hMsg1 = 0
    While $hMsg1 <> $GUI_EVENT_CLOSE
        $hMsg1 = GUIGetMsg()
        Select
            Case $hMsg1 = $hButton1
                $var  = FileOpenDialog("Browse", "C:\", "ID file  (*.txt)") ;returns the file path
                GUICtrlSetData($path, $var) ;set input data
                $test = GUICtrlSetData($path,$var )

             Case $hMsg1 = $hButton21
                $temp= GUICtrlRead($path)
                ;MsgBox(1,"Input details","Id file path" & $temp)
                 if $temp = "" then
                  MsgBox(1,"Error ","ID File Location Cannot be blank")
                  GUIDelete($delwindow)
                  Idfile()
                 Else
                  GUIDelete($delwindow);MsgBox(1,"ID File path",($temp))
                  notes()
                  EndIf
               ;Return
        EndSelect
    WEnd
 EndFunc   ;==>Idfile

      Func notes()
             TrayTip("  ", "Please wait Creating config files.", 2)
             ;Creating config file
            $file = FileOpen(@DesktopDir & "\lnconfig.txt", 2)
            If $file = -1 Then
            MsgBox(0, "Error", "Unable to open file.")
            Else
            FileWrite($file, "Username=" & $usrname & @CRLF)
            FileWrite($file, "KeyfileName=" & $temp & @CRLF) ; The CRLF at the end is a line break
            FileWrite($file, "Domino.Name= "& $splitsrname & "/TCS" & @CRLF)
            FileWrite($file, "Domino.Address="& $mserver & @CRLF)
            FileWrite($file, "Domino.Port=TCPIP"& @CRLF)
            FileWrite($file, "Domino.Server=1"& @CRLF)
            FileWrite($file, "AdditionalServices=0" & @CRLF)
            FileWrite($file, "AdditionalServices.NetworkDial=0"& @CRLF)
            FileWrite($file, "Replication.Threshold=9999"& @CRLF)
            FileWrite($file, "Replication.Schedule=0" & @CRLF)
            EndIf
            FileClose($file)
            TrayTip("Lotus Notes Auto Config  ", "Please wait Creating config files.", 2)
            ; creation of notes.ini
            $OS= @OSVersion
            if $OS ="Win_XP" Then
            $filen = FileOpen(@DesktopDir & "\notes.ini", 2)
            If $filen = -1 Then
            MsgBox(0, "Error", "Unable to open file.")
            Else
            FileWrite($filen, "[Notes]"&@CRLF)
            FileWrite($filen, "CONFIGFILE=" & @DesktopDir & "\"&"lnConfig.txt" & @CRLF) ; The CRLF at the end is a line break
            FileWrite($filen, "KitType=1" & @CRLF)
            FileWrite($filen, "Directory=" & "C:\Documents and Settings" & @username & "\Local Settings\Application Data\Lotus\Notes\Data" & @CRLF)
            FileWrite($filen, "Directory=" & "C:\Documents and Settings" & @username & "\Local Settings\Application Data\IBM\Notes\Data" & @CRLF)
            FileWrite($filen, "StackedIcons=0" & @CRLF)
            FileWrite($filen, "MenusAdvanced=1" & @CRLF)
            ;FileWrite($filen, "CacheMail=1" & @CRLF)
            FileWrite($filen, "ArchiveNoSchedulePrompt=1" & @CRLF)
            FileWrite($filen, "ArchiveNoEnablePrompt=1" & @CRLF)
            FileWrite($filen, "iNotes_WA_EnableActionsInArchive=1" & @CRLF)
            EndIf
            Else
             $filen = FileOpen(@DesktopDir & "\notes.ini", 2)
            If $filen = -1 Then
           MsgBox(0, "Error", "Unable to open file.")
            Else
            FileWrite($filen, "[Notes]"&@CRLF)
            FileWrite($filen, "CONFIGFILE=" & @DesktopDir & "\"&"lnConfig.txt" & @CRLF) ; The CRLF at the end is a line break
            FileWrite($filen, "KitType=1" & @CRLF)
            FileWrite($filen, "Directory=" & "C:\users\" & @username & "\AppData\Local\Lotus\Notes\Data" & @CRLF)
            FileWrite($filen, "Directory=" & "C:\users\" & @username & "\AppData\Local\IBM\Notes\Data" & @CRLF)
            FileWrite($filen, "StackedIcons=0" & @CRLF)
            FileWrite($filen, "MenusAdvanced=1" & @CRLF)
            ;FileWrite($filen, "CacheMail=1" & @CRLF)
            FileWrite($filen, "ArchiveNoSchedulePrompt=1" & @CRLF)
            FileWrite($filen, "ArchiveNoEnablePrompt=1" & @CRLF)
            FileWrite($filen, "iNotes_WA_EnableActionsInArchive=1" & @CRLF)
            TrayTip("Lotus Notes Auto Config  ", "Please wait Creating config files.", 2)
            EndIf
            EndIf

         ; Create the Lotus->notes-> data folder in user profile
           $OS=@OSVersion
           if $OS ="Win_XP" Then
               Run(@ComSpec & " /k cd %userprofile% & cd Local Settings & cd Application Data & rename Lotus\Notes\Data Data1_Old" ,"",@SW_HIDE)
               Sleep(1000)
               Run(@ComSpec & " /k cd %userprofile% & cd Local Settings & cd Application Data & Mkdir Lotus\Notes\Data" ,"",@SW_HIDE)
               sleep(1000)
               Run(@ComSpec & " /k cd %userprofile% & cd Local Settings & cd Application Data & rename IBM\Notes\Data Data1_old" ,"",@SW_HIDE)
               Sleep(2000)
               Run(@ComSpec & " /k cd %userprofile% & cd Local Settings & cd Application Data & Mkdir IBM\Notes\Data" ,"",@SW_HIDE)
               Sleep(2000)
           Else
               Run(@ComSpec & " /k cd %userprofile% & cd Appdata & cd Local & rename Lotus\Notes\Data data1_old" ,"",@SW_HIDE)
               Sleep(1000)
               Run(@ComSpec & " /k cd %userprofile% & cd Appdata & cd Local & MD Lotus\Notes\Data" ,"",@SW_HIDE)
               Sleep(1000)
               Run(@ComSpec & " /k cd %userprofile% & cd Appdata & cd Local & rename IBM\Notes\Data Data1_old" ,"",@SW_HIDE)
               Sleep(2000)
               Run(@ComSpec & " /k cd %userprofile% & cd Appdata & cd Local & MD IBM\Notes\Data" ,"",@SW_HIDE)
               Sleep(2000)
          EndIf

         ;Copying id file to data folder

            $tmp2 = MsgBox(0," ","txt file copying to DATA folder" )
            Sleep(1000)
            TrayTip("  ", "Please wait Copying necessary files.", 2)
            Sleep(1000)
            $OS=@OSVersion
            if $OS ="Win_XP" Then
             
            Global $filedes1 = ("C:\Documents and Settings\" & @username & "\Local Settings\Application Data\Lotus\Notes\Data\")
            Sleep(1000)
            global $filedes1x = ("C:\Documents and Settings\" & @username & "\Local Settings\Application Data\IBM\Notes\Data\")
            Sleep(1000)
            fileCopy($temp,$filedes1,1)
            Sleep(1000)
            FileCopy($temp,$filedesx,1)
            Sleep(2000)
            Else
            global $filedes1 = ("C:\Users\" & @username & "\AppData\Local\Lotus\Notes\Data\")
            Sleep(1000)
            global $filedesx = ("C:\Users\" & @username & "\AppData\Local\IBM\Notes\Data\")
            Sleep(1000)
            FileCopy($temp,$filedes1,1)
            Sleep(1000)
            FileCopy($temp,$filedesx,1)
            Sleep(2000)
         EndIf

         
          $filedes2 = ("C:\Windows\System32\config\systemprofile\AppData\Local\Lotus\Notes\Data\")
          Sleep(1000)
          FileCopy($temp,$filedes2,1)
          Sleep(3000) 
          $filedes5 = ("C:\WINDOWS\system32\config\systemprofile\AppData\Local\IBM\Notes\Data\")
          Sleep(1000)
          FileCopy($temp,$filedes5,1)
          Sleep(3000)

         TrayTip("  ", "Please wait Copying necessary files.", 9)

         ;Notes.ini moving in user profile
         $OS=@OSVersion

            if $OS ="Win_XP" Then

            $filesrc = @DesktopDir &"\notes.ini"
            $filedes = ("C:\Documents and Settings\" & @username & "\Local Settings\Application Data\Lotus\Notes\Data\")
            $filedesn = ("C:\Documents and Settings\" & @username & "\Local Settings\Application Data\IBM\Notes\Data\")
            Sleep(1000)
            Filecopy($filesrc,$filedes,1)
            Sleep(1000)
            Filecopy($filesrc,$filedesn,1)
            Sleep(2000)
            Else
            $filesrc = @DesktopDir &"\notes.ini"
            $filedes = ("C:\Users\" & @username & "\AppData\Local\Lotus\Notes\Data\")
            $filedesn = ("C:\Users\" & @username & "\AppData\Local\IBM\Notes\Data\")
            Sleep(1000)
            Filecopy($filesrc,$filedes,1)
            Sleep(2000)
            Filecopy($filesrc,$filedesn,1)
            Sleep(3000)
         EndIf
         TrayTip("Lotus Notes Auto Config  ", "Please wait Copying necessary files.", 9)
          $filesrc3 = @DesktopDir &"\notes.ini"
          $filedes3 = ("C:\Windows\System32\config\systemprofile\AppData\Local\Lotus\Notes\Data\")
          Sleep(1000)
          FileCopy($filesrc3,$filedes3,1)
          Sleep(3000)
          ;EndIf

          $filesrc4 = @DesktopDir &"\notes.ini"
          $filedes4 = ("C:\WINDOWS\system32\config\systemprofile\AppData\Local\IBM\Notes\Data\")
          Sleep(1000)
          FileCopy($filesrc4,$filedes4,1)
          Sleep(3000)
         TrayTip("Lotus Notes Auto Config 8.5.2 ", "Copied all necessary files.", 2)
         Sleep(1000)
         Lotus_main()
   EndFunc


   Func Lotus_main()
            TrayTip("  ", "Launching the lotus notes please wait..", 10)
            Sleep(2000)
            Send("#r")
            WinWaitActive("Run")
            Send("notes.exe{Enter}")
            Sleep(6000)
      EndFunc
Edited by Aniiii
Link to comment
Share on other sites

what part exactly is problematic: copy the id file? the ini file? the creation of the data folder? something else?

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Link to comment
Share on other sites

what part exactly is problematic: copy the id file? the ini file? the creation of the data folder? something else?

Hi,

If i select the id file from the desktop folder .Everything work fine . Even folder also get created in user profile  .

Incase if i select the id file from other location i mean frm d: or from any other folder  . Folder is not getting Created also its is not getting moved into the folders  

Link to comment
Share on other sites

from the help on FileOpenDialog(), "Remarks" section:

@WorkingDir is changed on successful return.

are you taking this into account? i see your script expects some files on the desktop, and it executes many @comspec cd commands.

P.S. i tested on Windows 7, chose an id file from my Documents folder, and i see the folder structure was created in my AppDataLocal, with the id file and notes.ini copied there. also i see notes.ini and lnconfig.txt magically appearing on my desktop.

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Link to comment
Share on other sites

from the help on FileOpenDialog(), "Remarks" section:

@WorkingDir is changed on successful return.

are you taking this into account? i see your script expects some files on the desktop, and it executes many @comspec cd commands.

P.S. i tested on Windows 7, chose an id file from my Documents folder, and i see the folder structure was created in my AppDataLocal, with the id file and notes.ini copied there. also i see notes.ini and lnconfig.txt magically appearing on my desktop.

Thanks for your reply  ..

Can you please help me i am unable to find out where is exact issue  .  I am not taking @workingDir in account . Incase user select path from d: folder is getting created in id file path itself  . 

Link to comment
Share on other sites

Please help me anyone in this :


I have to create the folder manully in the users profile and copy the required file which get created on desktop and text file which i have to select.
problem when i select the text file from d: folder structure not getting created as in user profile .Same getting created where i have selected txt file .

i want to create folder structure in user profile if i select text file from any drive .
 

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Global $hMsg
Global $path
Global $test
Global $mserver ;get server name
Global $lpwd ;
Global $Email
Global $var
Global $usrname
Global $splitsrname1
Global $hButton
Global $hButton2
Global $intWindow
Global $delwindow
Global $hInput;Email address
Global $temp
Global $splitsrname
$hGUI = GUICreate("Lotus Notes Auto Config", 460, 189, -1, -1)
$Empid = GUICtrlCreateLabel("Enter Emp ID :", 33, 30, 140, 27)
GUICtrlSetFont(-1, 10, 800, 0)
$hLabel2 = GUICtrlCreateLabel("Enter Email Address :", 33, 64, 153, 27)
GUICtrlSetFont(-1, 10, 800, 0)
$hLabel3 = GUICtrlCreateLabel("Enter Server Name :", 33, 102, 153, 27)
GUICtrlSetFont(-1, 10, 800, 0)
$hInput = GUICtrlCreateInput("", 220, 30, 221, 27)
$hInput2 = GUICtrlCreateInput("", 220, 64, 221, 27)
$hInput3 = GUICtrlCreateInput("", 220, 102, 221, 27)
$hButton = GUICtrlCreateButton("OK", 82, 146, 96, 26)
GUICtrlSetFont(-1, 8.5, 800, 0)
$hButton2 = GUICtrlCreateButton("Cancle", 228, 146, 98, 26)
GUICtrlSetFont(-1, 8.5, 800, 0)
$hLabel4 = GUICtrlCreateLabel("(Eg.inbrt01.Sgs.com)", 42, 121, 117, 13)
$hLabel5 = GUICtrlCreateLabel("(Eg.first.last name@sgs.com )", 34, 85, 144, 17)
GUISetState(@SW_SHOW)
$usrname = GUICtrlRead($hInput)
$mserver = GUICtrlRead($hInput3)
$Email = GUICtrlRead($hInput2)
;$splitsrname1 = StringRight($mserver, 8)
$hMsg = 0
While $hMsg <> $GUI_EVENT_CLOSE
    $hMsg = GUIGetMsg()
    Switch $hMsg
            Case $hButton
            $usrname = GUICtrlRead($hInput)
            $mserver = GUICtrlRead($hInput3)
            $Email = GUICtrlRead($hInput2)
            $splitsrname1 = StringRight($mserver, 8)
            $splitsrname = StringTrimRight($mserver, 8)
            $result = StringCompare(".sgs.com", $splitsrname1)
            $splitemname = StringRight($Email, 8)
            $result1 = StringCompare("@sgs.com", $splitemname)
            If $result <> 0 or $Empid = "" Or $Email = "" Or $mserver = "" or $result1 <>0 Then
            MsgBox(0, "Warning", "Please type the all inputs in correct format " & @CRLF & "TRY AGAIN ?")
            Else
               GUIDelete($delwindow)
                Idfile()
             EndIf

        Case $hButton2
            ExitLoop
    EndSwitch
   ;GUIDelete($delwindow)
WEnd

Func Idfile()
    $hGUI1 = GUICreate("Lotus Notes Auto Config ", 394, 142, -1, -1)
    $hLabel1 = GUICtrlCreateLabel("Select Notes ID file ", 98, 16, 142, 27)
    GUICtrlSetFont(-1, 10, 800, 0)
    $hButton1 = GUICtrlCreateButton("Browse", 53, 92, 96, 23)
    GUICtrlSetFont(-1, 10, 800, 0)
    $hButton21 = GUICtrlCreateButton("Done", 229, 92, 95, 23)
    GUICtrlSetFont(-1, 8.5, 800, 0)
    $path = GUICtrlCreateInput("", 19, 43, 349, 27)
     GUISetState()
    $hMsg1 = 0
    While $hMsg1 <> $GUI_EVENT_CLOSE
        $hMsg1 = GUIGetMsg()
        Select
            Case $hMsg1 = $hButton1
                $var  = FileOpenDialog("Browse", "C:\", "ID file  (*.txt)") ;returns the file path
                GUICtrlSetData($path, $var) ;set input data
                $test = GUICtrlSetData($path,$var )

             Case $hMsg1 = $hButton21
                $temp= GUICtrlRead($path)
                ;MsgBox(1,"Input details","Id file path" & $temp)
                 if $temp = "" then
                  MsgBox(1,"Error ","ID File Location Cannot be blank")
                  GUIDelete($delwindow)
                  Idfile()
                 Else
                  GUIDelete($delwindow);MsgBox(1,"ID File path",($temp))
                  notes()
                  EndIf
               ;Return
        EndSelect
    WEnd
 EndFunc   ;==>Idfile

      Func notes()
             TrayTip("  ", "Please wait Creating config files.", 2)
             ;Creating config file
            $file = FileOpen(@DesktopDir & "\lnconfig.txt", 2)
            If $file = -1 Then
            MsgBox(0, "Error", "Unable to open file.")
            Else
            FileWrite($file, "Username=" & $usrname & @CRLF)
            FileWrite($file, "KeyfileName=" & $temp & @CRLF) ; The CRLF at the end is a line break
            FileWrite($file, "Domino.Name= "& $splitsrname & "/TCS" & @CRLF)
            FileWrite($file, "Domino.Address="& $mserver & @CRLF)
            FileWrite($file, "Domino.Port=TCPIP"& @CRLF)
            FileWrite($file, "Domino.Server=1"& @CRLF)
            FileWrite($file, "AdditionalServices=0" & @CRLF)
            FileWrite($file, "AdditionalServices.NetworkDial=0"& @CRLF)
            FileWrite($file, "Replication.Threshold=9999"& @CRLF)
            FileWrite($file, "Replication.Schedule=0" & @CRLF)
            EndIf
            FileClose($file)
            TrayTip("Lotus Notes Auto Config  ", "Please wait Creating config files.", 2)
            ; creation of notes.ini
            $OS= @OSVersion
            if $OS ="Win_XP" Then
            $filen = FileOpen(@DesktopDir & "\notes.ini", 2)
            If $filen = -1 Then
            MsgBox(0, "Error", "Unable to open file.")
            Else
            FileWrite($filen, "[Notes]"&@CRLF)
            FileWrite($filen, "CONFIGFILE=" & @DesktopDir & "\"&"lnConfig.txt" & @CRLF) ; The CRLF at the end is a line break
            FileWrite($filen, "KitType=1" & @CRLF)
            FileWrite($filen, "Directory=" & "C:\Documents and Settings" & @username & "\Local Settings\Application Data\Lotus\Notes\Data" & @CRLF)
            FileWrite($filen, "Directory=" & "C:\Documents and Settings" & @username & "\Local Settings\Application Data\IBM\Notes\Data" & @CRLF)
            FileWrite($filen, "StackedIcons=0" & @CRLF)
            FileWrite($filen, "MenusAdvanced=1" & @CRLF)
            ;FileWrite($filen, "CacheMail=1" & @CRLF)
            FileWrite($filen, "ArchiveNoSchedulePrompt=1" & @CRLF)
            FileWrite($filen, "ArchiveNoEnablePrompt=1" & @CRLF)
            FileWrite($filen, "iNotes_WA_EnableActionsInArchive=1" & @CRLF)
            EndIf
            Else
             $filen = FileOpen(@DesktopDir & "\notes.ini", 2)
            If $filen = -1 Then
           MsgBox(0, "Error", "Unable to open file.")
            Else
            FileWrite($filen, "[Notes]"&@CRLF)
            FileWrite($filen, "CONFIGFILE=" & @DesktopDir & "\"&"lnConfig.txt" & @CRLF) ; The CRLF at the end is a line break
            FileWrite($filen, "KitType=1" & @CRLF)
            FileWrite($filen, "Directory=" & "C:\users\" & @username & "\AppData\Local\Lotus\Notes\Data" & @CRLF)
            FileWrite($filen, "Directory=" & "C:\users\" & @username & "\AppData\Local\IBM\Notes\Data" & @CRLF)
            FileWrite($filen, "StackedIcons=0" & @CRLF)
            FileWrite($filen, "MenusAdvanced=1" & @CRLF)
            ;FileWrite($filen, "CacheMail=1" & @CRLF)
            FileWrite($filen, "ArchiveNoSchedulePrompt=1" & @CRLF)
            FileWrite($filen, "ArchiveNoEnablePrompt=1" & @CRLF)
            FileWrite($filen, "iNotes_WA_EnableActionsInArchive=1" & @CRLF)
            TrayTip("Lotus Notes Auto Config  ", "Please wait Creating config files.", 2)
            EndIf
            EndIf

         ; Create the Lotus->notes-> data folder in user profile
           $OS=@OSVersion
           if $OS ="Win_XP" Then
               Run(@ComSpec & " /k cd %userprofile% & cd Local Settings & cd Application Data & rename Lotus\Notes\Data Data1_Old" ,"",@SW_HIDE)
               Sleep(1000)
               Run(@ComSpec & " /k cd %userprofile% & cd Local Settings & cd Application Data & Mkdir Lotus\Notes\Data" ,"",@SW_HIDE)
               sleep(1000)
               Run(@ComSpec & " /k cd %userprofile% & cd Local Settings & cd Application Data & rename IBM\Notes\Data Data1_old" ,"",@SW_HIDE)
               Sleep(2000)
               Run(@ComSpec & " /k cd %userprofile% & cd Local Settings & cd Application Data & Mkdir IBM\Notes\Data" ,"",@SW_HIDE)
               Sleep(2000)
           Else
               Run(@ComSpec & " /k cd %userprofile% & cd Appdata & cd Local & rename Lotus\Notes\Data data1_old" ,"",@SW_HIDE)
               Sleep(1000)
               Run(@ComSpec & " /k cd %userprofile% & cd Appdata & cd Local & MD Lotus\Notes\Data" ,"",@SW_HIDE)
               Sleep(1000)
               Run(@ComSpec & " /k cd %userprofile% & cd Appdata & cd Local & rename IBM\Notes\Data Data1_old" ,"",@SW_HIDE)
               Sleep(2000)
               Run(@ComSpec & " /k cd %userprofile% & cd Appdata & cd Local & MD IBM\Notes\Data" ,"",@SW_HIDE)
               Sleep(2000)
          EndIf

         ;Copying id file to data folder

            $tmp2 = MsgBox(0," ","txt file copying to DATA folder" )
            Sleep(1000)
            TrayTip("  ", "Please wait Copying necessary files.", 2)
            Sleep(1000)
            $OS=@OSVersion
            if $OS ="Win_XP" Then

            Global $filedes1 = ("C:\Documents and Settings\" & @username & "\Local Settings\Application Data\Lotus\Notes\Data\")
            Sleep(1000)
            global $filedes1x = ("C:\Documents and Settings\" & @username & "\Local Settings\Application Data\IBM\Notes\Data\")
            Sleep(1000)
            fileCopy($temp,$filedes1,1)
            Sleep(1000)
            FileCopy($temp,$filedesx,1)
            Sleep(2000)
            Else
            global $filedes1 = ("C:\Users\" & @username & "\AppData\Local\Lotus\Notes\Data\")
            Sleep(1000)
            global $filedesx = ("C:\Users\" & @username & "\AppData\Local\IBM\Notes\Data\")
            Sleep(1000)
            FileCopy($temp,$filedes1,1)
            Sleep(1000)
            FileCopy($temp,$filedesx,1)
            Sleep(2000)
         EndIf


          $filedes2 = ("C:\Windows\System32\config\systemprofile\AppData\Local\Lotus\Notes\Data\")
          Sleep(1000)
          FileCopy($temp,$filedes2,1)
          Sleep(3000)
          $filedes5 = ("C:\WINDOWS\system32\config\systemprofile\AppData\Local\IBM\Notes\Data\")
          Sleep(1000)
          FileCopy($temp,$filedes5,1)
          Sleep(3000)

         TrayTip("  ", "Please wait Copying necessary files.", 9)

         ;Notes.ini moving in user profile
         $OS=@OSVersion

            if $OS ="Win_XP" Then

            $filesrc = @DesktopDir &"\notes.ini"
            $filedes = ("C:\Documents and Settings\" & @username & "\Local Settings\Application Data\Lotus\Notes\Data\")
            $filedesn = ("C:\Documents and Settings\" & @username & "\Local Settings\Application Data\IBM\Notes\Data\")
            Sleep(1000)
            Filecopy($filesrc,$filedes,1)
            Sleep(1000)
            Filecopy($filesrc,$filedesn,1)
            Sleep(2000)
            Else
            $filesrc = @DesktopDir &"\notes.ini"
            $filedes = ("C:\Users\" & @username & "\AppData\Local\Lotus\Notes\Data\")
            $filedesn = ("C:\Users\" & @username & "\AppData\Local\IBM\Notes\Data\")
            Sleep(1000)
            Filecopy($filesrc,$filedes,1)
            Sleep(2000)
            Filecopy($filesrc,$filedesn,1)
            Sleep(3000)
         EndIf
         TrayTip("Lotus Notes Auto Config  ", "Please wait Copying necessary files.", 9)
          $filesrc3 = @DesktopDir &"\notes.ini"
          $filedes3 = ("C:\Windows\System32\config\systemprofile\AppData\Local\Lotus\Notes\Data\")
          Sleep(1000)
          FileCopy($filesrc3,$filedes3,1)
          Sleep(3000)
          ;EndIf

          $filesrc4 = @DesktopDir &"\notes.ini"
          $filedes4 = ("C:\WINDOWS\system32\config\systemprofile\AppData\Local\IBM\Notes\Data\")
          Sleep(1000)
          FileCopy($filesrc4,$filedes4,1)
          Sleep(3000)
         TrayTip("Lotus Notes Auto Config 8.5.2 ", "Copied all necessary files.", 2)
         Sleep(1000)
         Lotus_main()
   EndFunc


   Func Lotus_main()
            TrayTip("  ", "Launching the lotus notes please wait..", 10)
            Sleep(2000)
            Send("#r")
            WinWaitActive("Run")
            Send("notes.exe{Enter}")
            Sleep(6000)
      EndFunc
Link to comment
Share on other sites

Why post this >twice? You just asked basically the same question in your other thread and you only started that thread about 10 hours ago, don't be impatient.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

  • Moderators

Aniiii,

One thread at a time please - threads merged. :naughty:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

if you choose the id file on D: and all your @comspec cd operations are supposed to be done in C: but you do not change drive to C:, then i guess this is why it doesn't work as you expect.

if you chose an id file on C: anywhere, does it work?

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Link to comment
Share on other sites

if you choose the id file on D: and all your @comspec cd operations are supposed to be done in C: but you do not change drive to C:, then i guess this is why it doesn't work as you expect.

if you chose an id file on C: anywhere, does it work?

Hi Orbs,

Yes its working fine if i select any path frm c:.  :) Dont know where is going wrong

Link to comment
Share on other sites

it's obvious then; if you are on D:folder and you do cd c:users then you are still in D:folder. to solve this you need to do C: and then cd users.

anyway, here the solution is much, much, much simpler:

dump all your @comspec saga and replace it with one or two AutoIt FileCopy() calls. FileCopy() has a flag to create the destination directory structure if it does not exist, and it does not depend on your environment.

also come in handy is DirMove() for rename the existing directory.

look at the help file for these commands, it's quite straight-forward. i'm certain you'll get it running in no time.

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...