Jump to content

Create a HTML Hello, world! page automatically - (Moved)


Recommended Posts

Hello! I made a script to create a HTML Hello, world! page automatically.

 

Just the code is:

#include <Constants.au3>

; Creates and opens a webpage in HTML format

_Example()
Exit

Func _Example()
; Prompt the user to run this script
Local $iAnswer = MsgBox(BitOR($MB_YESNO, $MB_SYSTEMMODAL), "Example", "This script creates a folder and creates a webpage with Example Webpage as name and with the text Hello, world!. Do you want to run?")
If $iAnswer = $IDNO Then
  MsgBox($MB_SYSTEMMODAL, "AutoIt 3", "Oops!")
  Return
EndIf

; Right clicks on a postition of 800,800
MouseClick($MOUSE_CLICK_RIGHT, 800, 800, 1, 50)

; Press the down arrow key 11 times
Send("{DOWN 11}")

; Press the right arrow key 1 time
Send("{RIGHT}")

; Press Enter
Send("{ENTER}")

; Send "HTML" and the "Enter" key, using a slow-motion of 125 miliseconds on each keypress
AutoItSetOption("SendKeyDelay", 125)
Send("HTML{ENTER}")

; Double clicks on the HTML folder
MouseClick($MOUSE_CLICK_LEFT, 200, 125, 2, 50)

; Right clicks on a postition of 800,800
MouseClick($MOUSE_CLICK_RIGHT, 800, 800, 1, 50)

; Press the down arrow key 11 times
Send("{DOWN 11}")

; Press the right arrow key 1 time
Send("{RIGHT}")

; Press the down arrow key 8 times
Send("{DOWN 8}")

; Press a extra large key combo
Send("{ENTER}^A{BACKSPACE}Example Webpage.htm{RIGHT}{RIGHT}{RIGHT}{RIGHT}{BACKSPACE}{BACKSPACE}{BACKSPACE}{ENTER}{ENTER}")

; Clicks on the text document
MouseClick($MOUSE_CLICK_RIGHT, 199, 126, 2, 50)

; Press a extra large key combo

Send("{DOWN}{DOWN}{DOWN}{RIGHT}{DOWN}{DOWN}{DOWN}{ENTER}")

; Wait for the Windows Notepad to be active
WinWaitActive("[CLASS:Notepad]")

; Now that the Windows Notepad is active, types some text
Send("<p>Hello, world{!}</p>")
Sleep(500)

; Now quit the Windows Notepad by pressing "Alt+F", the down arrow key 6 times and the "Enter" key
    Send("!f")
    Sleep(1000)
    Send("{DOWN 6}{ENTER}")
; Now wait for the Windows Notepad save dialog to be active
; Press only the "Enter" key, to save the file
    WinWaitActive("[CLASS:#32770]")
    Sleep(500)
    Send("{ENTER}")

; Press Enter

Send("{ENTER}")

EndFunc ;==>_Example

Hope this helps!

 

Edited by Jos
removed attachment with exe.
Link to post
Share on other sites
  • Developers
Posted (edited)

Moved to the appropriate forum.

Moderation Team

I have moved it to Support as this really can use some improvements. :) 
For starters: Try avoiding the Send() commands to make a file but rather use the existing Filexxxx functions.

Also please do not attach EXE files as everybody here can compile/run source themselves and we do not really want EXE's due to potential Virus issues!

 

Edited 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.
  :)

Link to post
Share on other sites
11 minutes ago, Jos said:

Moved to the appropriate forum.

Moderation Team

I have moved it to Support as this really can use some improvements. :) 
For starters: Try avoiding the Send() commands to make a file but rather use the existing Filexxxx functions.

Also please do not attach EXE files as everybody here can compile/run source themselves and we do not really want EXE's due to potential Virus issues!

 

I attached a script, not an EXE! Due to Viruses, Trojans, Worms and PUPs!

 

Create and open a webpage.au3

Link to post
Share on other sites
19 minutes ago, Mihai1234 said:

Hello! I made a script to create a HTML Hello, world! page automatically.

 

Just the code is:

#include <Constants.au3>

; Creates and opens a webpage in HTML format

_Example()
Exit

Func _Example()
; Prompt the user to run this script
Local $iAnswer = MsgBox(BitOR($MB_YESNO, $MB_SYSTEMMODAL), "Example", "This script creates a folder and creates a webpage with Example Webpage as name and with the text Hello, world!. Do you want to run?")
If $iAnswer = $IDNO Then
  MsgBox($MB_SYSTEMMODAL, "AutoIt 3", "Oops!")
  Return
EndIf

; Right clicks on a postition of 800,800
MouseClick($MOUSE_CLICK_RIGHT, 800, 800, 1, 50)

; Press the down arrow key 11 times
Send("{DOWN 11}")

; Press the right arrow key 1 time
Send("{RIGHT}")

; Press Enter
Send("{ENTER}")

; Send "HTML" and the "Enter" key, using a slow-motion of 125 miliseconds on each keypress
AutoItSetOption("SendKeyDelay", 125)
Send("HTML{ENTER}")

; Double clicks on the HTML folder
MouseClick($MOUSE_CLICK_LEFT, 200, 125, 2, 50)

; Right clicks on a postition of 800,800
MouseClick($MOUSE_CLICK_RIGHT, 800, 800, 1, 50)

; Press the down arrow key 11 times
Send("{DOWN 11}")

; Press the right arrow key 1 time
Send("{RIGHT}")

; Press the down arrow key 8 times
Send("{DOWN 8}")

; Press a extra large key combo
Send("{ENTER}^A{BACKSPACE}Example Webpage.htm{RIGHT}{RIGHT}{RIGHT}{RIGHT}{BACKSPACE}{BACKSPACE}{BACKSPACE}{ENTER}{ENTER}")

; Clicks on the text document
MouseClick($MOUSE_CLICK_RIGHT, 199, 126, 2, 50)

; Press a extra large key combo

Send("{DOWN}{DOWN}{DOWN}{RIGHT}{DOWN}{DOWN}{DOWN}{ENTER}")

; Wait for the Windows Notepad to be active
WinWaitActive("[CLASS:Notepad]")

; Now that the Windows Notepad is active, types some text
Send("<p>Hello, world{!}</p>")
Sleep(500)

; Now quit the Windows Notepad by pressing "Alt+F", the down arrow key 6 times and the "Enter" key
    Send("!f")
    Sleep(1000)
    Send("{DOWN 6}{ENTER}")
; Now wait for the Windows Notepad save dialog to be active
; Press only the "Enter" key, to save the file
    WinWaitActive("[CLASS:#32770]")
    Sleep(500)
    Send("{ENTER}")

; Press Enter

Send("{ENTER}")

EndFunc ;==>_Example

Hope this helps!

 

*Also opens automatically in Firefox!

Link to post
Share on other sites

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

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...