Jump to content
kcvinu

Is it possible to run the code from forum ?

Recommended Posts

kcvinu

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. 


My Contributions

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)

 

Share this post


Link to post
Share on other sites
JLogan3o13

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:


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
kcvinu

@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

My Contributions

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)

 

Share this post


Link to post
Share on other sites
BrewManNH

How hard is it to hit CTRL + C?

  • Like 1

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

Share this post


Link to post
Share on other sites
water
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 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
Mannyfresh15

People these days....

Share this post


Link to post
Share on other sites
Danyfirex

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

Share this post


Link to post
Share on other sites
kcvinu

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


My Contributions

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)

 

Share this post


Link to post
Share on other sites
kcvinu

@Danyfirex ,

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


My Contributions

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)

 

Share this post


Link to post
Share on other sites
JLogan3o13

Seriously, four clicks is worth all this? And yet you have the patience to code?


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
RyukShini

I really don't see anyone who will use this?
its so simple and quite fast imo.
Double click code, CTRL+A, CTRL+C
Come one, are you that laizy :>

Share this post


Link to post
Share on other sites
Danyfirex

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

  • Like 1

Share this post


Link to post
Share on other sites
kcvinu

@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

My Contributions

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)

 

Share this post


Link to post
Share on other sites
kcvinu

@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.


My Contributions

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)

 

Share this post


Link to post
Share on other sites
BetaLeaf

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.

False Positive Reporter - Mass email all anti virus vendors with an attachment of your program for fast and easy whitelisting.

PortableApps.com App Creation Wizard  - A simple GUI-based Wizard for creating PortableApps.

SoundBoard - Play any song or sound you want at the press of a hotkey.

My GitHub Page: https://github.com/BetaLeaf

Share this post


Link to post
Share on other sites
kcvinu

@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

My Contributions

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)

 

Share this post


Link to post
Share on other sites
BetaLeaf
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.

  • Like 1

False Positive Reporter - Mass email all anti virus vendors with an attachment of your program for fast and easy whitelisting.

PortableApps.com App Creation Wizard  - A simple GUI-based Wizard for creating PortableApps.

SoundBoard - Play any song or sound you want at the press of a hotkey.

My GitHub Page: https://github.com/BetaLeaf

Share this post


Link to post
Share on other sites
kcvinu

@BetaLeaf ,

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

  • Like 1

My Contributions

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)

 

Share this post


Link to post
Share on other sites
BetaLeaf
Just now, kcvinu said:

@BetaLeaf ,

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

I am too but I have a portable version of chrome I use sometimes. I also have a portable version of autoit as you might have already noticed.

  • Like 1

False Positive Reporter - Mass email all anti virus vendors with an attachment of your program for fast and easy whitelisting.

PortableApps.com App Creation Wizard  - A simple GUI-based Wizard for creating PortableApps.

SoundBoard - Play any song or sound you want at the press of a hotkey.

My GitHub Page: https://github.com/BetaLeaf

Share this post


Link to post
Share on other sites
kcvinu

@BetaLeaf,

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

 


My Contributions

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)

 

Share this post


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

×