Grof Posted June 26, 2019 Share Posted June 26, 2019 I know, it's simple, but I've made a mistake... The code: Local $vVariable = "MyApp" DirCreate ("@AppDataDir\" & MyApp) I Wanna create a variable, assign the value "MyApp" and create in AppData a folder named "MyApp" The error is Unknown funtion name. What's wrong? Thanks. Link to comment Share on other sites More sharing options...
Earthshine Posted June 26, 2019 Share Posted June 26, 2019 (edited) if you even bothered to look up DirCreate in the help file and run the sample code, you would have your answer. #include <AutoItConstants.au3> #include <MsgBoxConstants.au3> Example() Func Example() ; Create a constant variable in Local scope of the directory. Local Const $sFilePath = @TempDir & "\DirCreateFolder" ; If the directory exists the don't continue. If FileExists($sFilePath) Then MsgBox($MB_SYSTEMMODAL, "", "An error occurred. The directory already exists.") Return False EndIf ; Open the temporary directory. ShellExecute(@TempDir) ; Create the directory. DirCreate($sFilePath) ; Display a message of the directory creation. MsgBox($MB_SYSTEMMODAL, "", "The directory has been created.") ; Remove the directory and all sub-directories. DirRemove($sFilePath, $DIR_REMOVE) ; Display a message of the directory removal. MsgBox($MB_SYSTEMMODAL, "", "The sub folder: Folder2 has been deleted.") EndFunc ;==>Example you want code to learn from? use the help file and the example code provided please you define a variable named $vVariable so use that instead of MyApp in the dircreate, as is shown in the example. Please start to use the help file to learn, as it was meant to be, then when you are stuck, ask for help AND provide your code, or an example of your code that others can test and help you debug Edited June 26, 2019 by Earthshine My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
Grof Posted June 26, 2019 Author Share Posted June 26, 2019 Thanks for the answer. I have read: https://www.autoitscript.com/autoit3/docs/functions/DirCreate.htm I have compiled your code and works fine , but it isn't what I was looking for. Your variable value is "AppData\MyApp", right? I want a variable value "MyApp" and concatenate it to an environment variable... Is it possible? Link to comment Share on other sites More sharing options...
Developers Jos Posted June 26, 2019 Developers Share Posted June 26, 2019 35 minutes ago, Grof said: DirCreate ("@AppDataDir\" & MyApp) should be DirCreate (@AppDataDir & "\" & MyApp) Jos Earthshine 1 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 More sharing options...
Grof Posted June 26, 2019 Author Share Posted June 26, 2019 Thanks Link to comment Share on other sites More sharing options...
Grof Posted June 26, 2019 Author Share Posted June 26, 2019 (edited) Now I'm trying to pass a variable to another variable with environment variable: Local $vVariable = "MyApp" Local $sFilePath = @AppDataDir & "\" & MyApp MsgBox ($sFilePath) Doesn't exit MsgBox (same error)! Edited June 26, 2019 by Grof Link to comment Share on other sites More sharing options...
Developers Jos Posted June 26, 2019 Developers Share Posted June 26, 2019 Just look at your script again and think about what could be wrong there with the variable you try to concatenate at the end. 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 More sharing options...
Grof Posted June 26, 2019 Author Share Posted June 26, 2019 (edited) I suppose the name of variable is $vVariable (and not Myapp), and msgbox were missing parameters... Edited June 26, 2019 by Grof Link to comment Share on other sites More sharing options...
Developers Jos Posted June 26, 2019 Developers Share Posted June 26, 2019 15 minutes ago, Grof said: I suppose the name of variable is $vVariable (and not Myapp), and msgbox were missing parameters... You still "suppose" or did you try and did it work? 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 More sharing options...
Grof Posted June 26, 2019 Author Share Posted June 26, 2019 I know i'm missing for msgbox #include <MsgBoxConstants.au3> I suppose they have the same function in NSIS. (.nsh) How many are the include? Where can I download them? And where must they placed? Link to comment Share on other sites More sharing options...
Developers Jos Posted June 26, 2019 Developers Share Posted June 26, 2019 1 minute ago, Grof said: How many are the include? Where can I download them? And where must they placed? Many and no need to download as they are part of the standard installer found in the Autoit/Include directory. 1 hour ago, Grof said: Doesn't exit MsgBox (same error)! You really need to learn to open the helpfile and check the appropriate syntax of commands as the msgbox() is also wrong in that code. One other helpfull tool is to install the full SciTE4AutoIt3 installer as that will always run au3check for you when doing run, which will give you more clear syntax error/warning messages. Jos 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 More sharing options...
Grof Posted June 26, 2019 Author Share Posted June 26, 2019 OK 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