Jump to content

[Solved]_Recrusive Func Return Q


Recommended Posts

Q 1 why wont the global value work hire? I wont have to use strin split if I can use global values but it does not work.

Global $ImageWidth
Global $ImageHeight

$dimensions = _dimensions('test.jpg')
    
$split      =   StringSplit($dimensions,' ')
$ImageWidth =   $split[1]
$ImageHeight =  $split[2]

ConsoleWrite($ImageWidth & ' ' & $ImageHeight & @CRLF)

Func _dimensions($file)
    
    $ImageWidth     = 'xxx'
    $ImageHeight    = 'yyy'
    
;~  Return $ImageWidth & ' ' & $ImageHeight
EndFunc

ExitoÝ÷ Ù
Ê«²Ø¨+0Ym+,£  éz·è®f§qè"¯{]4ÓMW¬¶!yÉÖ¥)àiº.¶Ø^m+kx¦X­ý¸¬¶«j|¨¶«Á¬­¢·­º¹íëÚ第zÊ&zØb    bæÑzÛ«Mú"f yh¶^¶êçÓ~¨è ßÛjëh×6$dimensions = _dimensions('test.jpg')
    
$split      =   StringSplit($dimensions,' ')
$ImageWidth =   $split[1]
$ImageHeight =  $split[2]

ConsoleWrite($ImageWidth & ' ' & $ImageHeight & @CRLF)

Func _dimensions($file)
    
    $ImageWidth     = 'xxx'
    $ImageHeight    = 'yyy'
    
    Return $ImageWidth & ' ' & $ImageHeight
EndFunc

Exit
Edited by goldenix
My Projects:[list][*]Guide - ytube step by step tut for reading memory with autoitscript + samples[*]WinHide - tool to show hide windows, Skinned With GDI+[*]Virtualdub batch job list maker - Batch Process all files with same settings[*]Exp calc - Exp calculator for online games[*]Automated Microsoft SQL Server 2000 installer[*]Image sorter helper for IrfanView - 1 click opens img & move ur mouse to close opened img[/list]
Link to comment
Share on other sites

  • Moderators

goldenix,

Why not use an array and avoid the StringSplit?

Global $aDims[2]

_dimensions('test.jpg')

$ImageWidth  =  $aDims[0]
$ImageHeight =  $aDims[1]

ConsoleWrite($ImageWidth & ' ' & $ImageHeight & @CRLF)

Func _dimensions($file)

    $aDims[0]   = 'xxx'
    $aDims[1]   = 'yyy'

EndFunc

Exit

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

Global seems to work fine without the string split.

Global $ImageHeight
Global $ImageWidth

_dimensions('test.jpg')
   
ConsoleWrite($ImageWidth & ' ' & $ImageHeight & @CRLF)

Func _dimensions($file)
   
    $ImageWidth     = 'xxx'
    $ImageHeight    = 'yyy'
   
EndFunc

ExitoÝ÷ Ù.r¥u©l¢¬²Ø^¶©Ý~í)Úªëk&®¶­sdFÒb33c¶FÖVç6öç5³%Ð ¢b33c¶FÖVç6öç2ÒöFÖVç6öç2b33·FW7Bæ§rb33²¢¤6öç6öÆUw&FRb33c¶FÖVç6öç5³Òfײb33²b33²fײb33c¶FÖVç6öç5³Òfײ5$Äb ¤gVæ2öFÖVç6öç2b33c¶fÆR¢¢b33c¶FÖVç6öç5³ÒÒb33·b33°¢b33c¶FÖVç6öç5³ÒÒb33·b33°¢¢&WGW&âb33c¶FÖVç6öç0¤VæDgVæ0 ¤W
Link to comment
Share on other sites

humm indeed, looks like global is faster than array ill stick with the global.

thanx.

My Projects:[list][*]Guide - ytube step by step tut for reading memory with autoitscript + samples[*]WinHide - tool to show hide windows, Skinned With GDI+[*]Virtualdub batch job list maker - Batch Process all files with same settings[*]Exp calc - Exp calculator for online games[*]Automated Microsoft SQL Server 2000 installer[*]Image sorter helper for IrfanView - 1 click opens img & move ur mouse to close opened img[/list]
Link to comment
Share on other sites

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...