Clayson Posted July 6, 2020 Share Posted July 6, 2020 (edited) Good Morning!!! I'm trying to access a query saved in a query.sql file for example. This query has two variables. But when I call the contents of the file, I don't understand the query. The variable is not replaced by its value so there is no record. Can you help me? thank you LOCAL $sFilePath = "C:\robotdesp\queryspmi.sql" ; Open the file for reading and store the handle to a variable. Local $hFileOpen = FileOpen($sFilePath, $FO_READ) If $hFileOpen = -1 Then MsgBox($MB_SYSTEMMODAL, "", "ERRO NA LEITURA DO ARQUIVO "&$sFilePath) Return False EndIf ; Read the contents of the file using the handle returned by FileOpen. Local $sFileRead = FileRead($hFileOpen) ;~ ; Close the handle returned by FileOpen. ;~ FileClose($hFileOpen) ;~ ; Display the contents of the file. ; the query in the file is : "SELECT EAS.NOME_EMPRESA_PAI EMPRESA ,EAS.NOME_EA EA ,NOTAS.NOME_EQUIPE EQUIPE ,NOTAS.NOTA_SERVICO NOTA , NOTAS.SEQUENCIA SEQUENCIA FROM IGP.SPMI_EA_EQUIPE_NOTAS_DESP NOTAS LEFT JOIN IGP.SYS_ESTRUTURA EAS ON EAS.COD_EA = NOTAS.ID_EA_CWSI WHERE DIA = TRUNC(SYSDATE) AND ETL_DESPACHAVEL = 1 AND EAS.NOME_EMPRESA_PAI = '"&$nomeemresapai&"' AND EQ_VINCULADA_DESPACHO_AUTOMATICO_CWSI = '"&$eqp_dedic_ou_multi&"' ORDER BY EAS.NOME_EMPRESA_PAI ,EAS.NOME_EA ,NOTAS.NOME_EQUIPE ,NOTAS.SEQUENCIA" .Source = $sFileRead ; .Open Edited July 6, 2020 by Clayson Changed ridiculously large font Link to comment Share on other sites More sharing options...
seadoggie01 Posted July 6, 2020 Share Posted July 6, 2020 (edited) Try using something like this: $sFileRead = StringReplace($sFileRead, "$nomeemresapai", $nomeemresapai) AutoIt doesn't auto-expand variables like you're thinking. (Also, please try to clear the formatting from your posts after copying out of Google Translate, it's a mess right now ) Edit: And using the code tag "<>" is very helpful when you're posting code Edited July 6, 2020 by seadoggie01 All my code provided is Public Domain... but it may not work. Use it, change it, break it, whatever you want. Spoiler My Humble Contributions:Personal Function Documentation - A personal HelpFile for your functionsAcro.au3 UDF - Automating Acrobat ProToDo Finder - Find #ToDo: lines in your scriptsUI-SimpleWrappers UDF - Use UI Automation more Simply-erKeePass UDF - Automate KeePass, a password managerInputBoxes - Simple Input boxes for various variable types Link to comment Share on other sites More sharing options...
Clayson Posted July 6, 2020 Author Share Posted July 6, 2020 3 hours ago, seadoggie01 said: Try using something like this: $sFileRead = StringReplace($sFileRead, "$nomeemresapai", $nomeemresapai) AutoIt doesn't auto-expand variables like you're thinking. (Also, please try to clear the formatting from your posts after copying out of Google Translate, it's a mess right now ) Edit: And using the code tag "<>" is very helpful when you're posting code my dysgraphia kills me with shame lol ... thanks for letting me know, I hadn't noticed. I will try what you suggested. Link to comment Share on other sites More sharing options...
Clayson Posted July 6, 2020 Author Share Posted July 6, 2020 37 minutes ago, Clayson said: my dysgraphia kills me with shame lol ... thanks for letting me know, I hadn't noticed. I will try what you suggested. @seadoggie01 SOLVED, THANKS GUY!!! seadoggie01 1 Link to comment Share on other sites More sharing options...
seadoggie01 Posted July 6, 2020 Share Posted July 6, 2020 No problem! And don't be ashamed, some disabilities can help you in ways. I'm a bit dyslexic (why is that word so hard to spell?) and I have some ADD tendencies. The ADD helps me concentrate in huge bursts without noticing it sometimes and complete lots of small things quickly at other times. I haven't found things that dyslexia helps with (yet), but I'm sure it makes me think about things differently (I think part of the reason I started programming was so I wouldn't have to deal with all of the numbers, especially in accounting), which is just part of what makes me who I am Melba23 and Clayson 1 1 All my code provided is Public Domain... but it may not work. Use it, change it, break it, whatever you want. Spoiler My Humble Contributions:Personal Function Documentation - A personal HelpFile for your functionsAcro.au3 UDF - Automating Acrobat ProToDo Finder - Find #ToDo: lines in your scriptsUI-SimpleWrappers UDF - Use UI Automation more Simply-erKeePass UDF - Automate KeePass, a password managerInputBoxes - Simple Input boxes for various variable types Link to comment Share on other sites More sharing options...
Clayson Posted July 6, 2020 Author Share Posted July 6, 2020 2 minutes ago, seadoggie01 said: No problem! And don't be ashamed, some disabilities can help you in ways. I'm a bit dyslexic (why is that word so hard to spell?) and I have some ADD tendencies. The ADD helps me concentrate in huge bursts without noticing it sometimes and complete lots of small things quickly at other times. I haven't found things that dyslexia helps with (yet), but I'm sure it makes me think about things differently (I think part of the reason I started programming was so I wouldn't have to deal with all of the numbers, especially in accounting), which is just part of what makes me who I am CERTAINLY, DYSLEXIA HELPS YOU TO ENCRYPT, ONLY YOU CAN UNDERSTAND WHAT YOU WRITE ... WE ARE SLOW TO UNDERSTAND SOME THINGS BUT WE UNDERSTAND OTHERS BEFORE EVERYONE, AUTOMATION, AUTOIT BECOMES A GREAT ALLY IN THIS WAY, ALWAYS INTERESTED IN THIS WAY AUTOMATE TO REDUCE ERRORS !!! THANK YOU FOR YOUR WORDS TOO! Link to comment Share on other sites More sharing options...
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