pztlmx Posted July 6, 2017 Posted July 6, 2017 HI, Having several AutoIT and AutoHotKey Scripts. How can I in a fast and smooth way convert these to PowerShell scripts (.ps1) ?? Would be nice if there were a function, where you could export the script to PowerShell ? Best regards, Jan Larsen / IBM
Moderators JLogan3o13 Posted July 6, 2017 Moderators Posted July 6, 2017 (edited) @pztlmx yes, it would be great. It would also be nice if you could convert batch files to fully functional python with a click of a button, but it doesn't work that way. Powershell and AutoIt are vastly different languages, with different syntax and abilities. There are some options if you search the forum for using AutoItX to call AutoIt in PS, as well as running powershell commands from an AutoIt script, but you're not going to find a one-button convert/export feature. Edit: try this one for running PS commands in AutoIt, by our benevolent leader: Edited July 6, 2017 by JLogan3o13 Xandy 1 "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!
MattHiggs Posted July 17, 2017 Posted July 17, 2017 On 7/6/2017 at 8:54 AM, pztlmx said: Thanks. Will take a look... /Jan. Using the AutoIT powershell cmdlets is very much a trial and error process, as the cmdlets do not have any help file content, so you will have to make educated guesses as to what each function does until you find the functions that perform the action you are looking for.
ptrex Posted September 18, 2017 Posted September 18, 2017 Sure this is possible using the AutoITObject Server Quote What you'll find there is folder named AccessAutoIt. Unzip it somewhere and inside there will be five files: AutoItObject.au3 (1.2.8.0), AutoItServer.au3, Csharp.cs, JS.js and VBS.vbs. expandcollapse popupCLS # AutoIT Object instantition [reflection.assembly]::LoadWithPartialName("'Microsoft.VisualBasic") $oAutoIt = [Microsoft.VisualBasic.Interaction]::GetObject("AutoIt.Application") $oAutoItType = $oAutoIt.GetType() $WS_OVERLAPPEDWINDOW = [System.Convert]::ToInt64("00CF0000", 16) # 0x00CF0000 $hGui = $oAutoIt.Call("GUICreate", "PS AutoIt GUI test", -1, -1, -1, -1, $WS_OVERLAPPEDWINDOW) $hButton = $oAutoIt.Call("GUICtrlCreateButton", "Click", 100, 100, 100, 30) $hButton2 = $oAutoIt.Call("GUICtrlCreateButton", "Click me too", 100, 300, 100, 30) $WS_OVERLAPPEDWINDOW.GetType().Name $oAutoIt.Call("WinSetOnTop", "PS AutoIt GUI test", "", 1) $oAutoIt.Call("GUISetState") $AW_FADE_IN = [System.Convert]::ToInt64("00080000", 16) # 0x00080000 $oAutoIt.Call("DllCall", "user32.dll", "bool", "AnimateWindow", "hwnd", $hGui, "dword", 1000, "dword", $AW_FADE_IN) $Dummy = -3 Do{ if($oAutoIt.Call("GUIGetMsg") = -3) {Exit} Elseif($hButton) {$oAutoIt.Call("MsgBox", 262144+32+3, "Title", "Bzzz bzz bzzzz", 0, $hGUI)} Elseif($hButton2){$oAutoIt.Call("Beep", 500, 700)} sleep(1) } Until($Dummy) $oAutoIt.Call("GUIDelete") If( $oAutoIt.Call("MsgBox", 4 + 48 + 262144, "?", "Kill server?") = 6) { $oAutoIt.Quit} I quickly translated the vbscript Example into PowerShell... The events are not working well as expected but this is just a matter of passing the correct paramaters to the GUIGETMSG loop. PowerShell does a differenct Type casting of the Hex values apparently then vbscript and AutoIT. See original thread https://www.autoitscript.com/forum/topic/128627-access-autoit/#comment-892581 first post there are more examples on have to ... Rgds ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New
ptrex Posted September 18, 2017 Posted September 18, 2017 This are just some native AutoIT functions that are reused in PowerShell (using AutoITObject) 1. ToolTip Example 2. Random Example 3. MemGetStats Example expandcollapse popupCLS Write-host "Watch the ToolTip on your Screen ! " # AutoIT Object instantition [reflection.assembly]::LoadWithPartialName("'Microsoft.VisualBasic") $oAutoIt = [Microsoft.VisualBasic.Interaction]::GetObject("AutoIt.Application") $oAutoItType = $oAutoIt.GetType() $im = [reflection.bindingflags]::InvokeMethod $gp = [reflection.bindingflags]::GetProperty $oAutoItType.InvokeMember("Call", $im, $null, $oAutoIt, ("ToolTip", "Some cool text from AU3 !!! ",900, 400)) #$oAutoItType.InvokeMember("Call", $im, $null, $oAutoIt, ("Beep", 500, 700)) $oAutoItType.InvokeMember("Call", $im, $null, $oAutoIt, ("Sleep", "2000")) $oAutoItType.InvokeMember("Call", $im, $null, $oAutoIt, ("ToolTip", "")) # Or the short version $oAutoIt.GetType().InvokeMember("Call", $im, $null, $oAutoIt, ("ToolTip", "Some cool text",900, 400)) $oAutoIt.GetType().InvokeMember("Call", $im, $null, $oAutoIt, ("Sleep", 3000)) $oAutoIt.GetType().InvokeMember("Call", $im, $null, $oAutoIt, ("ToolTip", "")) Write-host "" # Call Random Number Function Write-host "Random Nr : " $oAutoIt.GetType().InvokeMember("Call", $im, $null, $oAutoIt, ("Random",1,100,1)) Write-host "" Write-host "Memory Stats : " $aArray = $oAutoIt.GetType().InvokeMember("Call", $im, $null, $oAutoIt, ("MemGetStats")) For($i=0 $i -le 5 $i++) { switch ($i) { 0 {"Memory Load : $([Math]::round(($aArray[$i]/ 1MB),2)) Gb" ; break} 1 {"Total physical RAM : $([Math]::round(($aArray[$i]/ 1MB),2)) Gb" ; break} 2 {"Available physical RAM : $([Math]::round(($aArray[$i]/ 1MB),2)) Gb" ; break} 3 {"Total Pagefile : $([Math]::round(($aArray[$i]/ 1MB),2)) Gb" ; break} 4 {"Available Pagefile : $([Math]::round(($aArray[$i]/ 1MB),2)) Gb" ; break} 5 {"Total virtual : $([Math]::round(($aArray[$i]/ 1MB),2)) Gb" ; break} 6 {"Available virtual : $([Math]::round(($aArray[$i]/ 1MB),2)) Gb" ; break} default {"Something else happened"; break} } } Enjoy ! ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New
DynamicRookie Posted December 31, 2017 Posted December 31, 2017 (edited) There's no way to convert an AutoIt script into a PS3. Edited January 1, 2018 by DynamicRookie Admins
Developers Jos Posted December 31, 2017 Developers Posted December 31, 2017 55 minutes ago, DynamicRookie said: i know this was already answered, i need more posts. Don't or you will be setback to zero as my first deed in 2018!!!! 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.
Moderators JLogan3o13 Posted December 31, 2017 Moderators Posted December 31, 2017 Agreed. @DynamicRookie stating outright that you are needlessly padding your post count is akin to waving a sign that screams "Ban me please". The forum rules ask above all that members exercise some common sense - I would suggest you think about it before your next post. "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!
DynamicRookie Posted January 1, 2018 Posted January 1, 2018 (edited) 13 minutes ago, JLogan3o13 said: . The forum rules ask above all that members exercise some common sense - I would suggest you think about it before your next post. Oh wow chill it was a joke meaning that my post was kind of pointless. Also, why the indirect insult, Why not just telling me to dont do it. I just said i need more posts, not that i'm grinding for them, i am not manipulating in any way the forum features, as the rules say: Quote Automated manipulation of polls, user reputation or other forum features. With typing a post that has relation with the main thread theme, is not manipulating, i am just telling my opinion and saying that i need more posts, a re-roll of my posts would be justified if my post was some kind of spam, pointless text, or a message with no relation with the thread, which is not So Quote I would suggest you think about it before your next post. Edited January 1, 2018 by DynamicRookie
Moderators JLogan3o13 Posted January 1, 2018 Moderators Posted January 1, 2018 No insult - simply stating what the forum rules specifically ask for, common sense. Quote Use common sense. If you do not have common sense, don't do anything. As for it being a joke, you have two of the three Mod staff stating it wasn't a funny one "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!
Moderators Melba23 Posted January 1, 2018 Moderators Posted January 1, 2018 DynamicRookie, Make it all three. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now