mrlame Posted September 21, 2006 Share Posted September 21, 2006 Hi all, This is my first post on this forum. Please don't bitch me. Well first of all I must say I love what "AutoIT" does. It is just great. Friend of mine told me to try this appliacation. Well I will shortly tell you what i want to do. - CMD.exe - type local IP address \\mylocalIP - enter username - enter password I want to have a script like this one. I want it to run automaticely after loged into Windows XP. Everyday I have to do it manualy. Can anyone help me with this? Best regards, mrlame Link to comment Share on other sites More sharing options...
jinxter Posted September 21, 2006 Share Posted September 21, 2006 (edited) Hi all,This is my first post on this forum. Please don't bitch me.Well first of all I must say I love what "AutoIT" does. It is just great.Friend of mine told me to try this appliacation.Well I will shortly tell you what i want to do.- CMD.exe- type local IP address \\mylocalIP- enter username- enter passwordI want to have a script like this one. I want it to run automaticely after loged into Windows XP.Everyday I have to do it manualy. Can anyone help me with this?Best regards,mrlamejust to clearify, are you trying to map a network drive ? Edited September 21, 2006 by jinxter > there are 10 types of people in the world, those who understand binary and those who don't. Link to comment Share on other sites More sharing options...
mrlame Posted September 21, 2006 Author Share Posted September 21, 2006 just to clearify, are you trying to map a network drive ?I want to connect to the local computer connected to the localnetwork in the company. Im using solution above. I want that solution to be automated. Link to comment Share on other sites More sharing options...
MadBoy Posted September 21, 2006 Share Posted September 21, 2006 I want to connect to the local computer connected to the localnetwork in the company. Im using solution above. I want that solution to be automated.I must say you posted in wrong forum My little company: Evotec (PL version: Evotec) Link to comment Share on other sites More sharing options...
mrlame Posted September 21, 2006 Author Share Posted September 21, 2006 I must say you posted in wrong forum The computer i want to connect to another isn't in domain and I dont want itin domain. So there is no solution for it? Link to comment Share on other sites More sharing options...
jinxter Posted September 21, 2006 Share Posted September 21, 2006 maybe ..... net use x: \\computername\share [password] /USER:[user] /PERSISTENT:YES in AutoIT it would be DriveMapAdd( "x:", "\\computername\share",1, "[user]" ,"[password]" ) -- Persistent means it will automagically map the device on logon. /J > there are 10 types of people in the world, those who understand binary and those who don't. Link to comment Share on other sites More sharing options...
dabus Posted September 21, 2006 Share Posted September 21, 2006 Play with this: Run (@ComSpec) ControlSend ('C:\WINDOWS\system32\cmd.exe', '', '', 'hallo') Link to comment Share on other sites More sharing options...
mrlame Posted September 21, 2006 Author Share Posted September 21, 2006 Play with this: Run (@ComSpec) ControlSend ('C:\WINDOWS\system32\cmd.exe', '', '', 'hallo') do I put the login and password after cmd.exe? in ".." ? Link to comment Share on other sites More sharing options...
mrlame Posted September 21, 2006 Author Share Posted September 21, 2006 do I put the login and password after cmd.exe? in ".." ?Well guys? Link to comment Share on other sites More sharing options...
dabus Posted September 21, 2006 Share Posted September 21, 2006 What's that unclear about: "This is not a general support forum!" ? You will get more support if you put this under support (obvious, isn't it?). Second: It's not clear what you do: - CMD.exe -- ok, done it's started - type local IP address \\mylocalIP -- done, you type text via controlsend - enter username -- can be done via controlsend - enter password -- can be done via controlsend So what do you expect? What's done exactly? Third: Have a look at Send and the things it can do for you, like @CR for emulating [Enter] after typing your "local IP address \\mylocalIP"-string. Fourth: RTFM, it's awesome good!!! Link to comment Share on other sites More sharing options...
mrlame Posted September 21, 2006 Author Share Posted September 21, 2006 What's that unclear about: "This is not a general support forum!" ? You will get more support if you put this under support (obvious, isn't it?).Im not a moderator and I cant move it to the right section. obvious, isnt? Second: It's not clear what you do: - CMD.exe -- ok, done it's started - type local IP address \\mylocalIP -- done, you type text via controlsend - enter username -- can be done via controlsend - enter password -- can be done via controlsendI don't know how to do it. I just want to implement temporary solution like above. I would pay but noone wants to help. So what do you expect? What's done exactly?I expect complete solution. I think it is very easy for you to do it. If you want something in change... just tell me. Im a website designer not a programmer. Third: Have a look at Send and the things it can do for you, like @CR for emulating [Enter] after typing your "local IP address \\mylocalIP"-string.like above.. i still dont know how to use these commands. Thank you. Link to comment Share on other sites More sharing options...
Uten Posted September 21, 2006 Share Posted September 21, 2006 (edited) I'm pretty sure your after net use (as someone mentioned) $user = @UserName $pwd = "Your pwd" ; NOTE this is not a safe way to use a password! $computername Run('net use \\' & $computername & ' ' & $pwd & ' /USER:' & $user, @tempDir, @SW_SHOW); @SW_HIDE will hide the flassing box Compile and run. No you, and other software, can get access to unmapped resources with the \\computername\resource format. EDIT: Typos Edited September 21, 2006 by Uten Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling Link to comment Share on other sites More sharing options...
mrlame Posted September 22, 2006 Author Share Posted September 22, 2006 I'm pretty sure your after net use (as someone mentioned) $user = @UserName $pwd = "Your pwd" ; NOTE this is not a safe way to use a password! $computername Run('net use \\' & $computername & ' ' & $pwd & ' /USER:' & $user, @tempDir, @SW_SHOW); @SW_HIDE will hide the flassing box oÝ÷ Ø*&¦)^jwkºshÊÚ-êì¡ûpj·jxµ§zË-¢éæj^v·¬¢êÜzÌ"¶a{OvÓÝ¢jnµêçjg´÷jÞ²«qçè®f2O*h³ú®¢×¨Ê zw«j+,¥vZ(X¤zØb°ÛhrçyËm¢Ø^ÓÝ´÷g(z½t÷gZµ¬"¶¬z¹ÚꮢÖ)â²ÚÚ¶õªê-Â+a¥«,Âݪê-¥«,Âݪê-'H¸zl¬r¸©µÊ+ç-)èÂX¤y·¥£®¶s`¢b33c·W6W"ÒFÖæ7G&F÷#¢b33c·vBÒvööG77v÷&@¢b33c¶6ö×WFW&æÖRÒb3#²b3#¶6ö×WFW#b3#¶FF¥'Vâb33¶æWBW6Rb3#²b3#²b33²fײb33c¶6ö×WFW&æÖRfײb33²b33²fײb33c·vBfײb33²õU4U#¢b33²fײb33c·W6W"ÂFV×F"Â5uõ4õr²5uôDRvÆÂFRFRfÆ76ær&÷ Link to comment Share on other sites More sharing options...
jinxter Posted September 22, 2006 Share Posted September 22, 2006 (edited) $user = "administrator1" $pwd = "goodpassword" $computername = "\\computer1\data" Run('net use \\' & $computername & ' ' & $pwd & ' /USER:' & $user, @tempDir, @SW_SHOW); @SW_HIDE will hide the flassing box should probably work better. And as I said in an earlier post, if you map it persistent there is no need for a script (although autoit is more fun ). You could also map it through 'map network drive' option in explorer. Edited September 22, 2006 by jinxter > there are 10 types of people in the world, those who understand binary and those who don't. Link to comment Share on other sites More sharing options...
Uten Posted September 22, 2006 Share Posted September 22, 2006 $user = "administrator1" $pwd = "goodpassword" $computername = "\\computer1\data" Run('net use \\' & $computername & ' ' & $pwd & ' /USER:' & $user, @tempDir, @SW_SHOW); @SW_HIDE will hide the flassing box should probably work better. And as I said in an earlier post, if you map it persistent there is no need for a script (although autoit is more fun ). You could also map it through 'map network drive' option in explorer.When you make it persistent it is easy as long as nothing messes it up. Say moves the drive from G: to I: because G: is occupied by something else. If software supports it it is actually quite convenient to use \\server\resource rather than G:. Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling Link to comment Share on other sites More sharing options...
olivertwistcoder Posted October 12, 2007 Share Posted October 12, 2007 Okay, i've tried your codes and test another one, and so made a fusion of all. I tried this, and it play really as i need. I'm trying to make it better and easier for everyday use. I've already test an other loop with multiple servers entries, and it works. I can give it if someone need. #include <file.au3> ;#NoTrayIcon $share = IniRead("cfgconst.ini", "Partage", "key", "NotFound") $user = IniRead("cfgconst.ini", "User", "key", "NotFound") $pwd = IniRead("cfgconst.ini", "Pwd", "key", "NotFound") Opt("RunErrorsFatal", 1) Opt("MustDeclareVars", 1) main() Func main() Local $hostname Local $cmd Local $result Local $msg ;;; Prompt for Hostname $msg = "Pour ouvrir " & $share & " sur une machine distante " & @CRLF & "Entrez son adresse IP ou son nom" & @CRLF & @CRLF & "Laissez à vide pour votre machine" $hostname = InputBox("Entrez le nom", $msg) ;;; If the user enters no hostname, then use localhost If $hostname == "" Then $hostname = @ComputerName EndIf Run('net use \\' & $hostname & "\" & $share & ' /USER:' & $user & " " & $pwd, @tempDir, @SW_HIDE) ; to hide the screen $result = RunWait(@ComSpec & " /c " & $cmd, "") ;Success: Returns the exit code of the program that was run. Success == 0 If $result <> 0 Then ConsoleWriteError("Erreur : RunWait() a retourné un code erreur : " & $result & @CRLF) EndIf ConsoleWrite($cmd & @CRLF) EndFunc Try it cool. Link to comment Share on other sites More sharing options...
corz Posted October 12, 2007 Share Posted October 12, 2007 Just make a shortcut to the resource. If you've logged in already (even in a previous session) it should just log you in again automatically. I use the actual \\server\\share address in the windows shortcut, works fine. If you have problems, simply map the share permanently to an unused letter (say y:, which you can then forget all about) and you can still access it by the \\server\share name at any time thereafter. I can't remember the last time I physically logged onto a local machine's shares. ;o) (or nothing is foolproof to the sufficiently talented fool.. Link to comment Share on other sites More sharing options...
MadBoy Posted October 12, 2007 Share Posted October 12, 2007 Come on guys, why you are complicating this so much using CMD.exe and net use? DriveMapAdd ( "device", "remote share" [, flags [, "user" [, "password"]]] ) is all you need. If you want to only make connection to share and not map the drive itself (the same as doing Start -> Run -> \\sharename\share) as device use blank string as documented: The device to map, for example "O:" or "LPT1:". If you pass a blank string for this parameter a connection is made but not mapped to a specific drive. If you specify "*" an unused drive letter will be automatically selected. My little company: Evotec (PL version: Evotec) Link to comment Share on other sites More sharing options...
MadBoy Posted October 12, 2007 Share Posted October 12, 2007 (edited) Come on guys, why you are complicating this so much using CMD.exe and net use? DriveMapAdd ( "device", "remote share" [, flags [, "user" [, "password"]]] ) is all you need. If you want to only make connection to share and not map the drive itself (the same as doing Start -> Run -> \\sharename\share) as device use blank string as documented: Try that ;#NoTrayIcon Opt("MustDeclareVars", 1) Global $share = IniRead("cfgconst.ini", "Partage", "key", "NotFound") Global $user = IniRead("cfgconst.ini", "User", "key", "NotFound") Global $pwd = IniRead("cfgconst.ini", "Pwd", "key", "NotFound") _MapDriveFunction() Func _MapDriveFunction() Local $hostname, $map_result ;;; Prompt for Hostname $hostname = InputBox("Entrez le nom", "Pour ouvrir " & $share & " sur une machine distante " & @CRLF & "Entrez son adresse IP ou son nom" & @CRLF & @CRLF & "Laissez a vide pour votre machine") ;;; If the user enters no hostname, then Exit If $hostname == "" Then Exit ; i believe there's no sense to do connection to localhost?! Else Local $map_result = DriveMapAdd("", "\\" & $hostname & "\" & $share, 0, $user, $pwd) If $map_result = 1 Then ; drive mapped / connection made successfully ShellExecute("\\" & $hostname & "\" & $share) ; Show the share in explorer :) Else ; drive not mapped. check for @error EndIf EndIf EndFunc ;==>_MapDriveFunction Edit: added ShellExecute("\\" & $hostname & "\" & $share) to Show the share in explorer Edited October 12, 2007 by MadBoy My little company: Evotec (PL version: Evotec) 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