
AcidCorps
Active Members-
Posts
224 -
Joined
-
Last visited
Everything posted by AcidCorps
-
Nice little function for testing and debugging.
AcidCorps replied to AcidCorps's topic in AutoIt Example Scripts
Came across this topic today, figured I'd upload the current version. I added a couple things such as being able to copy to the clipboard. I have also distributed it to a couple friends so it's in more of a UDF form now. Examples: $SimpleExample = 'Hello World' Test($SimpleExample) Dim $ArrayExample[4] $ArrayExample[0] = 3 $ArrayExample[1] = 'Hello' $ArrayExample[2] = 'Array' $ArrayExample[3] = 'World' Test($ArrayExample) $DllStructExample = DllStructCreate('char[128]') DllStructSetData($DllStructExample, 1, 'Hello DllStruct World!') Test($DllStructExample) $BinaryExample = StringToBinary('Hello Binary World') Test($BinaryExample) $PtrExample = DllStructCreate('char[128]') DllStructSetData($PtrExample, 1, 'Hello Pointer World') $PtrExampleDisplay = DllStructGetPtr($PtrExample) Test($PtrExampleDisplay) UDF: #include-once #include <String.au3> #include <Array.au3> ; =============================================================================================================================== ; Name...........: Test ; Description ...: Display variable with data ; Syntax.........: Test( $iVar, $iClip, $iLine ) ; Parameters ....: $iVar - Variable to display. ; $iClip - Copy data to clipboard ; If iVar is Array: $iClip = Element to copy to clipboard. ; If $iVar is anything else: 1 = Copy $iVar to clipboard. ; $iLine - ##Internal Use Only### do not change this paramater, it is used to find $iVar's name ; Return values .: Return from _ArrayDisplay or MsgBox ; Author ........: LacWare ; Example .......: Test($Variable, 1) ; =============================================================================================================================== Func Test($iVar = '', $iClip = '', $iLine = @ScriptLineNumber) Local $xTitle, $xOpen, $xLine, $xType, $xMsg ;Reading script file $xOpen = FileOpen(@ScriptFullPath) $xLine = FileReadLine($xOpen, $iLine) FileClose($xOpen) ;Getting variable name $xTitle = _StringBetween($xLine, 'Test(', ')') If Not IsArray($xTitle) Then $xTitle = _StringBetween($xLine, 'Test(', ',') ;Creating window title $xTitle = 'Var: ' & $xTitle[0] & ' Line: ' & $iLine ;Getting variable type $xType = VarGetType($iVar) ;Displaying variable If IsArray($iVar) Then ;If variable is an array display in _ArrayDisplay If $iClip <> '' Then ClipPut($iVar[$iClip]) Return _ArrayDisplay($iVar, $xTitle) ElseIf $xType = 'DLLStruct' Then ;If variable DLLStruct generate data and display $xTitle &= ' Type: ' & $xType $xMsg = 'Size: ' & DllStructGetSize($iVar) & @CRLF & @CRLF & 'Data: ' & DllStructGetData($iVar, 1) If $iClip = 1 Then ClipPut(DllStructGetData($iVar, 1)) Return MsgBox(64, $xTitle, $xMsg) ElseIf $xType = 'Binary' Then ;If variable Binary generate data and display $xTitle &= ' Type: ' & $xType $xMsg = 'Size: ' & BinaryLen($iVar0) & @CRLF & @CRLF & 'Hex: ' & String($iVar) & @CRLF & @CRLF & 'Data: ' & BinaryToString($iVar) If $iClip = 1 Then ClipPut(BinaryToString($iVar)) Return MsgBox(64, $xTitle, $xMsg) ElseIf $xType = 'Ptr' Then ;If variable Ptr generate data and display If IsHWnd($iVar) Then $xTitle = 'HWnd: ' & $xTitle Else $xTitle = 'Ptr: ' & $xTitle EndIf If $iClip = 1 Then ClipPut(String($iVar)) Return MsgBox(64, $xTitle, String($iVar)) Else ;If variable is anything else display in MsgBox $xTitle &= ' Type: ' & $xType If $iClip = 1 Then ClipPut($iVar) MsgBox(64, $xTitle, String($iVar)) EndIf EndFunc ;==>Test Thanks dany for the extra features, been using them for a couple years now. -
I'm writing a script that will take a list of bands I make and suggest new bands based on them (I've done another version of this in the past but a hard drive crash took it away) My problem is I've created a funciton _ArtistGetCorrection that tells me if the band name is spelled correctly. However if I pass a variable to it it tells me my api key is invalid but if it's a string it's valid. For example _ArtistGetCorrection("ACDC") will give me the correction where as _ArtistGetCorrection($Favorites[$i]) will tell me that my API Key is invalid. Sorry if the codes a bit choppy I've been trying to wrap my brain around this one for a little bit at the expense of organzied code. #include <Test.au3> #include <Constants.au3> Dim $VoteList Global $Bin = @ScriptDir & '\Bin\' & @CPUArch $Wget = $Bin & '\wget --no-check-certificute ' $Curl = $Bin & '\curl.exe ' $myKey = ;Hidden $Include = FileRead('include.txt') $Favorites = _StringBetween($Include, '###Favorites###', '###Good Artists###') $Favorites = StringSplit($Favorites[0], @CR) $GoodArtists = _StringBetween($Include, '###Good Artists###', '###End###') $GoodArtists = StringSplit($GoodArtists[0], @CR) $Sim = _ArtistGetCorrection('Green Day') Test($Sim) $i = 0 Do If $Favorites[$i] = '' Or $Favorites[$i] = @LF Then _ArrayDelete($Favorites, $i) Else $i += 1 EndIf Until $i = Ubound($Favorites) $i = 0 Do If $GoodArtists[$i] = '' Or $GoodArtists[$i] = @LF Then _ArrayDelete($GoodArtists, $i) Else $i += 1 EndIf Until $i = Ubound($GoodArtists) - 1 _ArrayDelete($Favorites, 0) _ArrayDelete($GoodArtists, 0) $i = 1 Test($Favorites[$i]) $Favorites[$i] = _ArtistGetCorrection($Favorites[$i]) $Favorites[$i] = _ArtistGetCorrection('Modest Mouse') Test($Favorites) Func _ArtistGetCorrection($iArtist) Local $Pid, $Return $Pid = Run($Curl & ' http://ws.audioscrobbler.com/2.0/?method=artist.getcorrection&artist=' & StringReplace($iArtist, ' ', '%20') & '&api_key=' & $myKey & '&format=json', $Bin, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) $Return = '' While 1 $Return &= StdoutRead($Pid) If @error Then ExitLoop WEnd $Return = StringTrimLeft($Return, StringINStr($Return, '":"') + 2) Test($Return) If StringInStr($Return, '\n "}') Then Return $iArtist Else Return StringLeft($Return, STringINStr($Return, '","') - 1) EndIf EndFunc ;==>_ArtistGetCorrection Func _ArtistGetSimilar($iArtist) Local $Pid, $Return $Pid = Run($Curl & ' http://ws.audioscrobbler.com/2.0/?method=artist.getsimilar&artist=' & StringReplace($iArtist, ' ', '%20') & '&api_key=' & $myKey & '&format=json', $Bin, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) $Return = '' While 1 $Return &= StdoutRead($Pid) If @Error THen ExitLoop WEnd Return _StringBetween($Return, '"name":"', '","') EndFunc ;==>_ArtistGetSimilar The only edit I've made is instead of storing my key in plain text in the url i've changed it to $myKey.
-
Nice little function for testing and debugging.
AcidCorps replied to AcidCorps's topic in AutoIt Example Scripts
Yea I figured a lot of people had their own versions which is kinda why I posted it, see what additions could be made, worked like a charm now I can work with DLLStructs easier too. -
Nice little function for testing and debugging.
AcidCorps replied to AcidCorps's topic in AutoIt Example Scripts
Heh yea that stringbetween was a nice add on, started off as a simple display array or string type function but I like where it's heading, also nice to be able to add a simple Test($Variable) and see everything you need to know about it. Also added your addition to my function list now, thanks for the idea I don't use DLLStructs often myself so probably wouldn't have thought of that -
Not the fanciest thing in the world but it's very helpful while I'm debugging some of my programs. Displays wither the input variable was an Array or Variable, Tells you the line number as well as variable name, and displays contents either in msgbox or _arraydisplay #include #include $Example = 'Hello World' Test($Example) Dim $ExampleA[3] $ExampleA[0] = 2 $ExampleA[1] = 'Hello' $ExampleA[2] = 'World' Test($ExampleA) Func Test($iVar = '', $iLine = @ScriptLineNumber) If IsArray($iVar) Then $xBetween = _StringBetween(FileReadLine(@ScriptFullPath, $iLine), 'Test(', ')') $xBetween = $xBetween[0] _ArrayDisplay($iVar, 'Array: ' & $xBetween & ' Line: ' & $iLine) Else $xBetween = _StringBetween(FileReadLine(@ScriptFullPath, $iLine), 'Test(', ')') $xBetween = $xBetween[0] MsgBox(0, 'Variable: ' & $xBetween & ' Line: ' & $iLine, $iVar) EndIf EndFunc ;==>Test
-
Ok what I have is two menus one on top and one on bottom what I can't get is so that when a button on top is clicked the submenu (bottom menu) is deleted to make room for the new submenu. $xGui = SkinGuiCreate('', $gWidth, $gHeight, 0, 0, $xSkin, 1, 25, 0) GUISetState() ;Top Row Buttons $gTopMenu[2] = XSkinButton('Images', ($gButton1Y * 9.5), $gButton1Y, $gButtonW, $gButtonH, 'PageChangeImages') Sleep($gAnimationTime) $gTopMenu[4] = XSkinButton('Internet', ($gButton1Y * 11), $gButton1Y, $gButtonW, $gButtonH, 'PageChangeInternet') Sleep($gAnimationTime) $gTopMenu[3] = XSkinButton('Games', ($gButton1Y * 8), $gButton1Y, $gButtonW, $gButtonH, 'PageChangeGames') Sleep($gAnimationTime) $gTopMenu[5] = XSkinButton('Settings', ($gButton1Y * 12.5), $gButton1Y, $gButtonW, $gButtonH, 'PageChangeSettings') Sleep($gAnimationTime) $gTopMenu[1] = XSkinButton('Audio', ($gButton1Y * 6.5), $gButton1Y, $gButtonW, $gButtonH, 'PageChangeAudio') Sleep($gAnimationTime) $gTopMenu[6] = XSkinButton('Shutdown', ($gButton1Y * 14), $gButton1Y, $gButtonW, $gButtonH, 'PageChangeShutdown') Sleep($gAnimationTime) $gTopMenu[0] = XSkinButton('Video', ($gButton1Y * 5), $gButton1Y, $gButtonW, $gButtonH, 'PageChangeVideo') While 1 MouseOver() Sleep(100) WEnd Func PageChange($xButton) _ClearMenu(1) Switch $xButton Case 'Images' $gBottomMenu[4] = XSkinButton('Design', ($gButton1Y * 10), @DesktopHeight - (2 * $gButton1Y), $gButtonW, $gButtonH, 'PageChangeDesign') Sleep($gAnimationTime) $gBottomMenu[3] = XSkinButton('Import/Export', ($gButton1Y * 8.5), @DesktopHeight - (2 * $gButton1Y), $gButtonW, $gButtonH, 'PageChangeIE') Sleep($gAnimationTime) $gBottomMenu[5] = XSkinButton('Find', ($gButton1Y * 11.5), @DesktopHeight - (2 * $gButton1Y), $gButtonW, $gButtonH, 'PageChangeFind') Sleep($gAnimationTime) $gBottomMenu[1] = XSkinButton('View', ($gButton1Y * 7), @DesktopHeight - (2 * $gButton1Y), $gButtonW, $gButtonH, 'PageChangeView') Case 'Internet' Sleep(10 Case 'Shutdown' _Shutdown() EndSwitch EndFunc ;==>PageChange Func _ClearPage($iMenu = 1) For $i = 1 To 5 GuiCtrlDelete($gBottomMenu[$i]) Next EndFunc Func _Shutdown() Exit EndFunc ;==>_Shutdown I removed a lot of the script as it would take awhile to attach all my includes anyway but this is where I'm having trouble, I want it so that when _ClearPage is called it will delete any button listed in the $gBottomMenu array.
-
Change image back after hover
AcidCorps replied to AcidCorps's topic in AutoIt General Help and Support
Thank you -
This script is pretty long at this point (a lot of directory reading and web reading) so I'm only going to include the part that I need help on While 1 $Msg = GUIGetMsg() $Hover = _ControlHover(0) If $Hover = 1 Then Prewview(@Extended) EndIf If $Hover = 0 Then GuiCtrlSetImage($GuiBackground, $GuiWallpaper) Select Case $Msg = $Exit Exit EndSelect WEnd Func Prewview($xControl) $Text = GuiCtrlRead($xControl) For $i = 1 to $GuiMenuItems[0][0] If $Text = $GuiMenuItems[$i][0] Then $Element = $i ExitLoop EndIf Next $PreviewPic = @ScriptDir & '\' & IniRead($GuiMenuDir & $GuiMenuItems[$Element][1], 'Data', 'ImagePreview', 'bin\menuitems\images\movies.jpg') GuiCtrlSetImage($GuiBackground, $PreviewPic) EndFunc EndFunc my problem is I can get the iamge to change when the button is hovered over but when I try to add If $Hover <> 1 Then GuiCtrlSetImage($GuiBackground, $GuiWallpaper) it flickers the image I want to have when its hovered and then just flickers the background image a lot Thanks in advance
-
I was just searching to see if anyone has used Lame in an autoit script because I wanted to have the same thing only no GUI (Automatically convert files in a certain folder then delete them) this will be great for an example, thank you Wine allows you to run Windows programs under Linux
-
I'm working on a script for an alarm clock using many existing examples from the forum but I came across a problem, right now I'm trying to place the 1, 2, 3, 4... 12, in the appropriate places inside the clock but can't figure out how to make them the right place, I know I saw an example where someone used sin or cos but I can't find it again and I don't remember my math good enough to figure out how to myself, if anyone can point me in the right direction I'd appreciate it. Here's my script so far (mostly nonfunctional) CODE #include <GuiConstants.au3> #include <StaticConstants.au3> #include <Date.au3> Opt("GUIOnEventMode", 1) Global $GuiTitle = 'LacWare Alarm Clock (Beta)' Global $AnalogBackgroundColor = IniRead('Data.ini','Color','AnalogBackground', 0xFFFFFF) Global $AnalogBorderColor = IniRead('Data.ini','Color','AnalogBorder', 0x000000) Global $AnalogNumberColor = IniRead('Data.ini','Color','AnalogNumber', 0x000000) Global $DigitalClockColor = IniRead('Data.ini','Color','DigitalClock', 0x0000FF) Global $DateColor = IniRead('Data.ini', 'Color', 'Date', 0x0000FF) Global $Hour = @HOUR Global $Min = @MIN Global $Sec = @SEC Global $Date = _NowDate() Global $Exit = False Dim $Numbers[12] ;Create GUI $Gui = GuiCreate($GuiTitle, 400, 250, -1, -1) GuiCtrlCreateLabel('', 200, 0, 3, 250, $SS_SUNKEN) ;Create Graphics $AnalogBackground= GUICtrlCreateGraphic(0, 0, 0, 0) $AnalogBorder = GuiCtrlCreateGraphic(0, 0, 0, 0) $DigitalClock = GuiCtrlCreateLabel($Hour & ':' & $Min & ':' & $Sec, 15, 175, 150, 35, $SS_CENTER) $GuiDate = GuiCtrlCreateLabel($Date, 15, 220, 150, 35, $SS_CENTER) ;Create Labesl $TodaysAlarmsLabel = GuiCtrlCreateLabel("Today's Alarms:", 210, 10, 180, 25, $SS_CENTER) ;CreateButton $AddAlarm = GuiCtrlCreateButton('Add Alarm', 210, 175, 180, 20) $ViewAlarms = GuiCtrlCreateButton('View Alarms', 210, 200, 180, 20) $ViewCalendar = GuiCtrlCreateButton('View Calendar', 210, 225, 180, 20) ;Set Properties GUICtrlSetGraphic($AnalogBackground,$GUI_GR_COLOR, $AnalogBackgroundColor, $AnalogBackgroundColor) GUICtrlSetGraphic($AnalogBackground,$GUI_GR_ELLIPSE, 15,15, 150,150) GuiCtrlSetGraphic($AnalogBorder, $GUI_GR_PENSIZE, 2) GuiCtrlSetGraphic($AnalogBorder, $GUI_GR_COLOR, $AnalogBorderColor) GuiCtrlSetGraphic($AnalogBorder, $GUI_GR_NOBKCOLOR) GuiCtrlSetGraphic($AnalogBorder, $GUI_GR_ELLIPSE, 15, 15, 150, 150) GuiCtrlSetFont($DigitalClock, 30) GuiCtrlSetColor($DigitalClock, $DigitalClockColor) GuiCtrlSetFont($TodaysAlarmsLabel, 15, 400, 4) GuiCtrlSetFont($GuiDate, 20) GuiCtrlSetColor($GuiDate, $DateColor) ;Event GuiSetOnEvent($Gui_Event_Close, '_Exit') GuiSetOnEvent($Gui_Event_Minimize, '_Minimize') GuiSetState() while 1 $Msg = GuiGetMsg() $Hour = @HOUR $Min = @MIN $Sec = @SEC $Date = _NowDate() GuiCtrlSetData($DigitalClock, $Hour & ':' & $Min & ':' & $Sec) GuiCtrlSetData($GuiDate, $Date) Sleep(250) WEnd Func _Exit() Exit EndFunc Func _Minimize() GuiSetState(@SW_MINIMIZE) EndFunc
-
Thank you very much
-
First off thank you for this script I've been using it for awhile now Now my question is how can I read the full library list? I see the variable $Library_Tracks but when i put it in a msgbox nothing comes up and when i put it in an array nothing comes up also tried for $tracks in $Library_Tracks and couldn't get anything anybody know of how I can read this variable or how I can read the iTunes Library
-
!Help - Return Value From a COM object
AcidCorps replied to oktoberfest2's topic in AutoIt General Help and Support
is there a solution for this, I'm having the same problem with my current script -
ListView View filename without scroll
AcidCorps replied to AcidCorps's topic in AutoIt GUI Help and Support
alright thanks for your help -
Still could be handy while your writing just include this then when your script is done just go through and find the includes you need Edit: Typo
-
Thank you
-
ListView View filename without scroll
AcidCorps replied to AcidCorps's topic in AutoIt GUI Help and Support
I was thinking of doing it like that but then how do I get the full path when I need to from the list view since files are going to be from separate paths -
Is it possible to do this depending on what's selected in a combo box? I want to have it so that if the combox box says 'Custom' an input box appears but is deleted if it does not say 'Custom' If GUICtrlRead($Combo) = 'Custom' Then $Custom = GUICtrlCreateInput('', 140, 300, 60, 20) Else GuiCtrlDelete($Custom) EndIf if I use the above code when the combo box is on 'custom' it continuously remakes the input box and is impossible to use
-
I have a list view that is a list of file names however the issue I'm having is the file names can be too long to view without scrolling which means creating (in some cases) an extremely long scroll bar so I was wondering if anybody knew how to show it like other programs such as: C:\....\my file.ext instead of C:\Documents and Settings\All Users\Desktop\Folder\Sub Folder\my file.ext I looked through the help file and didn't see a function for this
-
First I would like to say thank you for this but I'm having some issues I transferred a file (regedit as an example) and when transferring over local LAN it worked perfect however when I transferred over the internet (all ports open) the server detected and received the file but it was less then half the correct size and obviously not working, any clue what I may have done wrong?
-
_IEBodyRead doesn't read right
AcidCorps replied to AcidCorps's topic in AutoIt General Help and Support
Never mind I figured out how to get it, I used ControlClick before control send which i'm assuming simply activated the window, not quite sure why it worked but it did. -
Ok I have a script but I'm not going to show the whole thing for security reasons but the parts that have to do with my question are shown _IELoadWait($oIE) $hwnd = _IEPropertyGet($oIE, "hwnd") $Frame = _IEFrameGetCollection($oIE, 1) _IEAction($Frame, "Focus") ControlSend($hwnd, "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", "{CTRLDown}ac{CTRLUP}") what happens before that is it simply logs me into the website not i'm trying to have it read the page but there is a frame and whenever it tries to read the frame it comes with incorrect data. i manually copied and pasted and it read fine so I'm trying to have my script do it, but i can't figure out why the above script isn't copying the data from the web page, currently the web page is visible for debugging reasons but eventually i would like to have it invisible which is why i'm using control send
-
Bank Of America login problems
AcidCorps replied to AcidCorps's topic in AutoIt General Help and Support
Ok I'm still having issue's here: #include <IE.au3> $User = 'USERNAME' $State = 'STATE' ; 2 charactors such as MA $Pass = 'PASSWORD' $oIE = _IECreate('https://www.bankofamerica.com/index.jsp',0,1) $oForm = _IEFormGetCollection($oIE, 1) $oUser = _IEFormElementGetCollection($oForm, 13) $oState = _IEFormElementGetCollection($oForm, 15) _IEFormElementSetValue($oUser, $User) _IEFormElementSetValue($oState, $State) _IESubmit($oForm) If I use this script it simply fills out the form and doesn't submit it this is really getting on my nerves here as I'm at a complete road stop and can't think of anything else to try