Jump to content

Search the Community

Showing results for tags 'variables'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office


  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start






Found 22 results

  1. include-once #include <File.au3> #include <Excel.au3> #include <String.au3> #include <MsgBoxConstants.au3> Local $file = "TEST.log" FileOpen($file, 0) $TTLPax = 1 For $i = _FileCountLines($file) - $TTLPax to _FileCountLines($file) $line = FileReadLine($file, $i) Global $TktNo = StringMid($line, 8, 13) ; reads 13 characters from $Line starting from the 8th character msgbox(0,'',$TktNo) ; This is just for me to debug For $NoOfPax = 1 to 2 local $TTLSeg = 2 msgbox(0,'',$TTLSeg) msgbox(0,'',"7ABC"& $TktNo &"'N"& $NoOfPax &".1'C1,2'S1,2'B") ; This makes 7ABC1234567890123'N1.1'C1,2'S1,2'B ;But in the next loop I want the value to be 7ABC1234567890333'N2.1'C1,2'S1,2'B Next ExitLoop Next *TEST JAMES BAKER 1.NYC-23JAN 2.TJ 1234567890123 3.TJ 1234567890333 I am reading a file with last 5 lines as above. I want to be able to loop through and pick the values as follows 1- Pick 1234567890123 2- Use it to build a format with N1.1 3- Pick 1234567890333 2- Use it to build a format with N2.1 Need help with the loop. Thank You
  2. First I would just like to say HELLO! to anyone reading. It has been a while since I've posted to the Forums but I'm always crawling around. Now to the matter at hand. I have been looking high and low for a simplistic answer my burned out brain can find but to no avail. I've only recently upped my AutoIt skill and only by a little bit such as ordering my script neatly with my own UDFs and using Global/Dim more often to make my GUI creation understandable and easy to keep things orderly. My current problem however is figuring out how to make my newest endeavor work which is my own "Debugger". I've made a GUI with an Edit Control to display what my Variables are holding and other information from a concurrently running Script. I have access to all of the scripts I'm attempting to connect but I'm dumbfounded on how I would separately read variable information from one running script into another. I'll provide my "Debugger" script that I want to read variables into and a "Meta Script" I'd want to pass info from. #Region Include Files #include <AutoItConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ColorConstantS.au3> #EndRegion #Region AutoIt Options ;Opt("TrayAutoPause", 0) ;Opt("TrayMenuMode", 3) #EndRegion #Region Hotkeys HotKeySet("{ESC}", "ExitProgram") HotKeySet("{PGDN}", "PauseProgram") HotKeySet("!1", "Snippet_1") HotKeySet("!2", "Snippet_2") HotKeySet("!3", "Snippet_3") HotKeySet("!4", "Snippet_4") HotKeySet("!5", "Snippet_5") HotKeySet("!6", "Snippet_6") HotKeySet("!7", "Snippet_7") HotKeySet("!8", "Snippet_8") HotKeySet("!9", "Snippet_9") #EndRegion #Region Global Variables #Region Globals Global $gMain, $ctrlEdit ;, $gParent #EndRegion #Region $gMain Params Dim $gMainW = @DesktopWidth / 2 Dim $gMainH = @DesktopHeight / 2 Dim $gMainX = (@DesktopWidth / 2) - ($gMainW / 2) Dim $gMainY = (@DesktopHeight / 2) - ($gMainH / 2) Dim $gMainStyle = $WS_POPUP Dim $gMainStyleEx = -1 ;Dim $gMainParent = $gParent #EndRegion #Region $ctrlEdit Params Dim $ctrlEditW = Round($gMainW * 0.98) Dim $ctrlEditH = Round($gMainH * 0.98) Dim $ctrlEditX = ($gMainW - $ctrlEditW) / 2 Dim $ctrlEditY = ($gMainH - $ctrlEditH) / 2 Dim $ctrlEditStyle = -1 Dim $ctrlEditStyleEx = -1 #EndRegion #EndRegion #Region GUI Initialization ;$gParent = GUICreate("", -1, -1, -1, -1, -1, $WS_EX_TOOLWINDOW) $gMain = GUICreate("", $gMainW, $gMainH, $gMainX, $gMainY, $gMainStyle, $gMainStyleEx) GUISetBkColor($COLOR_BLACK, $gMain) $ctrlEdit = GUICtrlCreateEdit("MainW: " & $gMainW & @CRLF & "MainH: " & $gMainH & @CRLF & "EditW: " & $ctrlEditW & @CRLF & "EditH: " & $ctrlEditH, $ctrlEditX, $ctrlEditY, $ctrlEditW, $ctrlEditH, $ctrlEditStyle, $ctrlEditStyleEx) GUISetState(@SW_SHOW, $gMain) #EndRegion MainFunction() #Region Main Function (GUI) Func MainFunction() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then Exit EndIf WEnd EndFunc #EndRegion #Region Functions Func Functions() EndFunc #EndRegion #Region Program 1 Func Snippet_1() EndFunc #EndRegion #Region Program 2 Func Snippet_2() EndFunc #EndRegion #Region Program 3 Func Snippet_3() EndFunc #EndRegion #Region Program 4 Func Snippet_4() EndFunc #EndRegion #Region Program 5 Func Snippet_5() EndFunc #EndRegion #Region Program 6 Func Snippet_6() EndFunc #EndRegion #Region Program 7 Func Snippet_7() EndFunc #EndRegion #Region Program 8 Func Snippet_8() EndFunc #EndRegion #Region Program 9 Func Snippet_9() EndFunc #EndRegion #Region Pause/Exit Functions Func PauseProgram() While 1 Sleep(1000) WEnd EndFunc Func ExitProgram() Exit EndFunc #EndRegion Pause/Exit Functions #Region Snippets #CS #CE #EndRegion #Region Other Information #CS #CE #EndRegion That's the Debugger script. Please forgive anything ignorant but point it out if you will, I'll take any pointers to get better! (I usually use a Select to get $GUI_EVENT_CLOSE but this is early on) Now if I made another script with a basic GUI similar to this and wanted to read say the GUI Width ($gMainW) into the Debugger Edit Control could I do it? If so, could I do it for every variable I have in a script? I read something about the Run function and adding the variables as an option parameter I believe which I think I could do with an array to keep it from being super long and ugly but would that be the only way to do this? Any information is going to be appreciated and thank you in advance for your time! Edit: Sadly it just dawned on me that I could make a UDF that will create a child window that will do this instead of having a separate script trying to invade another... I'll still be keeping an eye on this for any comments but I apologize if I wasted your time!
  3. Hello! Im wondering if it is possible to 'empty' the variable value to save memory, for example i often use variable as a onetime use thing and would prefer to 'forget' it after is is used Maybe it is just as easy as to setting $vVar = Null, but i wanted to make sure that this is the case
  4. Is there a reliable way to ensure that data assigned to variables in a script is overwritten or deleted when the script exits? I have scripts that encrypt/decrypt data and would like to ensure, if possible, that the encryption keys and decrypted data do not stay in memory after the script exits. Thanks.
  5. Hi Guys, Is it possible to get a variable on your For..Next loop? Local $Lines1 = _FileCountLines(C:\temp\test.txt) Local $linesToCount2 = $Lines1 + 2 $var = Number($linesToCount2) For $count = 1 To _FileCountLines($FileRead2) Step 1 For $i = $var To $count Next ;Code does stuff here Next Somehow my code doesn't work even though I thought I could convert the variable to a Integer / Number. This code I posted above does not move to the next value. But the code below does... why is that? For $count = 1 To _FileCountLines($FileRead2) Step 1 For $i = 2 To $count Next ;Code does stuff here Next Why is the For loop resetting itself? Is it because the program does not cache the variable and needs to keep on acquiring this variable each time? If so , how would you make this variable static?
  6. I've to upload different number of photos online in different assignments. There is a problem that all photos cannot be selected at once to upload. I have to choose and upload photos one by one. For this purpose I have made a script to automate whatever I have to do manually for choosing and uploading photos one by one. Please see my script below and check the last "MouseClick" command. This command clicks the button to choose and upload next photo. The problem I'm facing is; the last "MouseClick" works 1 step extra when all photos have been selected and uploaded. I mean if 7 photos are to be uploaded, this command opens the box from where next photo is selected and uploaded then it again opens the box and next photo is choosen and so on.... when last photo is selected and uploaded, this button once again opens the box. When all photos are uploaded, it should not click the button to select next photo. Please suggest how can I resolve this issue. #include <AutoItConstants.au3> Sleep(200) HotKeySet("{ESC}","Quit") ;Press ESC key to quit Send("{ALT DOWN}") Send("{TAB}") Send("{ALT UP}") Sleep(200) Local $photos = InputBox("Question", "How many photos to upload?", "#", "", _ - 1, -1, 0, 0) ; How many photos to upload Local $selector = 0 While $photos <> $selector MouseClick("Left", 281, 238, 1) ; mouse click on very first photo in the box. if $selector = 0 Then Send("{ENTER}") ; for selecting very first photo from "open" window. Sleep(800) Else sleep(200) Send("{RIGHT " & $selector & "}") ; for selecting 2nd to onward photos from "open" window. sleep(1000) Send("{ENTER}") sleep(1000) EndIf MouseClick("Left", 495, 198, 1) ; for clicking a button to choose next photo to upload $selector = $selector + 1 WEnd Beep(1500, 300) ; beep when all photos uploaded Exit Regards, Shakeel
  7. Hi, I'm trying to create a shortcut playing with variables but I can't figure out what's wrong I got 2 variables joined in one with for instance Local $path = FileOpenDialog($message, "C:" & "", "Select your executable (*.exe)", 1 + 4) Local $elev = 'c:\windows\System32\cmd.exe /c start "runhigh" /high ' $target = $elev & $path FileCreateShortcut($target, @DesktopCommonDir & "\linked.lnk", StringLeft($target,StringInStr($target,"\",0,-1)) , "" , "" , "c:\i.ico") The problem is that a shortcut is created but instead of the target area I got the start in filled with my variable My second problem is that when I do a shell execute of the result of $target = $elev & $path, Note that if I do a batch with the variable written manually, it's working.
  8. As they're opinion-based to some degree; how are AutoIt's best practices decided and do suggestions get considered? Some suggestions : For...To...Step...Next -loop variable-naming like $iN ($i1, $i2, etc.) : conforms to recommended naming convention, identifies level (albeit inverted to ExitLoop and ContinueLoop's convention) and enables SciTE selection-highlighting (requires minimum of 3 characters). Minimize logic in global scope, separate data & settings from logic, use of vertical space, project organization (folder structure, resource- and include file management). Example (loop variable-naming, minimizing logic in global scope and separation of settings from logic) : #include <Array.au3> Global Enum $RANDOM_RETURNFLOAT, _ $RANDOM_RETURNINTEGER Global Enum $EXITCODE_NONE Global Const $g_sChar0 = '-' Global Const $g_sChar1 = '+' Global Const $g_iAmountX = 10 Global Const $g_iAmountY = $g_iAmountX Main() Func Main() Local $aArray[$g_iAmountY][$g_iAmountX] For $i1 = 0 To $g_iAmountY - 1 For $i2 = 0 To $g_iAmountX - 1 $aArray[$i1][$i2] = Random(0, 1, $RANDOM_RETURNINTEGER) ? $g_sChar1 : $g_sChar0 Next Next _ArrayDisplay($aArray) Exit $EXITCODE_NONE EndFunc Example (project organization) : + project_folder + bak [backup files] + bin [distributed binaries and dependencies] + inc [non-standard include files] + res [resource files (icons, file+install files, etc.)] + usr [configuration files, databases, etc.] - script.au3 - script.exe Example (use of vertical space) : Func _DigitalRoot($iNum) Local $sNum = '' Local $aNum While $iNum > 9 $sNum = String($iNum) $aNum = StringSplit($sNum, '') $iNum = 0 For $i1 = 1 To $aNum[0] $iNum += Int($aNum[$i1]) Next WEnd Return $iNum EndFunc
  9. Hello, I need this for a project and I don't find a method for the next problem. I want when I click a button to create a variable ("$variable1") so if I press one more time to create one more ("$variable2") and create more and more how many times you press the button. Do you have an idea ? Thank you for your attention !
  10. I've ported these two functions from PHP to AU3 to work with URLs. Made them for those who work with libraries like HTTP.au3 (not the one I coded), that needs passing the server domain, path, etc., instead of the full URL. Grab the lib here. ParseURL( $sURL ) Parses the URL and splits it into defined parts. Returns an array: [0] = Full URL (same as $sURL) [1] = Protocol (i.e.: http, https, ftp, ws...) [2] = Domain [3] = Port (or null if not specified) [4] = Path (or null if not specified) [5] = Query string (everything after the ? - or null if not specified) Example: $aExample = ParseURL("https://google.com:8080/?name=doe") MsgBox(0, "Test", "URL: " & $aExample[0] & @CRLF & _ "Protocol: " & $aExample[1] & @CRLF & _ "Domain: " & $aExample[2] & @CRLF & _ "Port: " & $aExample[3] & @CRLF & _ "Path: " & $aExample[4] & @CRLF & _ "Query string: " & $aExample[5]) ParseStr( $sStr ) Parses a query string (similar to the [5] of the previous function) and returns a multidimensional array, where: [0][0] = number of variables found [0][1] = ununsed [1][0] = key name of the first variable [1][1] = first variable value (already URL decoded) [n][0] = key name of the nth variable [n][1] = nth variable value (already URL decoded) Example: include <Array.au3> ; need only to do _ArrayDisplay, not needed by the lib _ArrayDisplay(ParseStr("foo=bar&test=lol%20123")) #cs Result is: [0][0] = 2 [0][1] = ununsed [1][0] = foo [1][1] = bar [2][0] = test [2][1] = lol 123 #ce Feel free to fork!
  11. #include <Date.au3> #include <TrayConstants.au3> HotKeySet("^d", "WhatIsToday") Global $Today = _Date_Time_GetSystemTime While 1 Sleep(100) WEnd Func WhatIsToday() TrayTip("Today's date", "Today is... " & $Today, 8) Sleep(8000) TrayTip("", "", 0) EndFunc ;==>WhatIsToday all it outputs into tray bubble is: Today is... without getting the system time as text
  12. I just thought of this... Do Constants and Variables have any differences other than Constants cannot be changed? I know that Python does not have such things like Constants... But is there a difference between them? any advantages when using Constants whenever we can? The uses of Constants which I have discovered so far are: Coding practices (You know what things are not supposed to be changed while the program is running). Preventing code from modifying their value. So, is there anything more than what meets the eye? I think the developers of AutoIt can answer this question.
  13. Hello! So I have a little script here Func getThe () Local $nearPix = 0123 Local $winPos = WinGetPos ($workWin) FFSaveBMP ("yBarPosArea", "True" , 600, 239, 600, 555, 30, $workWin) $nearPix = FFNearestPixel (600, 220, "0xC1C1C1" , False, $workWin) If $nearPix == 0123 Then ConsoleWrite ("No val for NearPix") ElseIf $nearPix <> 0123 Then ConsoleWrite ("Val is there") ConsoleWrite ($nearPix[0]&","&$nearPix[1]&@CR) EndIf EndFunc And when it comes time to run it I get a return of When it says "non-accessible variable" , what is it meaning by that? The scope is "Local" and it is within the same function. The variable was even referenced in the step right before the one throwing the error. Any insight would be thoroughly appreciated. Thank you!
  14. I am trying to get my code to be loopable based off of a variable count for example number of images selected variable is named $imgCount = 6 (meaning there were 6 images selected) I need to know if this will work assuming all images paths are stored in the gui created... $image1 $image2 $image3 $image4 $image5 $image6 That would be the variable names that would equal the gui for guictrlread .... $ImUploadCount = 0 $imageCounter = 6 ; has been set by incrementing every time an image was picked via gui button 1-6 we will assume it equals 6 Func Upload() Do $imUpload = $ImUploadCount + 1 _IEFormElementSetValue($browsefield, GUICtrlRead($Image & $imUpload)) Until $imageCounter = $imUpload So Essentially will $Image & $imUpload provide $image1, $image2, $image3, etc... when it sets the value then uploads? or will that cause a problem...? "is there a better way to do this?
  15. Hi AutoIt community! I have a quick question. According to AutoIt help file on Variables, So what the meaning of "auJasperatically destroyed"? Is it completely destroyed or might be destroyed? I am writing a security software and it is important to not let any password lingers in the memory. In a function, I have saved the password typed by user in a local var. I am not sure if I need to reset this variable before the function ends. (Or is there any better security practices?) Thanks very much!
  16. I need a function where it will get a string as parameter which will of syntax in VBScript like below a&"asdasd"&asd&"as&dsf&gdf"&fs Here in the above string what ever in the quotes we shouldn't replace them as they are taken as normal strings.And if the ampersand(&) if outside the quotes then we need to replace them with plus(+).And the normal words which are outside the quotes we need to append them with $. So the output will be as below. $a+"asdasd"+$asd+"as&dsf&gdf"+$fs. Can you please help me on this.I'm unable to differentiate with & in the quotes and outside the quotes. Don't know how to check whether a string is in quotes or not.
  17. Hello! I havent found any solution for my problem in the Internet or on the Forum, excuse me If i overlooked something. For $i = 1 To 5 Assign("oGoogle"&$i, _IECreate("google.com" 0, 1, 0, 0)) $GoogleVar = $oGoogle&$i Assign("oSearchInput"&$i, _IEGetObjById($GoogleVar, "lst-ib")) NextWhat I'am trying to do is open Google.com 5 times with _IECreate and assign it to the Variables "$oGoogle1, $oGoogle2,...", but I have to use these Variables again, because I want to assign the Searchinputs from every $oGoogle to another Variable ($oSearchInput1, $oSearchInput2,...). But if i try to use this code, Autoit tells me that $oGoogle is not declared! I hope someone is willing to help me! (Excuse my Grammar )
  18. There is several ways to get programmatically Windows Environment Variables : - using "set" cmd line tool. - using objWMIService with Win32_Environment. - reading HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment. but also using the WinAPi GetEnvironmentStrings function. Here is the Ansi version : #NoTrayIcon #Region ;************ Includes ************ #Include <WindowsConstants.au3> #Include <GUIConstantsEx.au3> #Include <GuiListView.au3> #Include <WinAPIMisc.au3> #Include <GuiMenu.au3> #EndRegion ;************ Includes ************ Opt ( 'GUIResizeMode', $GUI_DOCKAUTO ) Opt ( 'MustDeclareVars', 1 ) Global $hGui, $hListview, $iGuiWidth, $iGuiHeight, $aEnvVariables, $iIndex, $hLVMenu, $bRightClick = False Global $iExport, $sExportFilePath, $sTxt, $hFile Global Enum $iId_Copy = 3000, $Id_Save $aEnvVariables = _WinApi_GetEnvironmentStringsA() _Gui() For $i = 0 To UBound ( $aEnvVariables ) -1 $iIndex = _GUICtrlListView_AddItem ( $hListview, $aEnvVariables[$i][0], -1, 0 ) _GUICtrlListView_AddSubItem ( $hListView, $iIndex, $aEnvVariables[$i][1], 1 ) Next #Region ------ Main Loop ------------------------------ While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE GUIDelete ( $hGui ) Exit Case Else If $bRightClick = True Then $bRightClick = False $hLVMenu = _GUICtrlMenu_CreatePopup() If _GUICtrlMenu_IsMenu ( $hLVMenu ) Then _GUICtrlMenu_InsertMenuItem ( $hLVMenu, 0, 'Copy Selected Variable Name', $iId_Copy ) _GUICtrlMenu_InsertMenuItem ( $hLVMenu, 1, 'Export Variables List', $Id_Save ) _GUICtrlMenu_SetMenuStyle ( $hLVMenu, BitOR ( $MNS_CHECKORBMP, $MNS_AUTODISMISS, $MNS_NOCHECK ) ) _GUICtrlMenu_TrackPopupMenu ( $hLVMenu, $hGui ) _GUICtrlMenu_DestroyMenu ( $hLVMenu ) $hLVMenu = 0 EndIf EndIf If $iExport Then $iExport = 0 $sExportFilePath = FileSaveDialog ( 'Export Variables List', '', 'Text Files (*.txt;*.csv)|All Files (*.*)', 2+16, 'Windows Environment Variables List', $hgui ) If Not @error Then $sTxt = '' For $i = 0 To UBound ( $aEnvVariables ) -1 $sTxt &= StringStripWS ( $aEnvVariables[$i][0], 7 ) & ' : ' & StringStripWS ( $aEnvVariables[$i][1], 7 ) & @CRLF Next $hFile = FileOpen ( $sExportFilePath, 2+8+512 ) FileWrite ( $hFile, $sTxt ) FileClose ( $hFile ) EndIf EndIf EndSwitch Sleep ( 10 ) WEnd #EndRegion --- Main Loop ------------------------------ Func _Gui() $hGui = GUICreate ( 'Windows Environment Variables Viewer', 700, 600, -1, -1, BitOR ( $WS_MINIMIZEBOX, $WS_MAXIMIZEBOX, $WS_SYSMENU, $WS_SIZEBOX ) ) GUICtrlCreateListView ( 'Environment Variable Names|Values', 10, 10, 680, 555 ) $hListview = GUICtrlGetHandle ( -1 ) _GUICtrlListView_SetColumnWidth ( $hListview, 0, 220 ) _GUICtrlListView_SetColumnWidth ( $hListview, 1, @DesktopWidth - 270 ) Local $aPos = WinGetPos( $hGui ) $iGuiWidth = $aPos[2] $iGuiHeight = $aPos[3] GUIRegisterMsg ( $WM_GETMINMAXINFO, '_WM_GETMINMAXINFO' ) GUIRegisterMsg ( $WM_NOTIFY, '_WM_NOTIFY' ) GUIRegisterMsg ( $WM_COMMAND, '_WM_COMMAND' ) GUISetState() EndFunc ;==> _Gui() Func _WinApi_FreeEnvironmentStringsA ( $pEnv ) ; https://msdn.microsoft.com/en-us/library/windows/desktop/ms683151(v=vs.85).aspx Local $aRet = DllCall ( 'kernel32.dll', 'int', 'FreeEnvironmentStringsA', 'ptr', $pEnv ) If Not @error And $aRet[1] <> 0 Then Return SetError ( 0, @extended, $aRet[1] ) Return SetError ( @error, 0, 0 ) EndFunc ;==> _WinApi_FreeEnvironmentStringsA() Func _WinApi_GetEnvironmentStringsA() ; https://msdn.microsoft.com/en-us/library/windows/desktop/ms683187(v=vs.85).aspx Local $pEnvBlock, $iPtrStringLen, $tEnvString, $aSplit, $aRet, $sEnvString, $aEnvString[0][2] $aRet = DllCall ( 'kernel32.dll', 'ptr', 'GetEnvironmentStringsA' ) ; GetEnvironmentStringsA returns OEM characters. If @error Then Return SetError ( @error, @extended, '' ) $pEnvBlock = $aRet[0] ; pointer to a block of memory that contains the environment variables. If Not IsPtr ( $pEnvBlock ) Then Return SetError ( -1, 0, '' ) While 1 $iPtrStringLen = _WinAPI_StringLenA ( $pEnvBlock ) If $iPtrStringLen > 0 Then $tEnvString = DllStructCreate ( 'char[' & $iPtrStringLen + 1 & ']', $pEnvBlock ) $sEnvString = _WinAPI_OemToChar ( DllStructGetData ( $tEnvString, 1 ) ) ; Convert Oem to Ansi. If StringLeft ( $sEnvString, 1 ) <> '=' Then $aSplit = StringSplit ( $sEnvString, '=', 1+2 ) If Not @error Then ReDim $aEnvString[UBound ( $aEnvString )+1][2] $aEnvString[UBound ( $aEnvString )-1][0] = $aSplit[0] ; name $aEnvString[UBound ( $aEnvString )-1][1] = $aSplit[1] ; value EndIf EndIf $pEnvBlock += $iPtrStringLen + 1 Else _WinApi_FreeEnvironmentStringsA ( $pEnvBlock ) ; Free memory block. $tEnvString = 0 Return SetError ( 0, 0, $aEnvString ) EndIf WEnd EndFunc ;==> _WinApi_GetEnvironmentStringsA() Func _WM_COMMAND ( $hWnd, $iMsg, $wParam, $lParam ) #forceref $hWnd, $iMsg, $wParam, $lParam Switch $wParam Case $iId_Copy ClipPut ( _GUICtrlListView_GetItemText ( $hListview, _GUICtrlListView_GetSelectedIndices ( $hListview ), 0 ) ) Case $Id_Save $iExport = 1 EndSwitch EndFunc ;==> _WM_COMMAND() Func _WM_GETMINMAXINFO ( $hWnd, $iMsg, $wParam, $lParam ) #forceref $hWnd, $iMsg, $wParam, $lParam Switch $hWnd Case $hGui Local $tMinMaxInfo = DllStructCreate ( 'int;int;int;int;int;int;int;int', $lParam ) DllStructSetData ( $tMinMaxInfo, 7, $iGuiWidth ) ; min w DllStructSetData ( $tMinMaxInfo, 8, $iGuiHeight ) ; min h $tMinMaxInfo = 0 ; Release resource. EndSwitch EndFunc ;==> _WM_GETMINMAXINFO() Func _WM_NOTIFY ( $hWnd, $iMsg, $wParam, $lParam ) #forceref $hWnd, $iMsg, $wParam, $lParam Local $hWndFrom, $iCode, $tNMHDR, $tInfo $tNMHDR = DllStructCreate ( $tagNMLISTVIEW, $lParam ) $hWndFrom = HWnd ( DllStructGetData ( $tNMHDR, 'hWndFrom' ) ) $iCode = DllStructGetData ( $tNMHDR, 'Code' ) $tInfo = DllStructCreate ( $tagNMLISTVIEW, $lParam ) Switch $hWndFrom Case $hListView Switch $iCode Case $NM_RCLICK If DllStructGetData ( $tInfo, 'Item' ) >= 0 Then If $hLVMenu <> 0 Then _GUICtrlMenu_DestroyMenu ( $hLVMenu ) $hLVMenu = 0 $bRightClick = True EndIf EndSwitch EndSwitch $tInfo = 0 $tNMHDR = 0 Return $GUI_RUNDEFMSG EndFunc ;==> _WM_NOTIFY()Tested under Win XP SP3x86 and Win 8.1x64
  19. Hi. I've managed to piece this script together from tutorials and examples I've found, but I've hit a dead-end and could use a little help. I'm trying to create a script that will transfer text from a specific page onto an Excel worksheet. According to what I've read, it should enter 'pizza' into cel A3 of an Excel worksheet, and 'developer' into cel A4. #include <Array.au3> #include <Excel.au3> #Include <FF.au3> #include <String.au3> ; Go to page and copy the source to clipboard. If _FFStart("http://ff-au3-example.thorsten-willert.de/") Then $sHTML = _FFReadHTML() If Not @error Then ClipPut($sHTML) EndIf Example() Func Example() ; Declare variables and set to the words surrounding "pizza" and "developer". Local $sWordOne = _StringBetween($sHTML, "hlen Sie eine ", ":</legend>") Local $sWordTwo = _StringBetween($sHTML, "Mozilla ", " center") ; Create application object and create a new workbook Local $oAppl = _Excel_Open() If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeWrite Example", "Error creating the Excel application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended) Local $oWorkbook = _Excel_BookNew($oAppl) If @error Then MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeWrite Example", "Error creating the new workbook." & @CRLF & "@error = " & @error & ", @extended = " & @extended) _Excel_Close($oAppl) Exit EndIf ; ***************************************************************************** ; Write a 1D array to the active sheet in the active workbook ; ***************************************************************************** Global $aArray1D = [$sWordOne, $sWordTwo] _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, $aArray1D, "A3") If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeWrite Example 2", "Error writing to worksheet." & @CRLF & "@error = " & @error & ", @extended = " & @extended) MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeWrite Example 2", "1D array successfully written.") EndFunc ;==>ExampleBut for some reason, the values of variables $sWordOne and $sWordTwo seem to get deleted before it reaches the Excel page, so the cels just wind up blank. I've double (and triple) checked that the _StringBetween variables are correct when used on their own. I've also found that if I change the variables to integers, it copies them to Excel as it should. I've spent a few hours looking at this and getting nowhere. Am I doing something obviously wrong?
  20. It might not need to be fixed, but I found it strange that Const are not checked first, before everything else. I wrote a UDF and I used/declared a Const variable in the main script, but when I went to compile the script, I got a warning message stating that my variable was not declared in one of my included UDFs, yet I declared it in the main script. Once I put the Const variable declaration above the include statement for the UDF, the warning went away. I guess I thought that Const variables would be declared first above all else, as they are constants? With that in mind, a UDF that declares Const values would need to be put before any UDF's that were to use that Const...I would think that would be a nightmare, to have to make sure one UDF is above another one for declarations. Is this by design, and can it be changed? On another note, after you close the script, the warning UDF is opened in Scite, making it a bit of a pain to have to go back to the original script. And in order for me to get rid of the warning in my UDF, I have to go to the line above it and hit delete, then hit enter, to make the format correct again. I have even tried Tidy and that only works sometimes - can we also look at fixing that hotkey, to remove any Scite messages in the script - no, not the lines inputted by Tidy, but the ones before Tidy is ran.
  21. Thank you for responding, I have hit a wall and it seems so simple, but I just can't get it. I have to run a Java update. The script needs to look in the registry, see version 7.x and then do something. If the RegRead returns a value of 1.7.0_15 then stop. If RegRead returns any other version 7, then continue on and run the install. Everything else in my code is working fine, except being able to identify the product code and do the next thing: Close or install. Here is part of my code: #RequireAdmin Local $a = "C:\Windows\Temp\" Dim $var2 = "1.7.0_15" Local $b = "C:\Users\" Local $Sun = "C:\Users\" & @UserName & "\AppData\LocalLow\Sun\Java\Deployment\" Local $Sun2 = "C:\Users\" & @UserName & "\AppData\LocalLow\Sun\Java\Deployment\security\" Local $Sun3 = "C:\Users\" & @UserName & "\AppData\LocalLow\Sun\Java\Deployment\tmp\si" ;File copy section: Each Application is taken from the source and copied to the folders created ;If $a = True Then FileInstall("E:\JAVA\JRE7_15\jre-7u15-windows-i586.exe", "C:\Windows\Temp\jre-7u15-windows-i586.exe") ;Sleep(5000) ;Registry lookup for Java installation Local $var = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\", "Java7FamilyVersion") Sleep(5000) If $var = $var2 Then MsgBox(4096, "I see It:", $var) EndIf Else If Not $var2 = $var Then MsgBox(4096, "It Ain't Here:", $var) RunWait(@WindowsDir & "\Temp\jre-7u15-windows-i586.exe /s") Sleep(10000) ;MsgBox(4096, "I see It:", $var) EndIf everything below this works fine and the install file works fine as well. I placed message boxes in the code so I could track the code and they will be removed later. Any ideas would be great. Cheers
  22. I'm just learning sqlite3 forgive me if my concepts are not right, anyway I'm trying to add two variables to a SELECT statement: The variables would be $start and $end that the user would choose from a Combobox. The database holds 1 table (Distances) that has the distances between two locations ($start and $end). In the code that follows (if possible) how can I place $start where "Midlothian MS" is and $end where "School Board" is in the Select statement? I've tried several types of concatenation but no joy. Here is the schema: CREATE TABLE fulldata (id integer primary key autoincrement, Start text,End text ,Distance integer); _SQLite_Startup() ConsoleWrite("_SQLite_LibVersion=" & _SQLite_LibVersion() & @CRLF) _SQLite_Open('distance.db') ; open Database _SQLite_QuerySingleRow(-1, "SELECT distance FROM fulldata WHERE Start = 'Midlothian MS' AND End = 'School Board';", $aRow) _SQLite_Close() _SQLite_Shutdown() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 MsgBox(0, "The distance is:",$aRow[0]) Case $Button2 _ArrayToClip($aRow, 0) ;send result to clipboard EndSwitch WEnd Thanks for your help, ihudson
  • Create New...