Jump to content

Variable


Guest marno
 Share

Recommended Posts

Hi,

i have a prog 1.exe and a file 1.txt

i want to do this :

For $i = 1 to 24 Step 1

If FileExists("c:\WINNT\$i.txt") then

; Nothing

else

FileCopy ( '\\Serveur\TEMP\$i.txt','c:\WINNT',0)

RunWait("\\Serveur\SECURITE\$i.exe -u", "\\Serveur\SECURITE", @SW_HIDE)

endif

Next

I have an error msg : can't find \\Serveur\SECURITE\$i.exe

The script try to start $i.exe and not 1.exe ;)

Link to comment
Share on other sites

ok step by step...

For $i = 1 to 24 Step 1

; bla... bla

Next

will do 24 files...

do you only have 1 exe and 1 text file????

8)

yes i have 24 text files and 24 exe
Link to comment
Share on other sites

Hi,

i have a prog 1.exe and a file 1.txt

i want to do this :

For $i = 1 to 24 Step 1

If FileExists("c:\WINNT\$i.txt") then

; Nothing

else

FileCopy ( '\\Serveur\TEMP\$i.txt','c:\WINNT',0)

RunWait("\\Serveur\SECURITE\$i.exe -u", "\\Serveur\SECURITE", @SW_HIDE)

endif

Next

I have an error msg : can't find \\Serveur\SECURITE\$i.exe

The script try to start $i.exe and not 1.exe ;)

this states that your looking at a file and if it exists

If FileExists("c:\WINNT\$i.txt") then

but... then you try to copy from another source to the one you checked

FileCopy ( '\\Serveur\TEMP\$i.txt','c:\WINNT',0)

maybe you have it reversed and want this

FileCopy ( "source", "dest" [, flag] )

FileCopy ( 'c:\WINNT', '\\Serveur\TEMP\$i.txt',0)

????

8)

NEWHeader1.png

Link to comment
Share on other sites

this states that your looking at a file and if it exists

If FileExists("c:\WINNT\$i.txt") then

but... then you try to copy from another source to the one you checked

FileCopy ( '\\Serveur\TEMP\$i.txt','c:\WINNT',0)

maybe you have it reversed and want this

FileCopy ( "source", "dest" [, flag] )

FileCopy ( 'c:\WINNT', '\\Serveur\TEMP\$i.txt',0)

????

8)

My source : \\serveur\TEMP\1 .... 24.txt

I want to make a script which permit me to install 24 Updates. Some update need a reboot so i need to test.

Link to comment
Share on other sites

this

FileCopy ( '\\Serveur\TEMP\$i.txt','c:\WINNT',0)

should be this

FileCopy ( '\\Serveur\TEMP\$i.txt','c:\WINNT\',0)

AND....

this copies ALL FILES in the source to the destination

FileCopy("C:\old\*.*", "C:\new\")

thus this copies ALL TEXT FILES

FileCopy("C:\old\*.txt", "C:\new\")

if you can use this there is no need for

For $i = 1 to 24 Step 1

; bla... bla

Next

8)

Edited by Valuater

NEWHeader1.png

Link to comment
Share on other sites

your main problem is here

If FileExists("c:\WINNT\$i.txt") then

should be

If FileExists("c:\WINNT\" & $i & ".txt") then

and here

RunWait("\\Serveur\SECURITE\$i.exe -u", "\\Serveur\SECURITE", @SW_HIDE)

should be

RunWait("\\Serveur\SECURITE\" & $i & ".exe -u", "\\Serveur\SECURITE", @SW_HIDE)

Edit:

forgot the filecopy one

FileCopy ( '\\Serveur\TEMP\$i.txt','c:\WINNT',0)

should be

FileCopy ( '\\Serveur\TEMP\" & $i & ".txt','c:\WINNT',0)

Edited by drak
Link to comment
Share on other sites

Thx a lot !!!!!

But for this

FileCopy ( '\\Serveur\TEMP\$i.txt','c:\WINNT',0)

should be

FileCopy ( '\\Serveur\TEMP\" & $i & ".txt','c:\WINNT',0)

should be

FileCopy ("\\Serveur\TEMP\" & $i & ".txt", "c:\WINNT\",0)

Fine i love autoit !!!

Link to comment
Share on other sites

Funny how people read over simple mistakes I saw it instantly but that because I ate loads of sugar.

Final and short

For $i = 1 to 24;changed step 1 default is 1 not nessesary
If Not FileExists("c:\WINNT\"  & $i & ".txt") then; just use NOT (not else here)
FileCopy ( '\\Serveur\TEMP\'  & $i & '.txt','c:\WINNT',0)
RunWait("\\Serveur\SECURITE\"  & $i & ".exe -u", "\\Serveur\SECURITE", @SW_HIDE)
endif
Next

Please read syntax rules first its not PHP code so variables need to be outside of " " or ' '

Edited by MrSpacely
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...