Jump to content

Is it possible to run the code from forum ?


Recommended Posts

Hi all,

This is my doubt. Is it possible to run the autoit code from the forum ?. If somebody add that feature to forum, it will be very easy for learners to try the code snippet in various forums. Just add another button to run and stop the code. And ofcourse, a console window too needed. 

If that is not possible, atleast, is it possible to add a "Copy to Clipboard" button to forum, so that we can easily copy the code and paste into our own ide. 

Spoiler

My Contributions

Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language.

UDF Link Viewer   --- A tool to visit the links of some most important UDFs 

 Includer_2  ----- A tool to type the #include statement automatically 

 Digits To Date  ----- date from 3 integer values

PrintList ----- prints arrays into console for testing.

 Alert  ------ An alternative for MsgBox 

 MousePosition ------- A simple tooltip display of mouse position

GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function

Access_UDF  -------- An UDF for working with access database files. (.*accdb only)

 

Link to comment
Share on other sites

  • Moderators

Do you honestly think it would be advisable to be able to run code right in the browser from a web page, when there's no telling who is putting what in there? :doh:

"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!

Link to comment
Share on other sites

@JLogan3o13 ,

I don't know the techincal details, but its just my wish. I have seen so many websites run code and display result. 

Edit - Ok, If it is not advisable, then what about adding a copy to clipboard button ?

Edited by kcvinu
Spoiler

My Contributions

Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language.

UDF Link Viewer   --- A tool to visit the links of some most important UDFs 

 Includer_2  ----- A tool to type the #include statement automatically 

 Digits To Date  ----- date from 3 integer values

PrintList ----- prints arrays into console for testing.

 Alert  ------ An alternative for MsgBox 

 MousePosition ------- A simple tooltip display of mouse position

GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function

Access_UDF  -------- An UDF for working with access database files. (.*accdb only)

 

Link to comment
Share on other sites

How hard is it to hit CTRL + C?

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 Gude
How 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

Link to comment
Share on other sites

1 hour ago, kcvinu said:

Is it possible to run the autoit code from the forum ?

To run AutoIt code directly from the forum would be a security nightmare. So you need to stick with Ctrl + c

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Create your one function.

a hotkey.

then you  select some autoit code in forum press you hotkey and create a temp file open with Scite and run it.

 

Saludos

Edited by Danyfirex
Link to comment
Share on other sites

Ok, i can understand. 

But the entire copy process needs this much steps.

1. Click the "Popup" button

2. Click on the poped up window.

3. Press Ctrl + A to select all

4. Press Ctrl + C to copy. 

All i am asking to make it to one step. Just add a Copy button. That's all. :)

Spoiler

My Contributions

Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language.

UDF Link Viewer   --- A tool to visit the links of some most important UDFs 

 Includer_2  ----- A tool to type the #include statement automatically 

 Digits To Date  ----- date from 3 integer values

PrintList ----- prints arrays into console for testing.

 Alert  ------ An alternative for MsgBox 

 MousePosition ------- A simple tooltip display of mouse position

GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function

Access_UDF  -------- An UDF for working with access database files. (.*accdb only)

 

Link to comment
Share on other sites

@Danyfirex ,

I am planning/making something like that. Will be released soon. And that is not only for me, but also entire forum. :)

Spoiler

My Contributions

Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language.

UDF Link Viewer   --- A tool to visit the links of some most important UDFs 

 Includer_2  ----- A tool to type the #include statement automatically 

 Digits To Date  ----- date from 3 integer values

PrintList ----- prints arrays into console for testing.

 Alert  ------ An alternative for MsgBox 

 MousePosition ------- A simple tooltip display of mouse position

GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function

Access_UDF  -------- An UDF for working with access database files. (.*accdb only)

 

Link to comment
Share on other sites

Hello.  My brother and I wrote this small Google Chrome extension that allow load(No Run Directly. you must press F5) the code directly in SciTE.

By default Scritps are saved in Desktop when you run it.

How to Install:

In host Folder Run install_host.bat (try to keep an static folder) If you move the folder after you run install_host.bat  You must install again.

Load The Extension (autoitextension Folder) as Developer Mode In Google Chrome Settings.  

You can edit AutoitCodeRunner.au3 to make it work as your need.

How it works.

Basically It Injects a "Run" Button in every AutoIt code tag Like This:

ff7ee27ca3b64c82af071938564f5552.png

Check Source for more details.

AutoItCodeRunner.zip

Regards

Link to comment
Share on other sites

@Danyfirex , 

That's great. Thanks for the help. I am developing  a script to do this task. But it is not completed. This is the working scenario.

1. After starting program, it asks you to enter the link of the page.

-------- You only need to hover the mouse above a text box. It will paste automatically.

2. Then the program asks to enter the post number without # key.

3. Now, this program uses  _INetGetSource function to download the source of that webpage.

4. Then the program search for "#PostNum" to find the desired post.

5. Then it will search for "#PostNum + 1" to find the ending boundary of the desired post. If not found, last letter of source text will be the boundary.

6. Then this program will strip all text related to #PostNum.

7. Then it will search for "ipsCode">". Which is the starting position of autoit code in that post.

8. Then it will search for "</pre>" . Which is the ending position of autoit code.

9. Now we got the autoit code with some java script codes (mostly @CRLF and @Tab). Next task is to replace the java script code with appropriate autoit chars. 

10. Last but not least, save the autoit code somewhere and open it in SciTE.

So simple. No regex, only native functions. But i have completed only 8 steps and working on step 9. Anyhow, let me test your tool. Thanks :)

Edited by kcvinu
Spoiler

My Contributions

Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language.

UDF Link Viewer   --- A tool to visit the links of some most important UDFs 

 Includer_2  ----- A tool to type the #include statement automatically 

 Digits To Date  ----- date from 3 integer values

PrintList ----- prints arrays into console for testing.

 Alert  ------ An alternative for MsgBox 

 MousePosition ------- A simple tooltip display of mouse position

GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function

Access_UDF  -------- An UDF for working with access database files. (.*accdb only)

 

Link to comment
Share on other sites

@Danyfirex ,

Great!! That works like a charm... :) 

But it's saving location is Desktop. Can i change it ? I cant find anything related to saving path in that au3 file. Anyway, this program makes an urge in me to learn javascript asap. Thanks for this help.

Spoiler

My Contributions

Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language.

UDF Link Viewer   --- A tool to visit the links of some most important UDFs 

 Includer_2  ----- A tool to type the #include statement automatically 

 Digits To Date  ----- date from 3 integer values

PrintList ----- prints arrays into console for testing.

 Alert  ------ An alternative for MsgBox 

 MousePosition ------- A simple tooltip display of mouse position

GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function

Access_UDF  -------- An UDF for working with access database files. (.*accdb only)

 

Link to comment
Share on other sites

Here's something I just wrote up. It copies the contents of the clipboard to a file, asks the user if they are sure they want to run this code, and if yes then runs it. You could Pin this script in the Taskbar and run it after copying the script into your clipboard. You could also create a shortcut to the script and set a hotkey using the shortcut properties page.

 

#include <Date.au3>
#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>
#include <WindowsConstants.au3>

;~~~ Options
Global $WinTitle = "RunFromClipboard"
Global $AutoItRun = "C:\PortableApps\AutoIt3 Portable\AutoIt3 Portable.exe" ;Set this to the location for either AutoIt3.exe or AutoIt3_x64.exe
;~~~

If FileExists($AutoItRun) = 0 Then
    MsgBox($MB_ICONERROR,$WinTitle,"AutoIt was not detected. Please set the $AutoItRun variable.")
    Exit
EndIf
Global $tCur = _Date_Time_GetLocalTime()
Global $stCur = _Date_Time_SystemTimeToDateTimeStr($tCur)
Global $DateTime = StringReplace($stCur,":","-")
$DateTime = StringReplace($DateTime,"\","-")
$DateTime = StringReplace($DateTime,"/","-")
Global Const $AutoItTempDir = @TempDir & "\BetaLeaf Software\RunFromClipboard\"
Global Const $AutoItTempFile = $AutoItTempDir & "Script " & $DateTime & ".au3"
Global $g_idMemo
_ClipboardToFile()
_PreviewScript() ;Comment this line out if you don't want to see a preview and just want to run right away.
_RunScript()
Func _ClipboardToFile()
    Local $Clipboard = ClipGet()
    If $Clipboard = "" Then
        MsgBox($MB_ICONERROR, $WinTitle, "The Clipboard is empty.")
        Exit
    EndIf
    Local $hFile = FileOpen($AutoItTempFile,$FO_OVERWRITE+$FO_CREATEPATH)
    If $hFile = -1 Then
        MsgBox($MB_ICONERROR, $WinTitle, "Could not open temp file." & @CRLF & $AutoItTempFile)
        Exit
    EndIf
    Local $iFileWriteRet = FileWrite($hFile, $Clipboard)
    If $iFileWriteRet = 0 Then
        MsgBox($MB_ICONERROR, $WinTitle, "Could not write contents of clipboard to file." & @CRLF & $AutoItTempFile)
        Exit
    EndIf
    Local $iFileCloseRet = FileClose($hFile)
    If $iFileCloseRet = 0 Then
        MsgBox($MB_ICONERROR, $WinTitle, "Could not close file." & @CRLF & $AutoItTempFile)
        Exit
    EndIf
EndFunc   ;==>_ClipboardToFile
Func _PreviewScript()
    ; Create GUI
    GUICreate($WinTitle&" - Preview", 400, 300)
    $g_idMemo = GUICtrlCreateEdit("", 2, 2, 396, 296, $WS_VSCROLL)
    GUICtrlSetFont($g_idMemo, 9, 400, 0, "Courier New")
    GUISetState(@SW_SHOW)
    MemoWrite(FileRead($AutoItTempFile))
    $iMsgBoxRet=MsgBox($MB_ICONINFORMATION+$MB_YESNO,$WinTitle,"Are you sure you want to run this script?")
    GUISetState(@SW_HIDE)
    if $iMsgBoxRet <> $IDYES then Exit
EndFunc   ;==>_PreviewScript
Func _RunScript()
    if ShellExecute($AutoItRun,'"'&$AutoItTempFile&'"') = 0 Then
        MsgBox($MB_ICONERROR,$WinTitle,"Failed to create process.")
        Exit
    EndIf
EndFunc
Func MemoWrite($sMessage)
    GUICtrlSetData($g_idMemo, $sMessage & @CRLF, 1)
EndFunc   ;==>MemoWrite

Here's a sample hello world for you all to test with.

Msgbox(0,"Test","Hello World")

 

Edited by BetaLeaf
Added sample.

 

 

Link to comment
Share on other sites

@BetaLeaf ,

Interesting... Thanks for this script. :) Let me test your script. As far as i know, i need to copy the code from the browser. Pls correct me if i am wrong.  

Anyway, Danyfirex's solution needs a single click on this run button. It's like you are reading the code in the help file. Just a click, SciTE is open with your code. 

 

000258.jpg

Edited by kcvinu
Spoiler

My Contributions

Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language.

UDF Link Viewer   --- A tool to visit the links of some most important UDFs 

 Includer_2  ----- A tool to type the #include statement automatically 

 Digits To Date  ----- date from 3 integer values

PrintList ----- prints arrays into console for testing.

 Alert  ------ An alternative for MsgBox 

 MousePosition ------- A simple tooltip display of mouse position

GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function

Access_UDF  -------- An UDF for working with access database files. (.*accdb only)

 

Link to comment
Share on other sites

27 minutes ago, kcvinu said:

@BetaLeaf ,

Interesting... Thanks for this script. :) Let me test your script. As far as i know, i need to copy the code from the browser. Pls correct me if i am wrong.  

Anyway, Danyfirex's solution needs a single click on this run button. It's like you are reading the code in the help file. Just a click, SciTE is open with your code. 

 

000258.jpg

You are correct. You also need to set the options, specifically the $AutoItRun to point to the correct path. While I like the idea of a chrome extension, if you sync chrome on multiple computers, it may cause problems if autoit is in the wrong location/isn't installed.

 

 

Link to comment
Share on other sites

@BetaLeaf ,

Yeah, you are correct. And fortunately, i am using chrome in a single pc. 

Spoiler

My Contributions

Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language.

UDF Link Viewer   --- A tool to visit the links of some most important UDFs 

 Includer_2  ----- A tool to type the #include statement automatically 

 Digits To Date  ----- date from 3 integer values

PrintList ----- prints arrays into console for testing.

 Alert  ------ An alternative for MsgBox 

 MousePosition ------- A simple tooltip display of mouse position

GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function

Access_UDF  -------- An UDF for working with access database files. (.*accdb only)

 

Link to comment
Share on other sites

@BetaLeaf,

So , you didn't tested Danyfirex's extension yet ?

 

Spoiler

My Contributions

Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language.

UDF Link Viewer   --- A tool to visit the links of some most important UDFs 

 Includer_2  ----- A tool to type the #include statement automatically 

 Digits To Date  ----- date from 3 integer values

PrintList ----- prints arrays into console for testing.

 Alert  ------ An alternative for MsgBox 

 MousePosition ------- A simple tooltip display of mouse position

GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function

Access_UDF  -------- An UDF for working with access database files. (.*accdb only)

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...