# Notepad file opening problem...

## Recommended Posts

Hey guys,

I have been trying to make a script which requests some information and writes it to a notepad file after the information is entered... The whole script runs smoothly (variables, etc) except for the opening of the file/writing to the file..

I have tried Run and FileWriteLine, both with the same results... Was hoping that you could help me on this one

(I need this done soon... its a bit important, thanks)

Thanks for any feedback and help

I have put the script below

; Project: input hours
;means - notepad tracker?
If 2 = MsgBox (1,"TimeTracker","Welcome, would you like to begin?") then Exit
;vars
$date = InputBox ("TimeTracker","Input date and day"&@CRLF&"format [DAY] - [DATE]")$phys = InputBox ("TimeTracker","Input hours done of Physics")
$chem = InputBox ("TimeTracker","Input hours done of Chemistry")$math = InputBox ("TimeTracker","Input hours done of Math")
$file = FileOpen ("G:\StudyHours.txt",1) if$file = 1 Then
FileWriteLine ("G:\StudyHours.txt",@CRLF&@CRLF&$date&@CRLF&$phys&@CRLF&$chem&@CRLF&$math)
MsgBox (0,"TimeTracker","Done! :D")
ElseIf $file = 0 Then MsgBox (0,"TimeTracker","Sorry, file not found @_@") EndIf Exit (The error in this case occurred at the file open, it said that it could not either open the file, or find it...) ##### Link to post ##### Share on other sites Look in the helpfile at relevant functions about mixing handles and file names That is your problem. Monkey's are, like, natures humans. ##### Link to post ##### Share on other sites ; Project: input hours ;means - notepad tracker? If 2 = MsgBox (1,"TimeTracker","Welcome, would you like to begin?") then Exit ;vars$date = InputBox ("TimeTracker","Input date and day"&@CRLF&"format [DAY] - [DATE]")

$phys = InputBox ("TimeTracker","Input hours done of Physics")$chem = InputBox ("TimeTracker","Input hours done of Chemistry")

$math = InputBox ("TimeTracker","Input hours done of Math") ;$file = FileOpen ("G:StudyHours.txt",1)

;if $file = 1 Then FileWriteLine ("G:StudyHours.txt",@CRLF&@CRLF&$date&@CRLF&$phys&@CRLF&$chem&@CRLF&$math) MsgBox (0,"TimeTracker","Done! ") ;ElseIf$file = 0 Then

;EndIf

Exit

Edited by forumer100

App: Au3toCmd              UDF: _SingleScript()

##### Share on other sites

Look in the helpfile at relevant functions about mixing handles and file names

That is your problem.

okay, thanks I will that

##### Share on other sites

okay guys, I fixed the file and it is working beautifully! Thanks

## 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

• ### Similar Content

• By Rskm
Hi, I have 5 notepad files with lot of data in each of it. The data are arranged in lines and i wish to get it pasted/copied into excel.  Say, i need to read notepad1 and paste the contents into sheet1 of excel and notepad2 to sheet2 and so on.  If i read the notepad and paste it line by line, it is taking lot of time.  Is there a way by which i can paste the whole of notepad file into excel sheet(and get it pasted line by line as shown in the attached excel), instead of using code to write it line by line?.. I was using Filewriteline(data, line i) initially to write to excel.  The 'i' value was incremented with for loop and the excel was updated, but this takes lot of time.  The expected excel format is attached here.  any help is appreciated.  thanks
Tmp.xls
• By Sanja
Hello forum,
I have the problem that I can not use Firefox in combination with WebDriver when using AutoIt on some websites. Of course it does not work with the very website I need it to work with.
As soon as I want to open the desired website, I get the little robot icon which tells me that the "browser is under remote control" and the website stays blank.
I CAN open the website (www.ebay-kleinanzeigen.de) but I get blocked when I want to go to my account, to be precise.

I am using AutoIt 3.3.14.5 I have checked my FireFox version. It is up to date. Also the special browser drivers like gecko etrc. are up to date too and everything works fine with the WebDriver demo.
It seems that another user also had the same problem, but the thread has already been closed and the users solution (setting security lower did not work for me).
I mean I can only choose between "standard", "strict" and "customized". On "customized I unchecked everything but it still would not change anything.
I also have checked Google Chrome and MS Edge. Same result.
I tried swiching profiles (only with FireFox). Same result.
I tried to acess a previously opened FireFox session where I manually logged in by using this code snippet:
_WD_Option('Driver', 'C:\Path\to\the\executable\geckodriver.exe') _WD_Option('DriverParams', '--log trace --connect-existing  --marionette-port 2828') _WD_Option('Port', 4444) Obviously I adjusted the path of the geckodriver.exe but it did not work at all on my computer.
So far my code is really basically nothing but I can not even start to code. I myself am not a real coder and I know only the very basics like loops, conditions and variables.
----------------------------------------
; Script Start #include <Array.au3> #include <AutoItConstants.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <File.au3> #include <GuiComboBoxEx.au3> #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <StringConstants.au3> #include <StaticConstants.au3> #include "wd_core.au3" #include "wd_helper.au3" #include <WindowsConstants.au3> Local $sDesiredCapabilities,$sSession, $sElement SetupGecko()$_WD_DEBUG = $_WD_DEBUG_None _WD_Startup()$sSession = _WD_CreateSession($sDesiredCapabilities) _WD_Navigate($sSession, "https://www.ebay-kleinanzeigen.de/m-meine-anzeigen.html?sort=CREATION_DATE_ASC&keyword=winter") Exit Func SetupGecko() _WD_Option('Driver', 'geckodriver.exe') _WD_Option('DriverParams', '--log trace --marionette-port 2828') _WD_Option('Port', 4444) $sDesiredCapabilities = '{"capabilities":{"alwaysMatch": {"moz:firefoxOptions": {"args": ["-profile", "' & "C:/Users/myaccount/AppData/Roaming/Mozilla/Firefox/Profiles/0123456.default-release" & '"],"log": {"level": "trace"}}}}}' EndFunc ;==>SetupGecko Func SetupChrome() _WD_Option('Driver', 'chromedriver.exe') _WD_Option('Port', 9515) _WD_Option('DriverParams', '--verbose --log-path="' & @ScriptDir & '\chrome.log"')$sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "excludeSwitches": [ "enable-automation"]}}}}' EndFunc ;==>SetupChrome Func SetupEdge() _WD_Option('Driver', 'msedgedriver.exe') _WD_Option('Port', 9515) _WD_Option('DriverParams', '--verbose --log-path="' & @ScriptDir & '\msedge.log"') $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"ms:edgeOptions": {"binary": "' & StringReplace(@ProgramFilesDir, "\", "/") & '/Microsoft/Edge/Application/msedge.exe", "excludeSwitches": [ "enable-automation"], "useAutomationExtension": false}}}}' EndFunc ;==>SetupEdge -------------------------------------- I left the three setup functions in, because I do not care what browser I use as long as I can start coding. Also, please understand that I am not trying to be lazy here. I do not want someone to code for me. Maybe the problem is very basic, but I just do not know how to eliminate that restriction. Is it something I need to uncheck in the browser settings or is it more complicated? If you need more information, I will be happy to provide those. If somebody has an idea or a solution, I would very much appreciate it. Edit: I am not bothered by the robot icon itself. I do not care about it. If I try to acess my regular ebay account: "https://mesg.ebay.de/mesgweb/ViewMessages/0" it works like a charm despite the notification that the browser is remotely controlled. My problem is, that the first website does not load for some reason ONLY when the browser is remote controlled. • Hi, I'm sure that this is a simple question regarding webdriver udf but my search on the forum did not result in the exact same scenario that I need. I will adapt it to my corporate needs but at first I want it to work with an example everybody can reproduce if needed. I navigate to https://www.daysoftheyear.com/ and want to find out what special day today is. Using the following Code returns the wanted text that today is 'shark awareness day' in the console but it is not pasted in notepad as it is not copied as it probably should be. #include "wd_core.au3" #include "wd_helper.au3" Local$sDesiredCapabilities, $sSession,$sID _WD_Option("Driver", "C:\Program Files (x86)\AutoIt3\chromedriver.exe") _WD_Option('Port', 9515) _WD_Option('DriverParams', '--log-path="' & @ScriptDir & '\chrome.log"') $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true }}}}' _WD_Startup()$sSession = _WD_CreateSession($sDesiredCapabilities) _WD_Navigate($sSession, "https://www.daysoftheyear.com/?timezone_offset=nan") _WD_LoadWait($sSession) Sleep(3000) Local$sElement = _WD_FindElement($sSession,$_WD_LOCATOR_ByXPath, "/html/body/div[2]/header/div/div[1]/div/div[2]/h3/a") _WD_ElementAction($sSession,$sElement, 'text') ClipGet() Run("notepad.exe") Sleep(500) Send("^v") Scite returns this, therefore the text has been found but the last mile to paste it to notepad or excel does not work for me.
__WD_Get: URL=HTTP://127.0.0.1:9515/session/b72166b774d7fefb258b3721fc1d4306/element/657e6b5d-31a9-46a8-85c4-acb7f72bf659/text __WD_Get: StatusCode=200; $iResult = 0;$sResponseText={"value":"Shark Awareness Day"}... _WD_ElementAction: {"value":"Shark Awareness Day"}... Thanks in advance!

• By AZJIO
My Notepad v0.4 (En, Ru)

Black theme

My_Notepad.7z (560kb sources + EXE)

I wanted to make an example for the help file. But I could not stop, and made more complicated.
• By Kruxe
Hello Everyone,
I am very green when it comes to AutoIT, I have recently started using it to automate a job that i perform using MS Excel and that is working great. Recently I have been faced with a challenge I which i need to copy a specific set of lines from one .txt file and past them, overwriting a specific set of lines in a different .txt file. I honestly have no clue how I can copy the specified lines and transfer them. What functions / commands could I use and how could I lay them out I AutoIT? Any and all help will be appreciated.
Thanks!
Kruxe
×

• Wiki

• Back

• #### Beta

• Git
• FAQ
×
• Create New...