Req: Script for typing

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
nightraven97

Req: Script for typing

11 Apr 2017, 10:31

Hi,
There's a coding website for my college. But it doesn't allow copy pasting.
I do the programming in online compiler because the compiler in that website is way too slow.
So after writing the code, I'm having to retype the entire code.
I tried writing a script to do this. Can someone help me with it?
I paste the code to be typed into "contents.txt" and I have another background ahk file that runs this file when I press Ctrl+Alt+v.

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

FileRead, code, contents.txt
SendInput {Raw}%code%(SendInput)
User avatar
SnowFlake
Posts: 368
Joined: 28 Apr 2015, 05:41
Contact:

Re: Req: Script for typing

11 Apr 2017, 15:20

try this,


IfnotExist, contents.txt
{
MsgBox Error cant find contents.txt!
}

IfExist, contents.txt
{
FileRead, code, contents.txt
Sleep, 200
send, %code%
}
:yawn:
DanielLee

Re: Req: Script for typing

24 Jul 2018, 04:38

nightraven97 wrote:Hi,
There's a coding website for my college. But it doesn't allow copy pasting.
I do the programming in online compiler because the compiler in that website is way too slow.
So after writing the code, I'm having to retype the entire code.
I tried writing a script to do this. Can someone help me with it?
I paste the code to be typed into "contents.txt" and I have another background ahk file that runs this file when I press Ctrl+Alt+v.

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

FileRead, code, contents.txt
SendInput {Raw}%code%(SendInput)
If you just want to throw the contents of the file onto the screen you can try using PHP.
<?php
$myfilename = "mytextfile.txt";
if(file_exists($myfilename)){
echo file_get_contents($myfilename);
}
?>
Pall Parker
Posts: 2
Joined: 24 Jul 2018, 09:34

Re: Req: Script for typing

24 Jul 2018, 09:39

hello, thank you, this information helped me in completing the assignment for the college
Guest

Re: Req: Script for typing

01 Aug 2018, 00:44

DanielLee wrote:
nightraven97 wrote:Hi,
There's a coding website for my college. But it doesn't allow copy pasting.
I do the programming in online compiler because the compiler in that website is way too slow.
So after writing the code, I'm having to retype the entire code.
I tried writing a script to do this. Can someone help me with it?
I paste the code to be typed into "contents.txt" and I have another background ahk file that runs this file when I press Ctrl+Alt+v.

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

FileRead, code, contents.txt
SendInput {Raw}%code%(SendInput)
If you just want to throw the contents of the file onto the screen you can try using PHP.
<?php
$myfilename = "mytextfile.txt";
if(file_exists($myfilename)){
echo file_get_contents($myfilename);
}
?>
Dan, thanks for sharing!

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: apeironn, peter_ahk and 328 guests