andrew545 Posted December 29, 2013 Posted December 29, 2013 Hi, i'm trying to make a script wich takes the public ip address and writes it to a file when i write ip.txt it goes to the desktop how do i make it save the file somewhere else using filewrite()
andrew545 Posted December 29, 2013 Author Posted December 29, 2013 I'm making a script that takes a txt file and writes the pubic ip address to the file but when it writes the file it saves it to the desktop how do i make it save it somewhere else like c: ? answers wil be appreciated
andrew545 Posted December 29, 2013 Author Posted December 29, 2013 Please help, I'm writing a script that takes an ipaddress and writes it to a text file and it ends up on the desktop, how do i write the file somewhere else like C: ?
Developers Jos Posted December 29, 2013 Developers Posted December 29, 2013 (edited) You aren't making a great start here in our forums. I have removed this question from a totally unrelated thread and merged the other 3 created topics. Please stick to a single thread/post when you have a question. Jos Edited December 29, 2013 by 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.
JohnOne Posted December 29, 2013 Posted December 29, 2013 Change the path you're using to the path you want. depending on OS you might need to add #RequireAdmin directive. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
andrew545 Posted December 29, 2013 Author Posted December 29, 2013 Change the path you're using to the path you want. depending on OS you might need to add #RequireAdmin directive. I'm using windows 8
andrew545 Posted December 29, 2013 Author Posted December 29, 2013 Local $Publicip = _GetIP() Local $File = FileOpen($Publicip, 1) FileWrite("ip.txt", $Publicip) FileClose($File)
JohnOne Posted December 29, 2013 Posted December 29, 2013 StringLeft(@SystemDir, 3) & "ip.txt" AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
Developers Jos Posted December 29, 2013 Developers Posted December 29, 2013 You also need to study the FileOpen/Filewrite/FileClose in the helpfile as you are mixing things up... should be something like: Local $Publicip = _GetIP() Local $File = FileOpen("ip.txt", 1) FileWrite($File, $Publicip) FileClose($File) 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.
andrew545 Posted December 29, 2013 Author Posted December 29, 2013 So, now How do i save ip.txt to a different location rather then the desktop because when i run the script that is where it gets saved to
Developers Jos Posted December 29, 2013 Developers Posted December 29, 2013 So, now How do i save ip.txt to a different location rather then the desktop because when i run the script that is where it gets saved to Specify the correct target directory in the script .. maybe? 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.
andrew545 Posted December 29, 2013 Author Posted December 29, 2013 ok, i have looked through the documentation on filewrite and _FileWriteLog but nothing explains how i would save the file in a different location and it is aggervating me
JohnOne Posted December 29, 2013 Posted December 29, 2013 Seriously? Change your filename to a full path and filename. If you do not understand what a path is I'd have to wonder what business you have at the flesh end of a keyboard, let alone scripting. Use web search to learn basic computing first would be your best bet. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
andrew545 Posted December 30, 2013 Author Posted December 30, 2013 OK, i have done that but i had a script that saved it to c: but then i deleted and i have looked through the documentation and im stuck that's why im asking for help smart ass
andrew545 Posted December 30, 2013 Author Posted December 30, 2013 shouldn't it be filewrite("ip.txt", @WindowsDir, 1) ?
BrewManNH Posted December 30, 2013 Posted December 30, 2013 How about @WindowsDir & "ip.txt" ? The way you wrote it won't work, as FileWrite only takes 2 parameters, you gave it 3. Even if it had worked, all it would do is write the text of the macro @WindowsDir (Usually C:Windows) to the text file. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator
JohnOne Posted December 30, 2013 Posted December 30, 2013 i have looked through the documentation Balls you have. FileWrite("full-path-to-file", "data") AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
andrew545 Posted December 30, 2013 Author Posted December 30, 2013 (edited) I have tried both of those filewrite("C:" "ip.txt") well could someone test it and see if they can get ip.txt to the C: directory rather then the desktop ? Here is the code #include <Inet.au3> $PublicIP = _GetIP() FileOpen("ip.txt", 1) FileRead($PublicIP, 1) FileWrite("ip.txt", $PublicIP) and run it and you'll see what i mean it will end up on the desktop and i dont want it there sorry if this is an inconvenience but im very annoyed at this point and would just like to get it saved to c: oh and this is going to be a remote administration tool by the way in case any of you were wondering. Edited December 30, 2013 by andrew545
Developers Jos Posted December 30, 2013 Developers Posted December 30, 2013 Why are you creating 2 literal strings in stead of 1? Just add c: in front of the filename inside of the "". 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.
Moderators JLogan3o13 Posted December 30, 2013 Moderators Posted December 30, 2013 and i dont want it there sorry if this is an inconvenience but im very annoyed at this point and would just like to get it saved to c: oh and this is going to be a remote administration tool by the way in case any of you were wondering. You keep complaining about how annoyed you are, or how "aggervating" (your horrible spelling, not mine) this is for you. Yet you aren't listening to the help people are trying to provide to you. First off, since you are on Windows 8 and you're trying to save to the root of C:, you need to ensure #RequireAdmin is at the top of your script. Secondly, this: FileRead($PublicIP, 1) ..makes no sense at all. Go back and look at the first parameter for FileRead, to see the mistake. Lastly, as has been suggested several times, try a literal path for the file. #RequireAdmin #include <Inet.au3> $PublicIP = _GetIP() FileOpen("C:\ip.txt", 1) ;>>>>FileRead($PublicIP, 1) ***Get rid of this, it makes no sense*** FileWrite("C:\ip.txt", $PublicIP) ...this works just fine on WIN8 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
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