shornw Posted June 16, 2006 Posted June 16, 2006 Hi all Since the change to au3 I have real problems grasping the concept of "If" but not being able to use "goto". For example I want to check for the existence of a mapped drive and then create a log of users and PC names. I got so far but I keep getting an "if statement has no matching endif statement" error It seems to be caused by the #include<file.au3>, what exactly does this do. Is there somewhere I can get better information about using AutoIt3 other than the help files, they arent bad but a non-programmer like me needs more info Here is the code I tried (its a simple routine, so why am I struggling) If fileExists ("j:\read_ge.txt") then #include <file.au3> $sLogPath = "\\MyServer\MyDocs\mappeddrive.log" _FileWriteLog($sLogPath , @username) Else EndIf Exit I know I'm probably a bit dense but there are several issues related to the lack of "goto" that I cant get my head round. Any help is very much appreciated Thanks [font='Comic Sans MS']Eagles may soar high but weasels dont get sucked into jet engines[/font]
PsaltyDS Posted June 16, 2006 Posted June 16, 2006 Hi all Since the change to au3 I have real problems grasping the concept of "If" but not being able to use "goto". For example I want to check for the existence of a mapped drive and then create a log of users and PC names. I got so far but I keep getting an "if statement has no matching endif statement" error It seems to be caused by the #include<file.au3>, what exactly does this do. Is there somewhere I can get better information about using AutoIt3 other than the help files, they arent bad but a non-programmer like me needs more info Here is the code I tried (its a simple routine, so why am I struggling) If fileExists ("j:\read_ge.txt") then #include <file.au3> $sLogPath = "\\MyServer\MyDocs\mappeddrive.log" _FileWriteLog($sLogPath , @username) Else EndIf Exit I know I'm probably a bit dense but there are several issues related to the lack of "goto" that I cant get my head round. Any help is very much appreciated Thanks I empathize... getting used to GOTO gets you in a habbit of mind that makes it a pain to do it "right". I'm living proof that you can do it without being a rocket scientist, though. You need to put your #Include statements at the very top of your script: #include <file.au3> If fileExists ("j:\read_ge.txt") then $sLogPath = "\\MyServer\MyDocs\mappeddrive.log" _FileWriteLog($sLogPath , @username) EndIf ExitoÝ÷ ÙK"§uéíx)®^®°YazZm§$x'zË^vËZµéÛ¢èZ½æ§´{az·«]¡ë'ßÛ]¡©ò¶§Ê¶$Ú.´w«z+ìZ^Â+a´jëh×6If @MON = "DEC" Then If @Day = "25" Then MsgBox(32, "Test", "Merry Christmas!") Else MsgBox(32, "Test", "It is December, but it's not Christmas.") EndIf Else MsgBox(32, "Test", "It is not December, so it's not Christmas.") EndIf Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
shornw Posted June 16, 2006 Author Posted June 16, 2006 Hi psaltyDS Thanks for this, I have used AutoIt2 for ages and write a lot of batch files so this AutoIt3 is a bit of a 'challenge' however I wont give up...it would be nice if there was a script editor like lkei used to make for AutoIt2 just to get started cos then you can see the proper syntax, or even a better user guide other than the help files. Still ..battle on til I have pulled the last of my hair out Thx again (goto did used to make it really easy tho) [font='Comic Sans MS']Eagles may soar high but weasels dont get sucked into jet engines[/font]
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