Sign in to follow this  
Followers 0
MattX

Do until or If Else

20 posts in this topic

Stick with me on this as I have not written the code and its still in my head so a rough version will be provided as an example.

I am not sure to use a Do Until or If Else, anyway here is the sort of thing I want to do.

If a file exists on the users N: drive then check for the same file in users application directory on the C: drive.

If both sets of file exist then quit. [ or copy a single file over ]

If the file does not exist on users N: drive then copy some files.

If the file does not exist on users C: drive in the application directory then copy some files.

Copy some more files to the application directory.

Quit.

Hope that makes sense, now do I do this with a Do Until or If & else ?

Reason I am asking is I have never used a Do Until and if it needs it how the hell do I do it ?? Or is my logic messed up like my brain .....?

Share this post


Link to post
Share on other sites



do..until is to set up a loop, say you want to keep checking until something is found.

If ...then....else ...endif is to have the script do something one time when a certain condition is found.

this example would keep looping until my popup is the active window :

do
sleep(100)
until winactive("my popup")
; rest of script

this script would close my popup every time it became active. as it keeps looking

do
sleep(100)
if winactive("my popup") then winclose("my popup")
until 1=2; never going to happen so keeps looping
; rest of script

AutoIt3, the MACGYVER Pocket Knife for computers.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

You might want to use Select case

Using Quote so spaces show

$x=If a file exists on the users N:

$y=check for the same file in users application directory on the C: drive

Select

    Case both sets of file exist

        quit

        ...

    Case  file does not exist on users N: drive

        copy some files.

        ...

    Case file does not exist on users C: drive in the application directory

        copy some files.

        Copy some more files to the application directory.

        ...

EndSelect

obviously not code, but you see how it would work

Edited by scriptkitty

AutoIt3, the MACGYVER Pocket Knife for computers.

Share this post


Link to post
Share on other sites

I have not used Select before - just looked it up in the help but still finding it hard to see how this works. The example means nothing to me, can someone provide a coded example with comments please.

To me the example in the help is setting a set of variables. . .

Share this post


Link to post
Share on other sites

Your explaination of what you want, is a sequence of If's and Then's. So something like?

If FileExists("N:\The_File.exe") Then
      If FileExists(@AppDataDir & "\The_File.exe") Then
         Exit
      Else
         FileCopy(@AppDataDir & "\The_File.exe", )
      EndIf
   EndIf
   If Not FileExists("N:\The_File.exe") Then
      Copy some files
   EndIf
   If Not FileExists('C:\Another aplication directory")
      FileCopy("Copy some files", "Destination")
   EndIf
   FileCopy("Copy some more files", "Destination")
   Exit

Unless you want loop it, then this is similar to what you want?

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

It looks for the first case that works, and does that code, and then goes to endselect.

Select
    Case FileExists("N:\The_File.exe") and FileExists(@AppDataDir & "\The_File.exe")
      Exit
    
    Case FileExists("N:\The_File.exe") and NOT FileExists(@AppDataDir & "\The_File.exe")
      FileCopy(@AppDataDir & "\The_File.exe", )
    
    Case Not FileExists("N:\The_File.exe")
      Copy some files

    Case Not FileExists('C:\Another aplication directory")
      FileCopy("Copy some files", "Destination")
EndSelect

Exit

here is a small example, change the value and watch it work.

$x=1
select
  case $x=1
  msgbox(1,"$x=1",$x)
  
  case $x<1
  msgbox(1,"$x<1",$x)
  
  case $x>0
  msgbox(1,"$x>0",$x)
  
endselect
Edited by scriptkitty

AutoIt3, the MACGYVER Pocket Knife for computers.

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

This might explain my first one a bit better:

$x="yes";If a file exists on the users N:
$y="yes";check for the same file in users application directory on the C: drive

Select
    Case $x="yes" and $y="yes";both sets of file exist
        msgbox(1,"x and y are yes","quit")
        exit;quit
        
    Case $x="no"; file does not exist on users N: drive
        msgbox(1,"$x=no","copy files to N:");copy some files.
        
    Case $y="no";file does not exist on users C: drive in the application directory
        msgbox(1,"$y=no","copy some files to C:");copy some files.
                
EndSelect
;Copy some more files to the application directory.

you could change $x="yes" to $x=FileExists("N:\The_File.exe") this returns 1 or 0 so change case statements to Case $x and $y ;both sets of file exist

example:

$x=FileExists("N:\The_File.exe");If a file exists on the users N:
$y=FileExists("C:\The_File.exe");check for the same file in users application directory on the C: drive
$x=1; this is just to test, use 0 or 1
$y=1; this is just to test, use 0 or 1

Select
   Case $x and $y;both sets of file exist
       msgbox(1,"x and y are yes","quit")
       exit;quit
       
   Case NOT $x; file does not exist on users N: drive
       msgbox(1,"$x=no","copy files to N:");copy some files.
       
   Case NOT $y;file does not exist on users C: drive in the application directory
       msgbox(1,"$y=no","copy some files to C:");copy some files.
               
EndSelect
;Copy some more files to the application directory.
Edited by scriptkitty

AutoIt3, the MACGYVER Pocket Knife for computers.

Share this post


Link to post
Share on other sites

Thanks Scriptkitty and MHz.

Scriptkitty, the last example explains it alot better, in fact I like the look of using Select now !! I think it will have more use in other scripts I have planned.

Many thanks once again.

Share this post


Link to post
Share on other sites

OK using MHZ's example I have come up with this - I cannot test it at the moment as I am not at work till tomorow - can anyone see any flaws in this please ?

And be honest !!

; AutoIt Version:    3
; Language:          English
; Platform:          WinXP
; Author:            Matt Marsh - mmarsh@#########
; Script Function:  Copies over Prefs Java Script file for firefox with correct proxy settings
;                   for both local and re-directed application data folders.

if FileExists ( EnvGet("USERPROFILE") & '\Application Data\Mozilla\Firefox\Profiles.ini' ) then
if FileExists ( 'N:\Application Data\Mozilla\Firefox\Profiles.ini' ) then
        FileDelete ( EnvGet("USERPROFILE") & '\Application Data\Mozilla\Firefox\Prefs.js' )
     FileCopy ( '\\stjohns01\apps\update\Prefs.js', EnvGet("USERPROFILE") & '\Application Data\Mozilla\Firefox\' )  
    else        
DirCreate ( EnvGet("USERPROFILE") & '\Application Data\Mozilla' )
DirCreate ( EnvGet("USERPROFILE") & '\Application Data\Mozilla\Firefox' )
DirCreate ( EnvGet("USERPROFILE") & '\Application Data\Mozilla\Firefox\Profiles' )
DirCreate ( EnvGet("USERPROFILE") & '\Application Data\Mozilla\Firefox\Profiles\60wyitij.default' )
DirCreate ( EnvGet("USERPROFILE") & '\Application Data\Mozilla\Firefox\Profiles\60wyitij.default\Cache' )
DirCreate ( EnvGet("USERPROFILE") & '\Application Data\Mozilla\Firefox\Profiles\60wyitij.default\Chrome' )
DirCreate ( EnvGet("USERPROFILE") & '\Application Data\Mozilla\Firefox\Profiles\60wyitij.default\extensions' )
FileCopy ( '\\stjohns01\apps\update\Mozilla\*.*', EnvGet("USERPROFILE") & '\Application Data\Mozilla\' )
FileCopy ( '\\stjohns01\apps\update\Mozilla\Firefox\*.*', EnvGet("USERPROFILE") & '\Application Data\Mozilla\Firefox\' )
FileCopy ( '\\stjohns01\apps\update\Mozilla\Firefox\Profiles\*.*', EnvGet("USERPROFILE") & '\Application Data\Mozilla\Firefox\Profiles\' )
FileCopy ( '\\stjohns01\apps\update\Mozilla\Firefox\Profiles\60wyitij.default\*.*', EnvGet("USERPROFILE") & '\Application Data\Mozilla\Firefox\Profiles\60wyitij.default\' )
FileCopy ( '\\stjohns01\apps\update\Mozilla\Firefox\Profiles\60wyitij.default\Cache\*.*', EnvGet("USERPROFILE") & '\Application Data\Mozilla\Firefox\Profiles\60wyitij.default\Cache\' )
FileCopy ( '\\stjohns01\apps\update\Mozilla\Firefox\Profiles\60wyitij.default\Chrome\*.*', EnvGet("USERPROFILE") & '\Application Data\Mozilla\Firefox\Profiles\60wyitij.default\Chrome\' )
FileCopy ( '\\stjohns01\apps\update\Mozilla\Firefox\Profiles\60wyitij.default\extensions\*.*', EnvGet("USERPROFILE") & '\Application Data\Mozilla\Firefox\Profiles\60wyitij.default\extensions\' )
Endif
    Endif
If NOT FileExists ( 'N:\Application Data\Mozilla\Firefox\Profiles.ini' ) then
    Dircreate ( 'N:\Application Data\Mozilla' )
    Dircreate ( 'N:\Application Data\Mozilla\Firefox' )
    Dircreate ( 'N:\Application Data\Mozilla\Firefox\Profiles' )
    Dircreate ( 'N:\Application Data\Mozilla\Firefox\Profiles\60wyitij.default' )
    Dircreate ( 'N:\Application Data\Mozilla\Firefox\Profiles\60wyitij.default\Cache' )
    Dircreate ( 'N:\Application Data\Mozilla\Firefox\Profiles\60wyitij.default\Chrome' )
    Dircreate ( 'N:\Application Data\Mozilla\Firefox\Profiles\60wyitij.default\extensions' )
    FileCopy ( '\\stjohns01\apps\update\Mozilla\*.*', 'N:\Application Data\Mozilla\' )
    FileCopy ( '\\stjohns01\apps\update\Mozilla\Firefox\*.*', 'N:\Application Data\Mozilla\Firefox\' )
    FileCopy ( '\\stjohns01\apps\update\Mozilla\Firefox\Profiles\*.*', 'N:\Application Data\Mozilla\Firefox\Profiles\' )
    FileCopy ( '\\stjohns01\apps\update\Mozilla\Firefox\Profiles\60wyitij.default\*.*', 'N:\Application Data\Mozilla\Firefox\Profiles\60wyitij.default\' )
    FileCopy ( '\\stjohns01\apps\update\Mozilla\Firefox\Profiles\60wyitij.default\Cache\*.*', 'N:\Application Data\Mozilla\Firefox\Profiles\60wyitij.default\Cache\' )
    FileCopy ( '\\stjohns01\apps\update\Mozilla\Firefox\Profiles\60wyitij.default\Chrome\*.*', 'N:\Application Data\Mozilla\Firefox\Profiles\60wyitij.default\Chrome\' )
    FileCopy ( '\\stjohns01\apps\update\Mozilla\Firefox\Profiles\60wyitij.default\extensions\*.*', 'N:\Application Data\Mozilla\Firefox\Profiles\60wyitij.default\extensions\' )    
endif       

Run ( 'c:\Program Files\Mozilla Firefox v1\firefox.exe' )

Exit

Share this post


Link to post
Share on other sites

are you sure about your logic? have a look at your script formatted with Tidy:

; autoit version: 3
; language: english
; platform: winxp
; author: matt marsh - mmarsh@#########
; script function: copies over prefs java script file for firefox with correct proxy settings
; for both local and re-directed application data folders.
If FileExists(EnvGet("userprofile") & '\application data\mozilla\firefox\profiles.ini') Then
   If FileExists('n:\application data\mozilla\firefox\profiles.ini') Then
      FileDelete(EnvGet("userprofile") & '\application data\mozilla\firefox\prefs.js')
      FileCopy('\\stjohns01\apps\update\prefs.js', EnvGet("userprofile") & '\application data\mozilla\firefox\')
   Else
      DirCreate(EnvGet("userprofile") & '\application data\mozilla')
      DirCreate(EnvGet("userprofile") & '\application data\mozilla\firefox')
      DirCreate(EnvGet("userprofile") & '\application data\mozilla\firefox\profiles')
      DirCreate(EnvGet("userprofile") & '\application data\mozilla\firefox\profiles\60wyitij.default')
      DirCreate(EnvGet("userprofile") & '\application data\mozilla\firefox\profiles\60wyitij.default\cache')
      DirCreate(EnvGet("userprofile") & '\application data\mozilla\firefox\profiles\60wyitij.default\chrome')
      DirCreate(EnvGet("userprofile") & '\application data\mozilla\firefox\profiles\60wyitij.default\extensions')
      FileCopy('\\stjohns01\apps\update\mozilla\*.*', EnvGet("userprofile") & '\application data\mozilla\')
      FileCopy('\\stjohns01\apps\update\mozilla\firefox\*.*', EnvGet("userprofile") & '\application data\mozilla\firefox\')
      FileCopy('\\stjohns01\apps\update\mozilla\firefox\profiles\*.*', EnvGet("userprofile") & '\application data\mozilla\firefox\profiles\')
      FileCopy('\\stjohns01\apps\update\mozilla\firefox\profiles\60wyitij.default\*.*', EnvGet("userprofile") & '\application data\mozilla\firefox\profiles\60wyitij.default\')
      FileCopy('\\stjohns01\apps\update\mozilla\firefox\profiles\60wyitij.default\cache\*.*', EnvGet("userprofile") & '\application data\mozilla\firefox\profiles\60wyitij.default\cache\')
      FileCopy('\\stjohns01\apps\update\mozilla\firefox\profiles\60wyitij.default\chrome\*.*', EnvGet("userprofile") & '\application data\mozilla\firefox\profiles\60wyitij.default\chrome\')
      FileCopy('\\stjohns01\apps\update\mozilla\firefox\profiles\60wyitij.default\extensions\*.*', EnvGet("userprofile") & '\application data\mozilla\firefox\profiles\60wyitij.default\extensions\')
   EndIf
EndIf
If Not FileExists('n:\application data\mozilla\firefox\profiles.ini') Then
   DirCreate('n:\application data\mozilla')
   DirCreate('n:\application data\mozilla\firefox')
   DirCreate('n:\application data\mozilla\firefox\profiles')
   DirCreate('n:\application data\mozilla\firefox\profiles\60wyitij.default')
   DirCreate('n:\application data\mozilla\firefox\profiles\60wyitij.default\cache')
   DirCreate('n:\application data\mozilla\firefox\profiles\60wyitij.default\chrome')
   DirCreate('n:\application data\mozilla\firefox\profiles\60wyitij.default\extensions')
   FileCopy('\\stjohns01\apps\update\mozilla\*.*', 'n:\application data\mozilla\')
   FileCopy('\\stjohns01\apps\update\mozilla\firefox\*.*', 'n:\application data\mozilla\firefox\')
   FileCopy('\\stjohns01\apps\update\mozilla\firefox\profiles\*.*', 'n:\application data\mozilla\firefox\profiles\')
   FileCopy('\\stjohns01\apps\update\mozilla\firefox\profiles\60wyitij.default\*.*', 'n:\application data\mozilla\firefox\profiles\60wyitij.default\')
   FileCopy('\\stjohns01\apps\update\mozilla\firefox\profiles\60wyitij.default\cache\*.*', 'n:\application data\mozilla\firefox\profiles\60wyitij.default\cache\')
   FileCopy('\\stjohns01\apps\update\mozilla\firefox\profiles\60wyitij.default\chrome\*.*', 'n:\application data\mozilla\firefox\profiles\60wyitij.default\chrome\')
   FileCopy('\\stjohns01\apps\update\mozilla\firefox\profiles\60wyitij.default\extensions\*.*', 'n:\application data\mozilla\firefox\profiles\60wyitij.default\extensions\')
EndIf
Run('c:\program files\mozilla firefox v1\firefox.exe')
Exit

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

Formatted with Tidy ? Please explain !!

Arrr - just installed it - Ooooo, this is rather nifty - thanks !!

I'll stick all my other scripts though it now too.

Edited by MattX

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

Formatted with Tidy ? Please explain !!

<{POST_SNAPBACK}>

I ran your script through Tidy to properly indent your code and these If don't sound logical to me when looking at the formatted code:

If FileExists(EnvGet("userprofile") & '\application data\mozilla\firefox\profiles.ini') Then
  If FileExists('n:\application data\mozilla\firefox\profiles.ini') Then
     FileDelete(EnvGet("userprofile") & '\application data\mozilla\firefox\prefs.js')
     FileCopy('\\stjohns01\apps\update\prefs.js', EnvGet("userprofile") & '\application data\mozilla\firefox\')
  Else
     DirCreate(EnvGet("userprofile") & '\application data\mozilla')
     DirCreate(EnvGet("userprofile") & '\application data\mozilla\firefox')

EDIT: By the way, Tidy is an AutoIt3 script that indents autoit3 scripts "properly"

Edited by JdeB

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

I ran your script through Tidy to properly indent your code and these If don't sound logical to me when looking at the formatted code:

If FileExists(EnvGet("userprofile") & '\application data\mozilla\firefox\profiles.ini') Then
  If FileExists('n:\application data\mozilla\firefox\profiles.ini') Then
     FileDelete(EnvGet("userprofile") & '\application data\mozilla\firefox\prefs.js')
     FileCopy('\\stjohns01\apps\update\prefs.js', EnvGet("userprofile") & '\application data\mozilla\firefox\')
  Else
     DirCreate(EnvGet("userprofile") & '\application data\mozilla')
     DirCreate(EnvGet("userprofile") & '\application data\mozilla\firefox')

<{POST_SNAPBACK}>

The reason for the FileDelete is because sometimes the users like to tinker with the PREFS file so everytime they log back on, their current one is deleted and the correct one is copied over. Is that the logic problem you saw ?

Thanks for pointing me in the direction of tidy btw - appreciate that.

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

The reason for the FileDelete is because sometimes the users like to tinker with the PREFS file so everytime they log back on, their current one is deleted and the correct one is copied over. Is that the logic problem you saw ?

Thanks for pointing me in the direction of tidy btw - appreciate that.

<{POST_SNAPBACK}>

I guess the thing i don't understand is this:

you test in the first for the existance of file:

EnvGet("userprofile") & '\application data\mozilla\firefox\profiles.ini'

If it does you test if fileexit :

'n:\application data\mozilla\firefox\profiles.ini'exists. If that doesn't exits you start creating a bunch of directories starting with:

EnvGet("userprofile") & '\application data\mozilla' But in your first If you already tested for its existance ......

Shouldn't the Else condition go together with the First If in stead of the Second If ?

Edited by JdeB

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

I guess the thing i don't understand is this:

you test in the first for the existance of file:

EnvGet("userprofile") & '\application data\mozilla\firefox\profiles.ini'

If it does you test if fileexit :

'n:\application data\mozilla\firefox\profiles.ini'exists. If that doesn't exits you start creating a bunch of directories starting with:

EnvGet("userprofile") & '\application data\mozilla' But in your first If you already tested for its existance ......

Shouldn't the Else condition go together with the First If in stead of the Second If ?

<{POST_SNAPBACK}>

The problem I have is that some users on my network have not used firefox yet, I have seen problems in which users have started it up for the first time and when they do, the Mozilla dir is created on the local profile but not on the re-directed profile from the their N: drive. [ I'm in the middle of moving users to the new firefox version which users profiles ] Firefox then gets in a tis and hangs.

I need to check [ and please correct me if you think I am wrong !! ] if both the files exist on the N: and the user profile [ on the PC's C: drive ], that way I think I am covering all angles. If the files exist then I want firefox to launch, if not then I want the folders created a load of files to be copied and then firefox to launch.

Does that make sence ?

Share this post


Link to post
Share on other sites

#16 ·  Posted (edited)

The problem I have is that some users on my network have not used firefox yet, I have seen problems in which users have started it up for the first time and when they do, the Mozilla dir is created on the local profile but not on the re-directed profile from the their N: drive. [ I'm in the middle of moving users to the new firefox version which users profiles ] Firefox then gets in a tis and hangs.

I need to check [ and please correct me if you think I am wrong !! ] if both the files exist on the N: and the user profile [ on the PC's C: drive ], that way I think I am covering all angles. If the files exist then I want firefox to launch, if not then I want the folders created a load of files to be copied and then firefox to launch.

Does that make sence ?

<{POST_SNAPBACK}>

I am not sure if I really understand the mix of local and server profile stuff you do, but i you know best... :)

I guess i expected the script to look something like the below ...

; autoit version: 3
; language: english
; platform: winxp
; author: matt marsh - mmarsh@#########
; script function: copies over prefs java script file for firefox with correct proxy settings
; for both local and re-directed application data folders.
If Not FileExists(EnvGet("userprofile") & '\application data\mozilla\firefox\profiles.ini') Then
   DirCreate(EnvGet("userprofile") & '\application data\mozilla')
   DirCreate(EnvGet("userprofile") & '\application data\mozilla\firefox')
   DirCreate(EnvGet("userprofile") & '\application data\mozilla\firefox\profiles')
   DirCreate(EnvGet("userprofile") & '\application data\mozilla\firefox\profiles\60wyitij.default')
   DirCreate(EnvGet("userprofile") & '\application data\mozilla\firefox\profiles\60wyitij.default\cache')
   DirCreate(EnvGet("userprofile") & '\application data\mozilla\firefox\profiles\60wyitij.default\chrome')
   DirCreate(EnvGet("userprofile") & '\application data\mozilla\firefox\profiles\60wyitij.default\extensions')
   FileCopy('\\stjohns01\apps\update\mozilla\*.*', EnvGet("userprofile") & '\application data\mozilla\')
   FileCopy('\\stjohns01\apps\update\mozilla\firefox\*.*', EnvGet("userprofile") & '\application data\mozilla\firefox\')
   FileCopy('\\stjohns01\apps\update\mozilla\firefox\profiles\*.*', EnvGet("userprofile") & '\application data\mozilla\firefox\profiles\')
   FileCopy('\\stjohns01\apps\update\mozilla\firefox\profiles\60wyitij.default\*.*', EnvGet("userprofile") & '\application data\mozilla\firefox\profiles\60wyitij.default\')
   FileCopy('\\stjohns01\apps\update\mozilla\firefox\profiles\60wyitij.default\cache\*.*', EnvGet("userprofile") & '\application data\mozilla\firefox\profiles\60wyitij.default\cache\')
   FileCopy('\\stjohns01\apps\update\mozilla\firefox\profiles\60wyitij.default\chrome\*.*', EnvGet("userprofile") & '\application data\mozilla\firefox\profiles\60wyitij.default\chrome\')
   FileCopy('\\stjohns01\apps\update\mozilla\firefox\profiles\60wyitij.default\extensions\*.*', EnvGet("userprofile") & '\application data\mozilla\firefox\profiles\60wyitij.default\extensions\')
EndIf
If Not FileExists('n:\application data\mozilla\firefox\profiles.ini') Then
   DirCreate('n:\application data\mozilla')
   DirCreate('n:\application data\mozilla\firefox')
   DirCreate('n:\application data\mozilla\firefox\profiles')
   DirCreate('n:\application data\mozilla\firefox\profiles\60wyitij.default')
   DirCreate('n:\application data\mozilla\firefox\profiles\60wyitij.default\cache')
   DirCreate('n:\application data\mozilla\firefox\profiles\60wyitij.default\chrome')
   DirCreate('n:\application data\mozilla\firefox\profiles\60wyitij.default\extensions')
   FileCopy('\\stjohns01\apps\update\mozilla\*.*', 'n:\application data\mozilla\')
   FileCopy('\\stjohns01\apps\update\mozilla\firefox\*.*', 'n:\application data\mozilla\firefox\')
   FileCopy('\\stjohns01\apps\update\mozilla\firefox\profiles\*.*', 'n:\application data\mozilla\firefox\profiles\')
   FileCopy('\\stjohns01\apps\update\mozilla\firefox\profiles\60wyitij.default\*.*', 'n:\application data\mozilla\firefox\profiles\60wyitij.default\')
   FileCopy('\\stjohns01\apps\update\mozilla\firefox\profiles\60wyitij.default\cache\*.*', 'n:\application data\mozilla\firefox\profiles\60wyitij.default\cache\')
   FileCopy('\\stjohns01\apps\update\mozilla\firefox\profiles\60wyitij.default\chrome\*.*', 'n:\application data\mozilla\firefox\profiles\60wyitij.default\chrome\')
   FileCopy('\\stjohns01\apps\update\mozilla\firefox\profiles\60wyitij.default\extensions\*.*', 'n:\application data\mozilla\firefox\profiles\60wyitij.default\extensions\')
EndIf
If FileExists('n:\application data\mozilla\firefox\profiles.ini') Then
   FileDelete(EnvGet("userprofile") & '\application data\mozilla\firefox\prefs.js')
   FileCopy('\\stjohns01\apps\update\prefs.js', EnvGet("userprofile") & '\application data\mozilla\firefox\')
EndIf
Run('c:\program files\mozilla firefox v1\firefox.exe')
Exit
Edited by JdeB

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#17 ·  Posted (edited)

I'm back in the office tomorow so I'll test the script then - I'll let you know what happens. If it all goes to pot, I may end up using yours !!

Thanks for the help btw.

Edited by MattX

Share this post


Link to post
Share on other sites

You were correct JdeB - the Else did need to be moved to work with the First If. Now thats in place I have all circumstances covered. Thanks for pointing that out - I am in the middle of rolling that script out now.

Share this post


Link to post
Share on other sites

That's an idea. Instead of patching IE each month, you deploy Firefox.

Share this post


Link to post
Share on other sites

That's an idea. Instead of patching IE each month, you deploy Firefox.

<{POST_SNAPBACK}>

The whole issue of me moving our users over to the new version from the old would have been a hell of a lot easier if the person who set it up to start with [ not me ] had setup the profiles aspect properly first. He used a profile which was set to a shared drive on our server !! So you can imagine the mess with all that.

Hopefully with all bases covered - [ script which copies over a profile to the users profile on the device they logon to and the profile which is created on their home dir, everything is sorted. ] Having mandatory profiles is a nightmare to maintain - [ again, not my idea ] Thank god for Autoit !!

Share this post


Link to post
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
Sign in to follow this  
Followers 0