Jump to content

How to get the address to a variable?


autocart
 Share

Recommended Posts

Why should I explain when it's obvious? It's like asking me to explain why hammer shouldn't be used as a saw. Or do you want me to explain that one too?

LOL, unfortunately you are surrounded by a lot of stupid people who cannot see the obvious. I still can't. If you know a way of how to explain it better then yes, please.

Link to comment
Share on other sites

LOL, unfortunately you are surrounded by a lot of stupid people who cannot see the obvious. I still can't. If you know a way of how to explain it better then yes, please.

The functions are not designed to be used in that way, so to put it simply they are not managed by AutoIt.

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

It does in some indirect way. By the way notice my reply to trancexx? I listened and took note as at the time she was the developer of AutoIt, so knows more about the core than you and I combined, unless you know about the internal workings of AutoIt?

Enough to know that use the heap to variables and structures.

Saludos

Link to comment
Share on other sites

I can't imagine situation in AutoIt where pointer to a variable would be needed unless you need to go outside the AutoIt. In that case it's almost mandatory to use dllstruct (COM interface excluded).
autocart, can you make an example or maybe explain better?

For all other cases (when you need to reference a variable) use ByRef.

♡♡♡

.

eMyvnE

Link to comment
Share on other sites

FYI: Since this topic is about finding the address of an autoit variable, I've began a thread on the dllstruct usage elsewhere.

B):thumbsup:

The functions are not designed to be used in that way, so to put it simply they are not managed by AutoIt.

thx for not giving up, this sound a little bit more as if you know what you are talking about. no harm meant.

BTW, does "Developer" (regarding your forum-title) mean that you are a developer of the AutoIt language itself, or that you are maybe an outstanding, registered or whatever "Developer" of programs using the AutoIt language. Or maybe you also could be a "Developer" of this forum. I am not fully sure what it means.

Link to comment
Share on other sites

I can't imagine situation in AutoIt where pointer to a variable would be needed unless you need to go outside the AutoIt. In that case it's almost mandatory to use dllstruct (COM interface excluded).
autocart, can you make an example or maybe explain better?

For all other cases (when you need to reference a variable) use ByRef.

again, did not see it until posting my post, sorry

I am only a very bad hobby programmer, sorry, and as such I was only trying to tranlate this code from ahk to au3:

http://www.autohotkey.com/board/topic/55299-strput-strget/?p=592069

notice the last code line before the return, where the function recursively calls itself:

String := StrGet(&String, char_count, 1200)

EDIT: The function should do the same as http://ahkscript.org/docs/commands/StrPutGet.htm

Edited by autocart
Link to comment
Share on other sites

  • Moderators

autocart,

Both trancexx and I have asked for an explanation of why you wish to use the address of a variable in AutoIt. Your earlier reply about porting AHK code was less than informative, so how about either posting the code in question or explaining in more detail.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

autocart,

Both trancexx and I have asked for an explanation of why you wish to use the address of a variable in AutoIt. Your earlier reply about porting AHK code was less than informative, so how about either posting the code in question or explaining in more detail.

M23

Yes, sorry, had not seen her post fast enough. Up above is the link to the original code now.

Link to comment
Share on other sites

again, did not see it until posting my post, sorry

I am only a very bad hobby programmer, sorry, and as such I was only trying to tranlate this code from ahk to au3:

http://www.autohotkey.com/board/topic/55299-strput-strget/?p=592069

notice the last code line before the return, where the function recursively calls itself:

String := StrGet(&String, char_count, 1200)

I'm not familiar with syntax of AutoHotkey, but from I gather that's typical example where you would need to use dllstruct in AutoIt.

♡♡♡

.

eMyvnE

Link to comment
Share on other sites

but from I gather that's typical example where you would need to use dllstruct in AutoIt.

Woah,... *shock* .... it is?  And in this case it also would be safe to do it?

Please, allow me the question: How do I then determine when it is safe and when it is not?

Link to comment
Share on other sites

Thx for the link and anyway for all your replies, trancexx.

The basic reasons that I saw you explaining there, seem to be: "Using dllstructs that way goes directly against the typing paradigm of the language. On top of that dllstruct is not safe type because data is also accessible through pointer."

Honestly I don't understand the dangers in either. But that may be because I am only a bad hobby programmer. I mean - no harm meant - who cares about typing paradigms or "safeness of type regarding accessibility through pointer", unless it could be accessed through pointer accidently and then make me loose data or even worse cause my windows system to crash and loose the current windows session (blue screen & loss of currently not saved data). If that is not the case, I don't know what should be "unsafe" about it?

What I wonder about is, maybe you and your colleagues speak heavily against its widespread usage, because otherwise it would spread throughout scripts on the net and be a bother to stumble upon / work with and maybe cause uncontrollable side effects like in Terminator, or so. ;-) If this is the case, then just say so and I would understand.

Thanks again for your help, in any case. Regards, Stephan

Link to comment
Share on other sites

Oh, ah, I think it just clicked.

You also said in the other thread: "It's very simple, if you are using dllstruct with/for anything that doesn't absolutely need it then you are abusing it."

If I read it correctly, the emphasise could be on "with/for anything that doesn't absolutely need it". So, if I think I need it and can't find another way of how to achieve the desired functionality, then will always be completely ok to use it, right? In connection of the above together with this thought it now makes (enough) sense to me. Hope I am right. Thx again for your patience.

Link to comment
Share on other sites

  • 3 years later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...