Sign in to follow this  
Followers 0
regis

Variable return to a path directory

10 posts in this topic

Hello everybody,

I want to make a script who made this but in autoit:

Net use X: \\server\share\%username%

I made this

DriveMapAdd ("x:, "\\server\share\'@username")

But the @username variable have not been reconized.

How can i do for return the username into the path directory?

Sorry for my bad english.

Thank's

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Welcome to AutoIt...

You have @username between quotes.

Try this ==> DriveMapAdd ("x:", "\\server\share\" & @username)

Edited by Danny35d

AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line

Share this post


Link to post
Share on other sites

Welcome to AutoIt...

You have @username between quotes.

Try this ==> DriveMapAdd ("x:", "\\server\share\" & @username)

Fast and correct thank you very much

i was trying DriveMapAdd ("x:", "\\server\share\ & @username")

but it didn't work anymore just for a bad quote...

Share this post


Link to post
Share on other sites

In the same way i try to execute a home made program which, in my batch work's like that:

c:\make.exe %username% "x:"

The program function is to make username directory (and inside link's with sql) into the x: mapped network.

So in autoit i try this

DriveMapDel("x:")

DriveMapAdd("x:", "\\server\share")

Run('c:\make.exe' & ' "%username%" "x:" ')

DriveMapDel("x:")

DriveMapAdd("x:", "\\server\share\" & @username)

it seems that the line in bold is not working.

i've seen the syntax in an other post so it seem good for me...

But not for autoit :P

Thanks for your help.

Share this post


Link to post
Share on other sites

HI,

%username% should it be the loggedon username or a parameter given to the called script?

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

DriveMapDel("X:")
DriveMapAdd("X:", "\\server\share")
Run("C:\Make.exe " & @UserName & ' "X:"')
DriveMapDel("X:")
DriveMapAdd(":", "\\server\share\" & @UserName)

Edited by Burrup

[u]Old Projects:[/u]A3MORGB2Hex[u]Old Functions:[/u]_TimeAdd/_TimeSub_AddComma_BubbleSort _RippleSort "He who does not understand your silence will probably not understand your words." - Elbert Hubbard.

Share this post


Link to post
Share on other sites

Well it should be the loggedon username.

But i use it with the application that why i put the windows variable %username%.

I tried with @username but i got an error message.

Share this post


Link to post
Share on other sites

Ok i was puting

Run('c:\make.exe' & @username & ' "X:"')

instead

Run("C:\Make.exe " & @UserName & ' "X:"')

quote, quote always the quote

simple quote seem to be for variable to use outside the autoit code and double quote inside th code.

Is that it ?

Thank whatever.

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

Just copy/paste the code I provided @@. Edited by Larry

[u]Old Projects:[/u]A3MORGB2Hex[u]Old Functions:[/u]_TimeAdd/_TimeSub_AddComma_BubbleSort _RippleSort "He who does not understand your silence will probably not understand your words." - Elbert Hubbard.

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
Sign in to follow this  
Followers 0