caocao81 Posted September 28, 2007 Posted September 28, 2007 I use the function FileOpen() to open the file in another PC. For example: $CenterHostsFile = "\\192.168.76.15\D\hosts" $file = FileOpen( $CenterHostsFile, 1) but it did not work,Someone can help me? thanks!!
ssubirias3 Posted September 28, 2007 Posted September 28, 2007 .... it did not work,Someone can help me?What do you mean it didn't work? If those 2 lines are your script, what evidence do you have that it didn't work? Looking at the example code in the Help file, you can see there are more than two lines. What are you expecting or wanting it to do?
enaiman Posted September 28, 2007 Posted September 28, 2007 This attempt to edit "hosts" file on a remote PC - I don't know why - but it doesn't look "good" for me. I won't ask you though why would you want to do it ... SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :)
PsaltyDS Posted September 28, 2007 Posted September 28, 2007 I use the function FileOpen() to open the file in another PC. For example: $CenterHostsFile = "\\192.168.76.15\D\hosts" $file = FileOpen( $CenterHostsFile, 1) but it did not work,Someone can help me? thanks!! Try it with a mapped drive: $sShare = "\\192.168.76.15\D" $sMapDrv = DriveMapAdd("*", $sShare, 8) If $sMapDrv <> "" Then $sCenterHostsFile = $sMapDrv & "\hosts" $hFile = FileOpen($sCenterHostsFile, 1) If $hFile <> -1 Then MsgBox(64, "Success", "Successfully opened file: " & $sCenterHostsFile) Else MsgBox(16, "Error", "Error opening file: " & $sCenterHostsFile) EndIf Else MsgBox(16, "Error", "Error mapping to share: " & $sShare) EndIf ; Do stuff FileClose($hFile) DriveMapDel($sMapDrv) If that 'D' is supposed to be the admin share of 'D:' then it should be 'D$'. The option 8 for DriveMapAdd() will prompt for credentials if you are not already authenticated to the server. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
caocao81 Posted October 10, 2007 Author Posted October 10, 2007 I attempt to edit "hosts" file on a remote PC, but use my script, can't edit the file.someone can tell me how to edit the file on a remote PC? I have the password of the remote PC. Thanks!!
MadBoy Posted October 10, 2007 Posted October 10, 2007 I attempt to edit "hosts" file on a remote PC, but use my script, can't edit the file.someone can tell me how to edit the file on a remote PC? I have the password of the remote PC. Thanks!!Have you tried using PsaltyDS solution? Yes? Didn't work? What was the error? My little company: Evotec (PL version: Evotec)
caocao81 Posted October 11, 2007 Author Posted October 11, 2007 Have you tried using PsaltyDS solution? Yes? Didn't work? What was the error?Sorry, what is PsaltyDS? when I use my script, programme have no response.
AdmiralAlkex Posted October 11, 2007 Posted October 11, 2007 Sorry, what is PsaltyDS? when I use my script, programme have no response.Ohh really?? check fourth post! .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface
PsaltyDS Posted October 11, 2007 Posted October 11, 2007 Sorry, what is PsaltyDS? when I use my script, programme have no response. You can use this, but you'll have to code your own _Generate* functions: Func _PsaltyDS($food, $sleep, $caffine) If $food <> 0 Then If $sleep Or $caffine Then Return _GenerateBadJokes () Else Return _GenerateREALLYBadJokes () EndIf Else Return _GenerateGrouchyAnnoyance () EndIf EndFunc ;==>_PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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