copyleft Posted February 11, 2005 Share Posted February 11, 2005 I am a newbie. I want to make an autoit script out of the batch file below but I'm struggling with the goto label. Also how do I get the location of the ramdrv whe I don't know it. Windows recognized %ramdrv% a the correct variable even though the registry desginates the ramdrive at %temp%. if NOT exist %ramdrv% goto ERROR :CHECK md %ramdrv%\New >nul if not errorlevel 0 goto ERROR copy %systemdrive%\test\. %ramdrv%\new >nul goto end :ERROR Echo There was an error. pause goto end :End Exit Link to comment Share on other sites More sharing options...
Wolvereness Posted February 11, 2005 Share Posted February 11, 2005 translate them make the goto into a function call _End() or _Error() Func _End() Exit EndFunc Func _Error() MsgBox(0,'','Error has occured') _End() EndFunc Offering any help to anyone (to my capabilities of course)Want to say thanks? Click here! [quote name='Albert Einstein']Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.[/quote][quote name='Wolvereness' date='7:35PM Central, Jan 11, 2005']I'm NEVER wrong, I call it something else[/quote] Link to comment Share on other sites More sharing options...
trids Posted February 11, 2005 Share Posted February 11, 2005 You can use a dummy loop .. see the Wiki for an example. Link to comment Share on other sites More sharing options...
copyleft Posted February 11, 2005 Author Share Posted February 11, 2005 You can use a dummy loop .. see the Wiki for an example.<{POST_SNAPBACK}>OK. I've come up with this, which seems ok until the end where the endif statment generates an error$var1 = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderPath", "XXX")DirCreate ( "$var1\New" )IfExists("$var1\New") ThenFileCopy("@SystemDir\Test\*.*", "var1\new\*.*"Else MsgBox(0,"", "There was an error")EndIf Link to comment Share on other sites More sharing options...
MCT Posted February 11, 2005 Share Posted February 11, 2005 i think this is wrong.. IfExists($var1 & "\New") Then FileCopy(@SystemDir & "\Test\*.*", $var1 & "\new\*.*" try that? Link to comment Share on other sites More sharing options...
MHz Posted February 11, 2005 Share Posted February 11, 2005 The missing closing brace, on the FileCopy function, would be generating the error. Link to comment Share on other sites More sharing options...
Blue_Drache Posted February 11, 2005 Share Posted February 11, 2005 (edited) Click on the portion of MHz's sig that says "Scite4AutoIt" and use that to write your code in. It's simply marvelous. It makes writing code much easier (not just AU3 either.) And it contains functions and tools that would have notified you of that error before you would have compiled the script. Edited February 11, 2005 by Blue_Drache Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache Link to comment Share on other sites More sharing options...
copyleft Posted February 11, 2005 Author Share Posted February 11, 2005 (edited) Seems like the trailing enclosing parenthesis isn't the problem either. Put it in, AutoIt still flags the "Else" statement in line five. I don't understand because my scrip is almost virtually the same thing as this example in the docs: If FileExists("D:\") Then MsgBox(4096, "", "D: exists.") Else MsgBox(4096,"", "D: does not exist.") EndIf I give up. Edited February 11, 2005 by copyleft Link to comment Share on other sites More sharing options...
Blue_Drache Posted February 11, 2005 Share Posted February 11, 2005 Seems like the trailing enclosing parenthesis isn't the problem either. Put it in, AutoIt still flags the "Else" statement in line five. I don't understand because my scrip is almost virtually the same thing as this example in the docs:If FileExists("D:\") Then MsgBox(4096, "", "D: exists.")Else MsgBox(4096,"", "D: does not exist.")EndIfI give up.<{POST_SNAPBACK}>You're using FileExists for a drive, not a file.Try looking at "DriveGetDrive" Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache Link to comment Share on other sites More sharing options...
trids Posted February 11, 2005 Share Posted February 11, 2005 (edited) Seems like the trailing enclosing parenthesis isn't the problem either. Put it in, AutoIt still flags the "Else" statement in line five.[..]I give up.<{POST_SNAPBACK}>It's probably complaining about the Else cos you don't have an If Edit: it's interpreting your IfExists as a UDF Edited February 11, 2005 by trids Link to comment Share on other sites More sharing options...
layer Posted February 11, 2005 Share Posted February 11, 2005 hey! i was gonna create a Copyleft thing like Copyright... too late it was in one of my consoles i made for autoit too (still working on) sorry for the off topic post... FootbaG Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now