Sign in to follow this  
Followers 0
goldenix

[Solved]_Recrusive Func Return Q

4 posts in this topic

#1 ·  Posted (edited)

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]

Share this post


Link to post
Share on other sites



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


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
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

Share this post


Link to post
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]

Share this post


Link to post
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
Sign in to follow this  
Followers 0