Jump to content

Help required with first script please


Recommended Posts

Hi everybody,

i'm as new as new can get to autoit. I'm working on a script that is supposed to download un update from internet, than unrar it and than copy the files to their intended directory in a certain order.

I did research on this forum and was able to find how to download the update form the internet

CODE
DirCreate ("the directory")

#include <Inet.au3>

$sSource = _INetGetSource("the web site")

$aArray = StringRegExp($sSource, '(?s)(?i)\<A HREF\="(\d{8}-\d{3}-i32\.exe)"', 3)

If IsArray($aArray) Then InetGet("the web site" & $aArray[uBound($aArray) - 1], "the directory" & $aArray[uBound($aArray) - 1])

this is working just fine, since it was easy to understand how to adjust it to do what i wanted it to do on my computer.

Now my question is about the next part of the script where its supposed to unrar the file:

CODE
Run (@COMSPEC & " /c " & '"' & "start " & "C:\Program Files\WinRAR\winrar.exe" & " x " & "-o- " & "-- " & "C:\Program Files\WinRAR\rar.exe" & "C:\Documents and Settings\user\Desktop\temp\thefile.rar" & " " & "C:\Documents and Settings\user\Desktop\temp\")

do

sleep(2500)

until ProcessExists ( "rar.exe" ) = 0

the problem is when it gets to reading "C:\Program Files\WinRAR\winrar.exe" it gives an eror saying:

"Windows cannot find 'c:\Program'. Make sure you typed the name correctly and than try again."

Can anybody tell me what is wrong with this string of code and whether it will do what i think it should.

I ask this because i extractet this part of the code from WhiteCrows script (thank you to white crow :shocked:http://www.autoitscript.com/forum/index.ph...5&hl=winrar

but i do not completely understand what the code means, so i was just trying to figure it out for my self.

Please pardon my english it is not my native language,

and i'm thankfull for all the help that i might get.

Boris.

Link to comment
Share on other sites

The problem is that there is a space between program and files, so it stops reading the string after 'program'.

Use "@ProgramFilesDir"

It would look like this: Run (@COMSPEC & " /c " & '"' & "start " & "@ProgramFilesDir\WinRAR\winrar.exe" & " x " & "-o- " & "-- " & "@ProgramFilesDir\WinRAR\rar.exe" & "@DocumentsCommonDir\user\Desktop\temp\thefile.rar" & " " & "@DocumentsCommonDir\user\Desktop\temp\")

I also added the @DocumentsCommonDir because that would have made problems too.

Tell me if it works, and good luck.

edit: changed @MyDocumentsDir to @DocumentsCommonDir

Edited by alex OF DEATH
Link to comment
Share on other sites

Thanks for the advice, Alex but unfortunately it still dosen't work. Now it gives the same eror message only it says it can't find "@ProgramFilesDir\WinRAR\winrar.exe"

i even tryend it withiut Dir in the path but it still cant find it

Any ideas?

The problem is that there is a space between program and files, so it stops reading the string after 'program'.

Use "@ProgramFilesDir"

It would look like this: Run (@COMSPEC & " /c " & '"' & "start " & "@ProgramFilesDir\WinRAR\winrar.exe" & " x " & "-o- " & "-- " & "@ProgramFilesDir\WinRAR\rar.exe" & "@DocumentsCommonDir\user\Desktop\temp\thefile.rar" & " " & "@DocumentsCommonDir\user\Desktop\temp\")

I also added the @DocumentsCommonDir because that would have made problems too.

Tell me if it works, and good luck.

edit: changed @MyDocumentsDir to @DocumentsCommonDir

Link to comment
Share on other sites

It's not the @ProgramFilesDir and macros being needed , it's the placement of quotes.....

Run (@COMSPEC & ' /c ' & '""' & 'start ' & '"C:\Program Files\WinRAR\winrar.exe"' & ' x -o- -- ' & '"C:\Program Files\WinRAR\rar.exe"' & '"C:\Documents and Settings\user\Desktop\temp\thefile.rar"' & ' ' & '"C:\Documents and Settings\user\Desktop\temp\"')oÝ÷ Ø  ÝjÇ讫¨µâ-Â¥vZ(X¤zØb±§ãº ­©W¬*ô÷e¢ÓÝ«j·±z«¨µ©©ªê-.éí°*&ý=Úë¯Ov
ë$¶t÷k^=ÚØ^~)^­ªêºZ®¢Ú®¢Ö¦¦«¨´:ºg§¶À¨j'*ô÷k¬z½=Ø7¬Ú)ÓÝ­zjt÷j®¢ßêº^¬z+l¥u·¦¢·¥GºÚ"µÍ[
ÓÓTÔPÈ  [È ÌÎNÈØÈ ÌÎNÈ [È ÌÎNÉ][ÝÉ][ÝÉÌÎNÈ  [È ÌÎNÜÝ   ÌÎNÈ [È ÌÎNÉ][ÝÉÌÎNÈ    [ÈÙÜ[Q[Ñ    [È ÌÎNÉÌLÕÚ[TÌLÝÚ[^I][ÝÉÌÎNÈ [È ÌÎNÈ[ËHKH   ÌÎNÈ [È ÌÎNÉ][ÝÉÌÎNÈ    [ÈÙÜ[Q[Ñ    [È ÌÎNÉÌLÕÚ[TÌLÜ^I][ÝÉÌÎNÈ    [È ÌÎNÉ][ÝÉÌÎNÈ    [ÈÚÝÜÛÛ[[Û   [È ÌÎNÉÌLÝ[   ÌLÝY[K][ÝÉÌÎNÈ   [È ÌÎNÈ ÌÎNÈ [È ÌÎNÉ][ÝÉÌÎNÈ    [ÈÚÝÜÛÛ[[Û   [È ÌÎNÉÌLÝ[   ÌLÉ][ÝÉÌÎNÊ

Not say what I've typed will work, but it will run and return >Exit code: 0 in scite if the paths are true..

Cheers

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