Jump to content

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Posted (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 by Earthshine

My resources are limited. You must ask the right questions

 

Share this post


Link to post
Share on other sites
35 minutes ago, Grof said:

DirCreate ("@AppDataDir\" & MyApp)

should be

DirCreate (@AppDataDir & "\" & MyApp)

Jos

Share this post


Link to post
Share on other sites
Posted (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 by Grof

Share this post


Link to post
Share on other sites

Just look at your script again and think about what could be wrong there with the variable you try to concatenate at the end. ;)

Share this post


Link to post
Share on other sites
Posted (edited)

I suppose the name of variable is $vVariable (and not Myapp), and msgbox were missing parameters...

Edited by Grof

Share this post


Link to post
Share on other sites
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? :) 

Share this post


Link to post
Share on other sites

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?

 

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
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

×
×
  • Create New...