Jump to content

Fileexist Problems


Recommended Posts

all i'm trying to is get the cd drive letter and put it into fileexist, but I can't seem to get it to work, i'm coping the variable $var[0] into $drive variable which seems to work but when i use $drive variable in fileexist i can't seem to get the syntax right.

this is the code below

$var = DriveGetDrive( "all" )

If NOT @error Then

MsgBox(4096,"", "Found " & $var[0] & " drives")

For $i = 1 to $var[0]

MsgBox(4096,"Drive " & $i, $var[$i])

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

$drive = $var[$i]

msgbox(4096,"", $drive,

":\\patches\\patch1.3\\patch1.3.exe")

If FileExists("$drive:\\patches\\patch1.3\\patch1.3.exe") Then

MsgBox(4096, "D: exists.", $var[$i])

Else

MsgBox(4096, " does not exist.", $var[$i])

EndIf

Next

EndIf;

Link to comment
Share on other sites

  • Developers

try replacing the "\\" for a "\"

"\\" is ver2 syntax.

Edit: Should also be -> $drive & "\patches\patch1.3\patch1.3.exe"

$var = DriveGetDrive( "all" )
If NOT @error Then
   MsgBox(4096,"", "Found " & $var[0] & " drives")
   For $i = 1 to $var[0]
      MsgBox(4096,"Drive " & $i, $var[$i])
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
      $drive = $var[$i]
      msgbox(4096,"", $drive & "\patches\patch1.3\patch1.3.exe")
      If FileExists($drive & "\patches\patch1.3\patch1.3.exe") Then
         MsgBox(4096, "D: exists.", $var[$i])
      Else
         MsgBox(4096, " does not exist.", $var[$i])
      EndIf
   Next
EndIf
Edited by JdeB

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

all i'm trying to is get the cd drive letter and put it into fileexist, but I can't seem to get it to work, i'm coping the variable $var[0] into $drive  variable which seems to work but when i use $drive variable in fileexist i can't seem to get the syntax right.

this is the code below

$var = DriveGetDrive( "all" )

If NOT @error Then

    MsgBox(4096,"", "Found " & $var[0] & " drives")

    For $i = 1 to $var[0]

        MsgBox(4096,"Drive " & $i, $var[$i])

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

$drive = $var[$i]

msgbox(4096,"",  $drive,

":\\patches\\patch1.3\\patch1.3.exe")

If FileExists("$drive:\\patches\\patch1.3\\patch1.3.exe") Then

    MsgBox(4096, "D: exists.", $var[$i])

Else

    MsgBox(4096, " does not exist.", $var[$i])

EndIf

 

Next

EndIf;

You shoud use the Wonderfull translator AutpoItV2toV3 B)

; V2.64 to V3.0.90 (Version 1.0.3)

; Converted with AutoItV2toV3 [Version 1.0.3]; © Copyright 2004 J-Paul Mesnage.

; Prologue  ; should be renamed (?) and called somewhere if you are converting  an include file

__init()

; End Prologue

$__msgbox = MsgBox ( 0, 'autoit', 'INSTALLING PATCH PLEASE PRESS OK.' )

$alpha = 'defghijklmnopqrstuvwxyz'

$count = 0

for $__n1_ = 1 to 26

    $count = $count + 1

    $char = StringMid( $alpha, $count, 1 )

;checks the charter in %char% and the file path to see if the files are in the cd selected

    if FileExists ( $char & ':\patch\patch1.2.exe' ) then

        $cd = $char

    endif

next

; Epilogue Extra Functions needed for Compatibility execution

;    take care of possible redefinition if you are converting  an include file

;

func __init ()  ; to define global variables needed

endfunc

; End Epilogue

that's an translation of the code you were using in V2.

Just Click&Go :whistle:

That is showing the \\ to \ change

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...