Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 07/16/2015 in all areas

  1. Here is a complete example of combining Autoit with PHP and MySQL was written by me. Include: Sign in, sign out.Create, read, update and delete data between client (AutoIt) and server (PHP/MySQL).Only allow user to log into a client at the same time. Video demo: https://www.youtube.com/watch?v=gQyfXLO0pls Screenshot (Main GUI) Usage If you want to test on your computer, you will need to create a localhost. I recommend to use WAMP or XAMPP. First, create a new database by importing from SETUP.sql file (see video for more info). Then, edit your path to SERVER in AutoIt-PHP-MySQL.au3: Global Const $SERVER = 'http://localhost/AutoIt/index.php?act='Make sure you have copied all files in the folder "PHP + MySQL" into a folder named AutoIt in your Localhost (www or htdocs directory). Yeah, now you can open the file "AutoIt-PHP-MySQL.au3" and try it yourself! Default username and password is: admin Download: Tutorial-AutoIt-PHP-MySQL-v1.0.rar[Tutorial] AutoIt - PHP - MySQL v2.0.zip (Thank @JohnOne for having suggested using zip format)Changelog ----- Hope you enjoyed it!
    2 points
  2. I can't be responsible for any impact of your script or services you would run in production. | _Services_UDF v4 | | By Arcker | Run your script as a service | Req. AutoIt 3.3.8.1 min, last beta recommended ( tested in 3.3.9.21 ) |_______________________________________ ++ Preparing v5 !! Checked on 27/04/2015 <> Updated on 10/23/2013 <> Updated 07/29/2013 <> Best practices Updated 24/02/2012 -- Removed GUI code, and old codes. == Warning : 26/02/2012 <> New Version (v3 ) : 29/07/2013 | Thx to ShminkyBoy, wraithdu, Udgeen and HolmesShelock for their great contributions. Special thx to bitboy, Downloads see end of this post : ServiceExample_v4, Services.au3, ServicesConstants.au3 Presentation Here is my _Service _ UDF With this UDF, you can compile your autoit script and run it as service. Any comments are welcome. Hope you'll like it, 1 - changelog Update V4 : 23/10/2013,27/04/2015 Update : V3 on 29/07/2013 Compile the service example to see how to do then you can use the main function for your proper scriptChoose an appropriate location and copy the script here.open a command prompt, and execute the compiled script with option –I ( must be admin right since vista )start / execute "services.msc" . You will see a service called "Autoit_service". you can execute "sc query" in a command prompt too.Launch it : it will run the previous compile script. The main function will be executed after the service_init.stop and relaunch the service as you wish. Examples / Session Change / uses v1 (lock, logon, etc) By HolmesShelock. Awesome work. Edit : this example doesn't use v2 or v3 method SessionChange Service.zip Example output to give you an idea Examples demos Synoptic And for End Users, I've tried to explain the service control manager and the way it works with programs. see below Best Practice, by arcker : /! please read this if you encounter stability issues I've had to rework on services.au3 to reflect threadsafe. Threadsafe means each dll call must be on "dllopened" instead of calling dll directly for example, if you need a function in kernel32.dll, you have to open it and call it after. That's contraignant since a lot of integrated functions in autoit are not programmed this way. If you take my services.au3, at the end, you'll see reworked function to handle this change. I've not tried services for a while, since i don't need it for now, but i can help you only if your provide whole script, to see how you call every functions. I can tell that fix stability issues in callback, but i don't think it's need for your script, as far as you don't use callback. Best Practice, by udgeen : Good news! Probably i've found the working method of integrating service.au3 with other projects I realised it after ASock.au3 project by Zatorg (please, sorry if im wrong) - ASock is asynck socket - tcp on event (uses ws2_32.dll). Asock & sqlite didnt work together. The only reason for that was..._ArrayDisplay() func with gui!!! Ok. I made special sqlite.au3 without dependences. It works, but my udf seemed too be much heavy to use at another project. Few weeks ago I returned to service.au3 and found TCP UDF, Event driven project based on ASock.au3. It seemed to work as example, but didn't work at all as service. In my variant of service_example.au3 i posted msdn words about service_main procedure, that it must contain all global vars of project I'll try to post that project as an another service_example.au3 in some weeks here. If it will works. Some advice: use SysInternals Process Explorer (free gui based), or kill.exe from support tools to stop suspended service process. U can start-stop service even net start/net stop commands. Use file logging while debuging. No need to install-uninstall service after every recompilation: only stop, recompile, start. See, if it was suspended (while stopping) - kill process. The only reason not to stop service correctly i've found for today is unclean exit: opened sockets, maybe some dlls. Edit : Arcker note: too bad, that would be too easy. unclean exit is not due to opened dll, but by some more internal exit checks or something. FAQ. 1 - Hey, I've got error 1063 or error 0, what does that mean ? It simply means that you intend to run your script in scite or directly by executing it. Your script has to be installed as service and run from it. Several ways to do it : You have to combine all Globals in one place: for example at the the begining. You have to make it with other udfs too... silly workThen sort Global Const and other Global statements. If u see something like global $x = 1 do that way: global $x leeve at top. $x =1 insert into module's (udf or project) Init func.U have to do it even with standart udf... or use only necessary functions from it in your own include. Or... maybe u have another plan?Try to build your project with modified udfs - does it works now? Hmm... But it have to Maybe later after everything will work fine i'll say "msdn is wrong, microsoft lies"... But maybe i'll say that microsoft - is not so bad, because autoit works in itnet start "yourservicename"Services.mscUse API provided _Service_start, Service_stop. 2 - I want to make a GUI ! It's not possible in a service. Create another process and communicate with your service by using IPC. 3 - I've to let the main function that way ? That's contraignant. Hey, a script intended to run as service is special no ? Autoit is not C++. The only way to have a "Main" in autoit is to have a function. If you find another way, please share it ServiceExample_ThreadSafe.au3 Services.au3 ServiceExample_v4.au3 ServicesConstants.au3
    1 point
  3. Moriba

    Android UDF

    Hello, I created this UDF last year for my Orient Myanmar Language System. This UDF can control any Android devices. So used it wisely. ; #CURRENT# ===================================================================================================================== ; _Android_Call ; _Android_CommandExists ; _Android_Connect ; _Android_Dial ; _Android_FileExists ; _Android_Flash ; _Android_ForceStopPackage ; _Android_GetBatteryHealth ; _Android_GetBatteryLevel ; _Android_GetBatteryPlugType ; _Android_GetBatteryStatus ; _Android_GetBatteryTechnology ; _Android_GetBatteryTemperature ; _Android_GetBatteryVoltage ; _Android_GetDeviceID ; _Android_GetExternalStorageDirectory ; _Android_GetLegacyExternalStorageDirectory ; _Android_GetNetworkClass ; _Android_GetNetworkCountryISO ; _Android_GetNetworkOperator ; _Android_GetNetworkOperatorName ; _Android_GetNetworkType ; _Android_GetNetworkTypeName ; _Android_GetPackageInfo ; _Android_GetPhoneType ; _Android_GetProperty ; _Android_GetSerialNumber ; _Android_GetSIMCountryISO ; _Android_GetSIMOperator ; _Android_GetSIMOperatorName ; _Android_GetSIMState ; _Android_GetState ; _Android_HasBusyBox ; _Android_HasRootAccess ; _Android_Install ; _Android_IsAirplaneModeOn ; _Android_IsBatteryCharged ; _Android_IsBatteryLow ; _Android_IsBatteryPresent ; _Android_IsBootloader ; _Android_IsNetworkRoaming ; _Android_IsOffline ; _Android_IsOnline ; _Android_IsScreenOn ; _Android_Pull ; _Android_Push ; _Android_Reboot ; _Android_Remount ; _Android_Send ; _Android_SendSMS ; _Android_Shell ; _Android_StartActivity ; _Android_TakeSnapshot ; _Android_Uninstall ; _Android_WaitForDevice ; _Android_Wake ; _Android_WipeDataCache ; =============================================================================================================================== Download Android UDF (11.22.2014) Download ADB, Fastboot & AAPT Here I will accept whatever your suggestion. Can improve my UDF. I love AutoIt. It's so easy and powerful.
    1 point
  4. JohnOne

    Using a small database

    OMG! Jon must have forgotten to add those to the changelog Just for the record, sqlite functions are in the standard UDF's.
    1 point
  5. I use Windows 10 devellopers preview fast ring (very newest win10 Edition) and there is MS Edge the default browser, but you can easily switch to ie11. Till now, all my ie.au3 scripts are running fine. Edit: Post a running reproducer and i'll test it on my machine.
    1 point
  6. Seemed _StringBetween was objecting to this: '_regular">' Try this: #include <String.au3> $sourcec = BinaryToString(InetRead('https://leakforums.net/forum-536', 1)) $FirstChunk = _StringBetween($sourcec, 'forumdisplay', '</a>') For $a In $FirstChunk ConsoleWrite($a & @CRLF) Next
    1 point
  7. I vote YES. It employs basic techniques that won't perplex the noob Help file reader, yet like any good teacher introduces one not-so-obvious item (Ternary Conditional Operator) for the reader to discover (provided a reference link). How about this rule: a limit of one puzzle per Help example, always with a comment that at least leads to a thorough explanation? The reader is drawn forward gradually to expanding his or her vocabulary and tool set.
    1 point
  8. 1 point
  9. I agree with JohnOne, but most developers should be using 7-Zip, so it's shouldn't be a massive problem.
    1 point
  10. Might be a good idea to pack your files with something other than .rar, not everyone has winrar.
    1 point
  11. WoodGrain, You need to use a ControlID in the TrayItemSetState call - at the moment you are using a literal text string: #include <TrayConstants.au3> Opt("TrayMenuMode", 3) Opt("TrayOnEventMode", 1) Global $bRegIstalled = False $cAutoStart = TrayCreateItem("AutoStart") ; Store ControlID here TrayItemSetOnEvent($cAutoStart, "AutoStart") TrayCreateItem("About") TrayCreateItem("") TrayCreateItem("Exit") TrayItemSetOnEvent(-1, "ExitScript") TraySetState($TRAY_ICONSTATE_SHOW) While 1 Sleep(10) WEnd Func AutoStart() If $bRegIstalled Then $bRegIstalled = False TrayItemSetState($cAutoStart, $TRAY_UNCHECKED) ; Use it here... Else $bRegIstalled = True TrayItemSetState($cAutoStart, $TRAY_CHECKED) ; ...and here EndIf EndFunc Func ExitScript() Exit EndFuncAll clear? M23
    1 point
  12. 1 point
  13. Danyfirex

    Google Image Save

    Hi Mates. Recently I was needing to download some images from google images. but I got tired,frustrated when I had to click in the imagen then click again to be able to download the image with its real size. so For That I write this small code. For downloading just simple go over the image in google image page., then press CTRL+MOUSE(just a little move is enowgh) that make a drag&drop so in that moment the code show a little window(5*5 LOL + transparency) so when realease the mouse (mouse up event) the code start new process(itself) to download the image. For well in Google Chrome Broswer. For Firefox almost always fails. Feactures. Allow choose a folder for download save.Allow Open the downloadfolder. #NoTrayIcon #include <GuiRichEdit.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Misc.au3> #include <MsgBoxConstants.au3> #include <TrayConstants.au3> #include <File.au3> #include <InetConstants.au3> Opt("GUIOnEventMode", 1) Opt("TrayOnEventMode", 1) Opt("TrayMenuMode", 3) Local $AppExist = 0 If $CmdLine[0] = 0 Then If _Singleton('Danyfirex', 1) = 0 Then MsgBox(64, "", "Aplication is Already Running") Exit EndIf EndIf If $CmdLine[0] = 2 Then ;Downloader to Folder Local $sSaveFolder = $CmdLine[2] ;URL Local $sURL = $CmdLine[1] ;Folder Download($sURL, $sSaveFolder) Exit EndIf If Not @Compiled Then MsgBox(64, "", "Must be Compile For Download") EndIf HotKeySet("{ESC}", "Terminate") Global $sFolderPath = @UserProfileDir & "\Pictures\" Local $hDLL = DllOpen("user32.dll") Local $hGUI, $hRichEdit = 0 $hGUI = GUICreate("Google Image Save", 5, 5, -1, -1, $WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW)) $hRichEdit = _GUICtrlRichEdit_Create($hGUI, "", 0, 0, 5, 5, -1) TrayCreateItem("Set Folder to Save") TrayItemSetOnEvent(-1, "SetFolder") TrayCreateItem("") TrayCreateItem("Open Folder") TrayItemSetOnEvent(-1, "OpenFolder") TrayCreateItem("") TrayCreateItem("About...") TrayItemSetOnEvent(-1, "About") TrayCreateItem("") TrayCreateItem("Exit") TrayItemSetOnEvent(-1, "Terminate") TraySetState($TRAY_ICONSTATE_SHOW) WinSetTrans($hGUI, '', 1) GUISetState(@SW_HIDE) Local $aMouse = 0 Local $bCheck = False Local $sDecode = "" Local $i = 0 While True If _IsPressed("11", $hDLL) And _IsPressed("01", $hDLL) Then GUISetState(@SW_SHOW) $aMouse = MouseGetPos() WinMove($hGUI, '', $aMouse[0] - 2, $aMouse[1] - 2) $bCheck = True EndIf If _GUICtrlRichEdit_GetText($hRichEdit) <> '' And $bCheck Then $sDecode = GetURL(_GUICtrlRichEdit_GetText($hRichEdit)) If $sDecode = "" Then $i += 1 TrayTip($i & " Oops :(", 'Not Valid URL', 5) Else $i += 1 TrayTip("[" & $i & "] Downloading :)", $sDecode, 5) If Not @Compiled Then MsgBox(64, "", "Must be Compile For Download") Else ShellExecute("GoogleImageSave.exe", $sDecode & " " & $sFolderPath) EndIf EndIf ConsoleWrite($sDecode & @CRLF) _GUICtrlRichEdit_SetText($hRichEdit, '') GUISetState(@SW_HIDE) $bCheck = False; EndIf Sleep(100) WEnd Func GetURL($BADURL) Local $GoodURL = StringRegExp($BADURL, 'imgurl=(.*)\.(jpg|png|gif|bmp)', 3) If @error Then Return '' Return $GoodURL[0] & '.' & $GoodURL[1] EndFunc ;==>GetURL Func Terminate() If MsgBox($MB_YESNO, "Exit", "¿Do You Want to Exit") = 6 Then Exit EndFunc ;==>Terminate Func SetFolder() $sFolderPath = FileSelectFolder('Select a Folder', "") If $sFolderPath <> "" Then $sFolderPath &= '\' If $sFolderPath = "" Then $sFolderPath = @UserProfileDir & "\Pictures\" EndFunc ;==>SetFolder Func OpenFolder() ShellExecute($sFolderPath) EndFunc ;==>OpenFolder Func About() MsgBox(0, "Autoit Forum :)", "Written by Danyfirex") EndFunc ;==>About Func _GetName($psFilename) Local $szDrive, $szDir, $szFName, $szExt _PathSplit($psFilename, $szDrive, $szDir, $szFName, $szExt) Return $szFName & $szExt EndFunc ;==>_GetName Func Download($Url, $sSaveFolder) Local $sImageName = _GetName($Url) InetGet($Url, $sSaveFolder & $sImageName, $INET_FORCERELOAD) TraySetState($TRAY_ICONSTATE_SHOW) TrayTip("Downloaded :)", "", 0) TrayTip("Downloaded :)", $Url, 5) Sleep(5000) EndFunc ;==>Download Saludos
    1 point
×
×
  • Create New...