Siginet Posted May 24, 2005 Share Posted May 24, 2005 I have had bad experiances with using the command @ScriptDir in my autoits... maybe that is the same issue you are having. Sometimes if you use @ScriptDir in an autoit and call that autoit from a batch file which lies elsewhere it looks at the batch files destination as the current directory and then you run into problems.I have gotten into the habit of using this code...AutoItSetOption ( "ExpandEnvStrings", 1 )RunWait(@ComSpec & " /c for %%i in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do if exist %%i:\WIN51 set CDROM=%%i:", "", @SW_HIDE)It is the same code others use in their batch files to set an environment variable "%CDROM%" to point to their UACD. This way you can put your apps on your cd and not have them copied to the HD. Also you can point directly to the file instead of using @ScriptDir.Try that... it may help you. Link to comment Share on other sites More sharing options...
DLF Posted May 24, 2005 Author Share Posted May 24, 2005 @et alAll suggestions = useful and coherant and much appreciated and I can now personally write very crude scripts that get the job done, but going back to my orig thread question, I just wish someone who has some experience would write a definitive guide to implementing AutoIT thru' RunOnceEx, and then it could be added to the AutoIT thread as there are many superbly scripted au3 files available to all there, but no mention of what to actually do with them for beginners - and I feel this disuades them from using what is a very useful application.And it seems that as with everything else in life and computing, there are also more ways than one to get the job done. I still feel a basic guide...e.g.... 1]D/load a simple au3 script for a bit of well known freeware.2]How to compile into your .exe3]How to "call" your script from the 2 most popular methods - RunOnceEx and Batch_file.cmd4]Basic do's and dont's etc. (e.g. I was using Notepad till someone suggested SCite, which has superb syntax checking etc)....either on the main UA website or Stickied here at the start of the AutoIT thread would benefit the newer members of the forum if someone has the time/inclination to do it. Link to comment Share on other sites More sharing options...
MAVERICKS CHOICE Posted May 24, 2005 Share Posted May 24, 2005 Look guys haven't read the entire thread here, but the best way I found is to test & play with known working scripts that other members have produced, also as Mhz said use the built in Autoit tools etc, just lots of effort & testing. Oh the Autoit forums is another good place to visit its all a bit daunting at first but not that difficult really. Link to comment Share on other sites More sharing options...
MHz Posted May 24, 2005 Share Posted May 24, 2005 I have had bad experiances with using the command @ScriptDir in my autoits... maybe that is the same issue you are having. Sometimes if you use @ScriptDir in an autoit and call that autoit from a batch file which lies elsewhere it looks at the batch files destination as the current directory and then you run into problems.I have gotten into the habit of using this code...AutoItSetOption ( "ExpandEnvStrings", 1 )RunWait(@ComSpec & " /c for %%i in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do if exist %%i:\WIN51 set CDROM=%%i:", "", @SW_HIDE)It is the same code others use in their batch files to set an environment variable "%CDROM%" to point to their UACD. This way you can put your apps on your cd and not have them copied to the HD. Also you can point directly to the file instead of using @ScriptDir.Try that... it may help you. <{POST_SNAPBACK}>Sorry, I have to say this but...Absolutely not. You are creatimg a dos variable, that last as long as the batch or dos window session. In this instance, breifly, as long as this dos window is open.Try this, what does the messagebox say ?AutoItSetOption ( "ExpandEnvStrings", 1 )RunWait(@ComSpec & " /c for %%i in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do if exist %%i:\WIN51 set CDROM=%%i:", "", @SW_HIDE); This will fail.Sleep(1000)$result = EnvGet('CDROM')MsgBox(0, '', 'CDROM = ' & $result); This will work.Sleep(1000)$result = EnvGet('WINDIR')MsgBox(0, '', 'WINDIR = ' & $result)@ScriptDir work's perfectly everytime. Anyone who doubts this, has not enough experience with AutoIt. As MAVERICKS CHOICE has stated, the AutoIt forum is also a great resource for learning. I'm regularly there to help. And again MAVERICKS CHOICE is right about toying with it. Over 300+ imbuilt functions within AutoIt, there is alot to test and learn. It's a feature rich basic language, better then others, that i know. I believe I have enough confidence with AutoIt, I should have, with making scripts that go up to 3000 lines long. Use of multidimentional array's etc. And well, some basic knowledge in DOS, definately helps also.Sorry Siginet, I mean no hostility. I just like to help.Here is my runonceex, with my CDFind() function.RunOnceEx.html Link to comment Share on other sites More sharing options...
DLF Posted May 24, 2005 Author Share Posted May 24, 2005 a definitive guide to implementing AutoIT thru' RunOnceEx In case I've caused any confusion, the guide I would like to see would be how to run the odd one or two entries during RunOnceEx execution with AutoIT.I have a perfectly good working RunOnceEx that installs all my apps as normal (switches or 7z switchless) and its the odd "problem" app that has got a strange installer that needs the AutoIT treatment.Not a complete rollout of all apps post-Windows install via AutoIT. Link to comment Share on other sites More sharing options...
Siginet Posted May 24, 2005 Share Posted May 24, 2005 Don't know why I thought it worked for me in the past.But this would work.If FileExists ("C:\WIN51") Then EnvSet ("CDROM", "C:\") EndIfIf FileExists ("D:\WIN51") Then EnvSet ("CDROM", "D:\") EndIfIf FileExists ("E:\WIN51") Then EnvSet ("CDROM", "E:\") EndIfIf FileExists ("F:\WIN51") Then EnvSet ("CDROM", "F:\") EndIfIf FileExists ("G:\WIN51") Then EnvSet ("CDROM", "G:\") EndIfIf FileExists ("H:\WIN51") Then EnvSet ("CDROM", "H:\") EndIfIf FileExists ("I:\WIN51") Then EnvSet ("CDROM", "I:\") EndIfIf FileExists ("J:\WIN51") Then EnvSet ("CDROM", "J:\") EndIfIf FileExists ("K:\WIN51") Then EnvSet ("CDROM", "K:\") EndIfIf FileExists ("L:\WIN51") Then EnvSet ("CDROM", "L:\") EndIf... Link to comment Share on other sites More sharing options...
Vadikan Posted May 25, 2005 Share Posted May 25, 2005 My 2c. Like other members stated, looking into other scripts can be useful. I've learned the method below from some script posted on the board, and it works just fine in RunOnceEx.Both the script and the app setup file go in the same dir. RunOnceEx containsREG ADD %KEY%\001 /V 1 /D "%CDROM%\PROGRAMS\script.exe setup.exe" /fand the script begins with Run ($CmdLine[1])In other words, run the compiled script with a parameter that matches the application setup file name and then use this parameter in the script. Actually, the tecnique is described in Running Scripts section of the manual. 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