Posts: 29
Threads: 2
Joined: Jun 2021
(Jul-19-2021, 07:34 PM)Yoriz Wrote: Are you looking to automate other software?
Something like pywinauto or PyAutoGUI
We are trying to create a User Library in CodeIgniter. Initially we thought that we should integrate a simple text editor macro system, by using Python, similar to that contained in UltraEdit32, & must say that UltraEdit32 system is very comprehensive & will do anything we want automatically, but after some investigation we found the following;
Does Python have macro? -The programming language of Python does not have built-in support for macros unlike many other languages such as C [2] or Racket [3].17 Dec 2018
https://scholarworks.sjsu.edu/cgi/viewco...d_projects
So we moved into C++ & found this;
https://www.ibm.com/docs/en/ztpf/1.1.0.1...ro-support
C/C++ preprocessor macros are not supported by the Systems/C and Systems/C++ compilers.
However that is not the end, as the compilers used in C++ are separate from the language itself.
We have submitted the idea of creating a macro system in the C++ forum but guess that is likely to be too much to ask for.
But if we were to go down that track we would need to integrate the C++ language into CodeIgniter, which in itself would be likely to create further problems & maybe beyond our capabilities.
UltraEdit32 & Sublime text are built in C++ so we thought that our simple idea would be solved but it has become very complicated.
The basic functions we want is to Select & Copy contents from one text file then Paste & Save it into another text file. UltraEdit32 can do that with ease, but we cant get CodeIgniter & UltraEdit32 to work together, via users of the website.
Because CodeIgniter already does use Python we have come back to Python in the hope that we can at least get the basics, Select, Copy, Paste & Save working.
Hey, who was that calling me a "Silly Frenchman"? Im Australian.
Posts: 1,358
Threads: 2
Joined: May 2019
(Jul-19-2021, 06:11 PM)bensan Wrote: We are building a website using CodeIgniter & PHP where the former has limitations. The GUI would be a browser. CodeIgniter has the capability of opening & closing text files, & our system has created a file containing ONLY a text link, so we need a facility that will open the text file, (1) select the contents (2) copy the contents. - Close the file & Open another - (3) paste the clipboard contents. - Save & close the file. Im not sure if CodeIgniter would save upon closing but we can investigate that if & when we get the Select, Copy & Paste working. CodeIgniter already uses Python.
You make this sound like the clipboard is needed, not sure why you would not simply open a file, copy the contents to a string object, close, open the second file in write (or append) mode and write the contents of the string object to the second file (then close). Would this not work?
Posts: 29
Threads: 2
Joined: Jun 2021
(Jul-20-2021, 11:36 AM)jefsummers Wrote: (Jul-19-2021, 06:11 PM)bensan Wrote: We are building a website using CodeIgniter & PHP where the former has limitations. The GUI would be a browser. CodeIgniter has the capability of opening & closing text files, & our system has created a file containing ONLY a text link, so we need a facility that will open the text file, (1) select the contents (2) copy the contents. - Close the file & Open another - (3) paste the clipboard contents. - Save & close the file. Im not sure if CodeIgniter would save upon closing but we can investigate that if & when we get the Select, Copy & Paste working. CodeIgniter already uses Python.
You make this sound like the clipboard is needed, not sure why you would not simply open a file, copy the contents to a string object, close, open the second file in write (or append) mode and write the contents of the string object to the second file (then close). Would this not work?
Thanks @ jefsummers - Ive numbered your comments
(1) You make this sound like the clipboard is needed
(2) open a file, copy the contents to a string object
(3) open the second file in write (or append) mode
(4) write the contents of the string object to the second file
(5) Would this not work?
(1) Yes, a clipboard will be needed but Im unsure how that will work e.g. what if a 2nd person clicked the same facility before the 1st person pasted.
(2) I dont know how to copy the contents to a string object. Can you explain?
(3) CodeIgniter does open in fwrite append.
(4) I dont know how to write the contents of the string object. Can you explain?
(5) If you explain my unknown, maybe it will work. Remember I know only little about Python.
Posts: 1,094
Threads: 143
Joined: Jul 2017
If you are making a webpage, the webpage is on a server. Don't you need PHP, not python?
(1) Select All - text
(2) Copy - text
(3) Paste - text
A user enters text, you save it and then display it.
Your text is then the php variable $data, do what you like with it!
For example, display it in another webpage: output.html.php
Quote:<?php
if(isset($_POST['textdata']))
{
$data=$_POST['textdata'];
$fp = fopen('data.txt', 'a');
fwrite($fp, $data);
fclose($fp);
echo file_get_contents("data.txt");
?><br>
<?php
}
?>
Maybe this old stackoverflow link will help
Posts: 29
Threads: 2
Joined: Jun 2021
Jul-21-2021, 12:08 AM
(This post was last modified: Jul-21-2021, 06:04 AM by Yoriz.
Edit Reason: removed unnecessary quote of previous post
)
Thanks @ Pedroski55. Im using CodeIgniter which is a PHP framework. I have built the facility for users to create their adverts & I know how to attach the adverts into ONE category but CodeIgniter wont allow more than one category. Im trying copy the link to the advert then paste it into various categories. A simple wish but so difficult to achieve.
Posts: 1,094
Threads: 143
Joined: Jul 2017
Jul-21-2021, 12:29 AM
(This post was last modified: Jul-21-2021, 12:30 AM by Pedroski55.)
Try phphelp.com then, I have got some good advice there in the past.
State your problem very clearly though!
Maybe javascript can do that easily. This script switches a link on in my homework page at a specified time, you could easily change it to do your job I think.
Given a link of my page like this:
Quote:<li id="link"><a href='#'>妿œŸç¬¬17周<p>请ç‰åˆ°ç¬¬17周周1</p></a></li>
The javascript will put the link in there at the specified time. I don't think you need Python at all!
Quote:<script>
var linkMsg = document.getElementById("link");
var kickoff = new Date("February 26, 2019 06:00:00");
//
function checkForValidation() {
var currentDate = new Date();
//
if (currentDate > kickoff) {
linkMsg.innerHTML = "<a href='17week7.html'>妿œŸç¬¬ä¸ƒå‘¨ week7</a>";
}
}
//
window.onload = checkForValidation();
</script>
Try a javascript forum to solve your problem!
Posts: 29
Threads: 2
Joined: Jun 2021
Jul-21-2021, 01:14 AM
(This post was last modified: Jul-21-2021, 06:05 AM by Yoriz.
Edit Reason: removed unnecessary quote of previous post
)
I will try phphelp.com & I would like to try Javascript also. Do yu have a link for Javascript Forum?
Posts: 1,094
Threads: 143
Joined: Jul 2017
Sorry, no good link for javascript, I really only use what I need, I am not good at this stuff.
I'm told javascript is easy to manipulate, so if security is an issue for you, don't use it, use PHP!
I just run a little homework page, no credit cards or personal info!
Posts: 1,358
Threads: 2
Joined: May 2019
In python, to copy the contents of one file to another without using the clipboard
filename = 'thisfile.txt'
with open(filename) as inputfile:
blob = inputfile.read()
output_filename = 'thatfile.txt'
with open(output_filename,'w') as outfile:
outfile.write(blob)
Posts: 29
Threads: 2
Joined: Jun 2021
Jul-24-2021, 02:23 PM
(This post was last modified: Jul-24-2021, 02:23 PM by bensan.)
(Jul-21-2021, 03:04 PM)jefsummers Wrote: In python, to copy the contents of one file to another without using the clipboard
filename = 'thisfile.txt'
with open(filename) as inputfile:
blob = inputfile.read()
output_filename = 'thatfile.txt'
with open(output_filename,'w') as outfile:
outfile.write(blob)
Thanks @ jefsummers - Copying from one file will be OK but to overwrite the entire contents into another file would not work. We need to go to bottom then append to the 2nd file. Is that feasible?
CodeIgniter does facilitate "Open, bottom & Append".
Would changing the 'w' with 'a' work? - with open(output_filename,'a') as outfile:
|